mirror of
https://github.com/linsa-io/linsa.git
synced 2026-03-18 07:13:55 +01:00
* feat: Start using guest auth * feat: Implement more functionality to work as guest * chore: update package and tweak public route * chore: update root package json * chore: update web package json --------- Co-authored-by: Aslam H <iupin5212@gmail.com>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
"use client"
|
|
|
|
import React, { useMemo, useRef } from "react"
|
|
import { TopicDetailHeader } from "./Header"
|
|
import { TopicSections } from "./partials/topic-sections"
|
|
import { atom } from "jotai"
|
|
import { useAccount, useAccountOrGuest } from "@/lib/providers/jazz-provider"
|
|
import { useTopicData } from "@/hooks/use-topic-data"
|
|
|
|
interface TopicDetailRouteProps {
|
|
topicName: string
|
|
}
|
|
|
|
export const openPopoverForIdAtom = atom<string | null>(null)
|
|
|
|
export function TopicDetailRoute({ topicName }: TopicDetailRouteProps) {
|
|
const { me } = useAccountOrGuest({ root: { personalLinks: [] } })
|
|
const { topic } = useTopicData(topicName, me)
|
|
// const { activeIndex, setActiveIndex, containerRef, linkRefs } = useLinkNavigation(allLinks)
|
|
const linksRefDummy = useRef<(HTMLLIElement | null)[]>([])
|
|
const containerRefDummy = useRef<HTMLDivElement>(null)
|
|
|
|
if (!topic || !me) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<div className="flex h-full flex-auto flex-col">
|
|
<TopicDetailHeader topic={topic} />
|
|
<TopicSections
|
|
topic={topic}
|
|
sections={topic.latestGlobalGuide?.sections}
|
|
activeIndex={0}
|
|
setActiveIndex={() => {}}
|
|
linkRefs={linksRefDummy}
|
|
containerRef={containerRefDummy}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|