import React from "react" import Link from "next/link" import { usePathname } from "next/navigation" import { useAccount } from "@/lib/providers/jazz-provider" import { cn } from "@/lib/utils" import { LaIcon } from "@/components/custom/la-icon" import { ListOfTopics } from "@/lib/schema" import { LEARNING_STATES, LearningStateValue } from "@/lib/constants" export const TopicSection: React.FC<{ pathname: string }> = ({ pathname }) => { const { me } = useAccount({ root: { topicsWantToLearn: [], topicsLearning: [], topicsLearned: [] } }) const topicCount = (me?.root.topicsWantToLearn?.length || 0) + (me?.root.topicsLearning?.length || 0) + (me?.root.topicsLearned?.length || 0) const isActive = pathname.startsWith("/topics") if (!me) return null return (
) } interface TopicSectionHeaderProps { topicCount: number isActive: boolean } const TopicSectionHeader: React.FC = ({ topicCount, isActive }) => (

Topics {topicCount > 0 && {topicCount}}

) interface ListProps { topicsWantToLearn: ListOfTopics topicsLearning: ListOfTopics topicsLearned: ListOfTopics } const List: React.FC = ({ topicsWantToLearn, topicsLearning, topicsLearned }) => { const pathname = usePathname() return (
) } interface ListItemProps { label: string value: LearningStateValue href: string count: number isActive: boolean } const ListItem: React.FC = ({ label, value, href, count, isActive }) => { const le = LEARNING_STATES.find(l => l.value === value) if (!le) return null return (

{label}

{count > 0 && ( {count} )}
) }