import { Button, Center, Group, Pagination, Paper, SimpleGrid, Skeleton, Stack, Title } from '@mantine/core'; import { IconFileUpload, IconFilesOff } from '@tabler/icons-react'; import Link from 'next/link'; import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; import { useApiPagination } from '../useApiPagination'; import dynamic from 'next/dynamic'; const DashboardFile = dynamic(() => import('@/components/file/DashboardFile'), { loading: () => , }); export default function Files({ id }: { id?: string }) { const router = useRouter(); const [page, setPage] = useState(router.query.page ? parseInt(router.query.page as string) : 1); const { data, isLoading } = useApiPagination({ page, id, }); useEffect(() => { router.replace( { query: { ...router.query, page: page, }, }, undefined, { shallow: true }, ); }, [page]); return ( <> 0) || isLoading ? 3 : 1, }} spacing='md' pos='relative' > {isLoading ? ( [...Array(9)].map((_, i) => ) ) : (data?.page?.length ?? 0 > 0) ? ( data?.page.map((file) => ) ) : (
No files found {!id && ( )}
)}
); }