"use client" import React from "react" import Link from "next/link" import { useCoState } from "@/lib/providers/jazz-provider" import { PublicGlobalGroup } from "@/lib/schema/master/public-group" import { ID } from "jazz-tools" import { TopicDetailHeader } from "./Header" import { LaIcon } from "@/components/custom/la-icon" import { cn, ensureUrlProtocol } from "@/lib/utils" import { Section as SectionSchema, Link as LinkSchema } from "@/lib/schema" interface TopicDetailRouteProps { topicName: string } export function TopicDetailRoute({ topicName }: TopicDetailRouteProps) { const topics = useCoState(PublicGlobalGroup, process.env.NEXT_PUBLIC_JAZZ_GLOBAL_GROUP as ID, { root: { topics: [] } }) const topic = topics?.root.topics.find(topic => topic?.name === topicName) if (!topic) { return null } return (
{topic.latestGlobalGuide?.sections?.map( (section, index) => section?.id &&
)}
) } interface SectionProps { section: SectionSchema } function Section({ section }: SectionProps) { return (

{section.title}

{section.links?.map((link, index) => link?.url && )}
) } interface LinkItemProps { link: LinkSchema } function LinkItem({ link }: LinkItemProps) { return (
  • {link.title}

  • ) }