import * as React from "react" 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" import { Link } from "@tanstack/react-router" export const TopicSection: React.FC = () => { const { me } = useAccount({ root: { topicsWantToLearn: [], topicsLearning: [], topicsLearned: [], }, }) const topicCount = (me?.root.topicsWantToLearn?.length || 0) + (me?.root.topicsLearning?.length || 0) + (me?.root.topicsLearned?.length || 0) if (!me) return null return (
) } interface TopicSectionHeaderProps { topicCount: number } const TopicSectionHeader: React.FC = ({ topicCount, }) => (

Topics {topicCount > 0 && ( {topicCount} )}

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

{label}

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