"use client"
import { useIntl } from "react-intl"
import { logout } from "@/constants/routes/handleAuth"
import { trpc } from "@/lib/trpc/client"
import useDropdownStore from "@/stores/main-menu"
import SkeletonShimmer from "@/components/SkeletonShimmer"
import Divider from "@/components/TempDesignSystem/Divider"
import Link from "@/components/TempDesignSystem/Link"
import Title from "@/components/TempDesignSystem/Text/Title"
import useLang from "@/hooks/useLang"
import styles from "./my-pages-mobile-dropdown.module.css"
import type { ReactNode } from "react"
import { DropdownTypeEnum } from "@/types/components/dropdown/dropdown"
export default function MyPagesMobileDropdown() {
const intl = useIntl()
const { toggleDropdown, isMyPagesMobileMenuOpen } = useDropdownStore()
const handleOnClick = () => toggleDropdown(DropdownTypeEnum.MyPagesMobileMenu)
return (
)
}
function List({ children }: { children: ReactNode }) {
return (
<>
>
)
}
function PrimaryLinks({ handleOnClick }: { handleOnClick: () => void }) {
const {
data: myPagesNavigation,
isLoading,
isSuccess,
} = useMyPagesNavigation()
const primaryLinks = myPagesNavigation?.primaryLinks ?? []
return (
<>
{isLoading && }
{isSuccess &&
primaryLinks.map((link, i) => (
{link.text}
))}
>
)
}
function SecondaryLinks({ handleOnClick }: { handleOnClick: () => void }) {
const {
data: myPagesNavigation,
isLoading,
isSuccess,
} = useMyPagesNavigation()
const secondaryLinks = myPagesNavigation?.secondaryLinks ?? []
const intl = useIntl()
const lang = useLang()
return (
<>
{isLoading && }
{isSuccess &&
secondaryLinks.map((link, i) => (
{link.text}
))}
{intl.formatMessage({ id: "Log out" })}
>
)
}
function Skeletons({ count }: { count: number }) {
return (
<>
{Array.from({ length: count }).map((_, i) => (
))}
>
)
}
function useMyPagesNavigation() {
const lang = useLang()
return trpc.navigation.myPages.useQuery({ lang })
}