"use client" import { useIntl } from "react-intl" import { logout } from "@/constants/routes/handleAuth" import { trpc } from "@/lib/trpc/client" import { ArrowRightIcon } from "@/components/Icons" import Divider from "@/components/TempDesignSystem/Divider" import Link from "@/components/TempDesignSystem/Link" import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import useLang from "@/hooks/useLang" import { useTrapFocus } from "@/hooks/useTrapFocus" import styles from "./myPagesMenuContent.module.css" import type { MyPagesMenuProps } from "../MyPagesMenu" type Props = MyPagesMenuProps & { toggleOpenStateFn: () => void } export default function MyPagesMenuContent({ membership, toggleOpenStateFn, user, membershipLevel, }: Props) { const intl = useIntl() const myPagesMenuContentRef = useTrapFocus() const { data: myPagesNavigation } = useMyPagesNavigation() const primaryLinks = myPagesNavigation?.primaryLinks ?? [] const secondaryLinks = myPagesNavigation?.secondaryLinks ?? [] const membershipPoints = membership?.currentPoints const introClassName = membershipLevel && membershipPoints ? `${styles.intro}` : `${styles.intro} ${styles.noMembership}` if (primaryLinks.length === 0 && secondaryLinks.length === 0) { return null } return ( ) } function PrimaryLinks({ toggleOpenStateFn, }: { toggleOpenStateFn: () => void }) { const { data: myPagesNavigation } = useMyPagesNavigation() const primaryLinks = myPagesNavigation?.primaryLinks ?? [] return ( ) } function SecondaryLinks({ toggleOpenStateFn, }: { toggleOpenStateFn: () => void }) { const intl = useIntl() const lang = useLang() const { data: myPagesNavigation } = useMyPagesNavigation() const secondaryLinks = myPagesNavigation?.secondaryLinks ?? [] return ( ) } const useMyPagesNavigation = () => { const lang = useLang() return trpc.navigation.myPages.useQuery({ lang: lang, }) }