import React, { useCallback, useEffect, useMemo, useRef, useState } from "react" import { LinkItem } from "./link-item" import { LaAccount, PersonalLinkLists, Section as SectionSchema, Topic, UserRoot } from "@/lib/schema" import { Skeleton } from "@/components/ui/skeleton" import { LaIcon } from "@/components/custom/la-icon" interface SectionProps { topic: Topic section: SectionSchema activeIndex: number startIndex: number linkRefs: React.MutableRefObject<(HTMLLIElement | null)[]> setActiveIndex: (index: number) => void me: { root: { personalLinks: PersonalLinkLists } & UserRoot } & LaAccount personalLinks: PersonalLinkLists } export function Section({ topic, section, activeIndex, setActiveIndex, startIndex, linkRefs, me, personalLinks }: SectionProps) { const [nLinksToLoad, setNLinksToLoad] = useState(10) const linksToLoad = useMemo(() => { return section.links?.slice(0, nLinksToLoad) }, [section.links, nLinksToLoad]) return (
{section.title}