diff --git a/src/components/file/DashboardFileType.tsx b/src/components/file/DashboardFileType.tsx index fc18bc60b..5a5db94fc 100755 --- a/src/components/file/DashboardFileType.tsx +++ b/src/components/file/DashboardFileType.tsx @@ -19,7 +19,7 @@ import fileIcon from './fileIcon'; function PlaceholderContent({ text, Icon }: { text: string; Icon: Icon }) { return ( - + {text} @@ -126,7 +126,11 @@ export default function DashboardFileType({ transform: 'translate(-50%, -50%)', }} > - + ) : ( diff --git a/src/components/pages/dashboard/index.tsx b/src/components/pages/dashboard/index.tsx index ed23be143..c45cfe998 100755 --- a/src/components/pages/dashboard/index.tsx +++ b/src/components/pages/dashboard/index.tsx @@ -3,7 +3,7 @@ import Stat from '@/components/Stat'; import type { Response } from '@/lib/api/response'; import { bytes } from '@/lib/bytes'; import useLogin from '@/lib/hooks/useLogin'; -import { LoadingOverlay, Paper, ScrollArea, SimpleGrid, Table, Text, Title } from '@mantine/core'; +import { Paper, ScrollArea, SimpleGrid, Skeleton, Table, Text, Title } from '@mantine/core'; import { IconDeviceSdCard, IconEyeFilled, IconFiles, IconLink, IconStarFilled } from '@tabler/icons-react'; import useSWR from 'swr'; @@ -17,9 +17,13 @@ export default function DashboardHome() { Welcome back, <b>{user?.username}</b> - - You have {statsLoading ? '...' : stats?.filesUploaded} files uploaded. - + + + + You have {statsLoading ? '...' : stats?.filesUploaded} files uploaded. + + + {user?.quota && (user.quota.maxBytes || user.quota.maxFiles) ? ( {user.quota.filesQuota === 'BY_BYTES' ? ( @@ -47,9 +51,11 @@ export default function DashboardHome() { {recentLoading ? ( - - - + + {[...Array(3)].map((i) => ( + + ))} + ) : recent?.length !== 0 ? ( {recent!.map((file) => ( @@ -70,9 +76,46 @@ export default function DashboardHome() { {statsLoading ? ( - - - + <> + + {[...Array(8)].map((i) => ( + + ))} + + + + File types + + + + + + + + File Type + Count + + + + {[1, 2, 3, 4, 5].map((i) => ( + + + + ... + + + + + ... + + + + ))} + +
+
+
+ ) : ( <> diff --git a/src/components/pages/files/views/Files.tsx b/src/components/pages/files/views/Files.tsx index 5915794b2..429e7e7c1 100755 --- a/src/components/pages/files/views/Files.tsx +++ b/src/components/pages/files/views/Files.tsx @@ -1,15 +1,5 @@ import DashboardFile from '@/components/file/DashboardFile'; -import { - Button, - Center, - Group, - LoadingOverlay, - Pagination, - Paper, - SimpleGrid, - Stack, - Title, -} from '@mantine/core'; +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'; @@ -51,9 +41,7 @@ export default function Files({ id }: { id?: string }) { pos='relative' > {isLoading ? ( - - - + [...Array(9)].map((_, i) => ) ) : (data?.page?.length ?? 0 > 0) ? ( data?.page.map((file) => ) ) : ( diff --git a/src/components/pages/folders/views/FolderGridView.tsx b/src/components/pages/folders/views/FolderGridView.tsx index d7ae73837..00a42a4c7 100755 --- a/src/components/pages/folders/views/FolderGridView.tsx +++ b/src/components/pages/folders/views/FolderGridView.tsx @@ -1,6 +1,6 @@ import { Response } from '@/lib/api/response'; import { Folder } from '@/lib/db/models/folder'; -import { Center, Group, LoadingOverlay, Paper, SimpleGrid, Stack, Text, Title } from '@mantine/core'; +import { Center, Group, Paper, SimpleGrid, Skeleton, Stack, Text, Title } from '@mantine/core'; import { IconLink } from '@tabler/icons-react'; import useSWR from 'swr'; import FolderCard from '../FolderCard'; @@ -12,9 +12,20 @@ export default function FolderGridView() { return ( <> {isLoading ? ( - - - + + {[...Array(4)].map((_, i) => ( + + ))} + ) : (folders?.length ?? 0 !== 0) ? ( {isLoading ? ( - - - + + {[...Array(4)].map((_, i) => ( + + ))} + ) : (folders?.length ?? 0 !== 0) ? ( import('./parts/StatsCards')); const StatsTables = dynamic(() => import('./parts/StatsTables')); @@ -92,7 +94,11 @@ export default function DashboardMetrics() { {isLoading ? ( - +
+ + + +
) : data?.length ? (
diff --git a/src/components/pages/metrics/parts/StatsCards.tsx b/src/components/pages/metrics/parts/StatsCards.tsx index c76840dcb..f8173417e 100755 --- a/src/components/pages/metrics/parts/StatsCards.tsx +++ b/src/components/pages/metrics/parts/StatsCards.tsx @@ -1,6 +1,6 @@ import { bytes } from '@/lib/bytes'; import { Metric } from '@/lib/db/models/metric'; -import { Group, Paper, SimpleGrid, Text, Title } from '@mantine/core'; +import { Group, Paper, SimpleGrid, Skeleton, Text, Title } from '@mantine/core'; import { IconDatabase, IconEyeFilled, @@ -26,6 +26,23 @@ function StatCard({ title, value, Icon }: { title: string; value: number | strin ); } +export function StatsCardsSkeleton() { + return ( + + {[...Array(6)].map((_, i) => ( + + ))} + + ); +} + export default function StatsCards({ data }: { data: Metric[] }) { if (!data.length) return null; const recent = data[0]; diff --git a/src/components/pages/metrics/parts/StatsTables.tsx b/src/components/pages/metrics/parts/StatsTables.tsx index 4de4451df..6c990d174 100755 --- a/src/components/pages/metrics/parts/StatsTables.tsx +++ b/src/components/pages/metrics/parts/StatsTables.tsx @@ -1,8 +1,117 @@ import { bytes } from '@/lib/bytes'; import { Metric } from '@/lib/db/models/metric'; -import { Paper, ScrollArea, SimpleGrid, Table } from '@mantine/core'; +import { Paper, ScrollArea, SimpleGrid, Skeleton, Table, Text } from '@mantine/core'; import TypesPieChart from './TypesPieChart'; +function SkeletonText() { + return ( + + + ... + + + ); +} + +export function StatsTablesSkeleton() { + return ( + <> + + + + + + + User + Files + Storage Used + Views + + + + {[...Array(5)].map((i) => ( + + + + + + + + + + + + + + + ))} + +
+
+
+ + + + + + + User + URLs + Views + + + + {[...Array(5)].map((i) => ( + + + + + + + + + + + + ))} + +
+
+
+ + + + + + + Type + Files + + + + {[...Array(5)].map((i) => ( + + + + + + + + + ))} + +
+
+
+ + + + +
+ + ); +} + export default function StatsTables({ data }: { data: Metric[] }) { if (!data.length) return null; diff --git a/src/components/pages/metrics/parts/TypesPieChart.tsx b/src/components/pages/metrics/parts/TypesPieChart.tsx index 268cfaa91..a254b2634 100755 --- a/src/components/pages/metrics/parts/TypesPieChart.tsx +++ b/src/components/pages/metrics/parts/TypesPieChart.tsx @@ -14,26 +14,6 @@ export default function TypesPieChart({ metric }: { metric: Metric }) { type: 'outer', content: '{name} - {percentage}', }} - // legend={{ - // position: 'bottom', - // pageNavigator: { - // marker: { - // style: { - // inactiveFill: theme.colorScheme === 'light' ? '#000' : '#fff', - // fill: theme.colorScheme === 'light' ? '#000' : '#fff', - // opacity: 0.8, - // size: 14, - // }, - // }, - // text: { - // style: { - // fill: theme.colorScheme === 'light' ? '#000' : '#fff', - // fontSize: 14, - // }, - // }, - // }, - // maxWidth: isSmall ? 100 : 100, - // }} legend={false} interactions={[{ type: 'pie-legend-active' }, { type: 'element-active' }]} /> diff --git a/src/components/pages/settings/parts/SettingsSessions.tsx b/src/components/pages/settings/parts/SettingsSessions.tsx index 86c7e8d73..0fe844a6e 100644 --- a/src/components/pages/settings/parts/SettingsSessions.tsx +++ b/src/components/pages/settings/parts/SettingsSessions.tsx @@ -1,9 +1,10 @@ import { Response } from '@/lib/api/response'; import { fetchApi } from '@/lib/fetchApi'; -import { Button, Paper, Text, Title } from '@mantine/core'; +import { Button, Paper, SimpleGrid, Skeleton, Text, Title } from '@mantine/core'; import { modals } from '@mantine/modals'; import { showNotification } from '@mantine/notifications'; import { IconLogout } from '@tabler/icons-react'; +import Link from 'next/link'; import useSWR from 'swr'; export default function SettingsSessions() { @@ -39,20 +40,31 @@ export default function SettingsSessions() { Sessions - - You are currently logged into {isLoading ? '...' : (data?.other?.length ?? '...')} other devices - + + + You are currently logged into {isLoading ? '...' : (data?.other?.length ?? '...')} other devices + + - + + + ); } diff --git a/src/components/pages/urls/views/UrlGridView.tsx b/src/components/pages/urls/views/UrlGridView.tsx index 195835f17..4cedd1830 100755 --- a/src/components/pages/urls/views/UrlGridView.tsx +++ b/src/components/pages/urls/views/UrlGridView.tsx @@ -1,6 +1,6 @@ import { Response } from '@/lib/api/response'; import type { Url } from '@/lib/db/models/url'; -import { Center, Group, LoadingOverlay, Paper, SimpleGrid, Stack, Text, Title } from '@mantine/core'; +import { Center, Group, Paper, SimpleGrid, Skeleton, Stack, Text, Title } from '@mantine/core'; import { IconLink } from '@tabler/icons-react'; import { useState } from 'react'; import useSWR from 'swr'; @@ -16,9 +16,20 @@ export default function UrlGridView() { setSelectedUrl(null)} open={!!selectedUrl} /> {isLoading ? ( - - - + + {[...Array(4)].map((_, i) => ( + + ))} + ) : (urls?.length ?? 0 !== 0) ? ( {isLoading ? ( - - - + + {[...Array(4)].map((_, i) => ( + + ))} + ) : (users?.length ?? 0 !== 0) ? ( { handleOverrideColors(cat_mocha as unknown as ZiplineTheme), ); - console.log(parsedThemes); - return parsedThemes; }