'use client'; import { useQuery } from '@tanstack/react-query'; import { useTranslations } from 'next-intl'; import { EmptyInline } from '@/components/layout/empty'; import { ErrorInline } from '@/components/layout/error'; import { Skeleton } from '@/components/ui/skeleton'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table'; import { PagesService } from '@/lib/services/openflare'; import { deploymentFilesQueryKey, formatBytes, } from '../../components/pages-utils'; interface DeploymentFilesPanelProps { projectId: number; deploymentId: number; } export function DeploymentFilesPanel({ projectId, deploymentId, }: DeploymentFilesPanelProps) { const t = useTranslations('pages.files'); const filesQuery = useQuery({ queryKey: deploymentFilesQueryKey(projectId, deploymentId), queryFn: () => PagesService.listDeploymentFiles(deploymentId), }); if (filesQuery.isLoading) { return (
); } if (filesQuery.isError) { return (
void filesQuery.refetch()} />
); } const files = filesQuery.data ?? []; if (files.length === 0) { return ; } return ( {t('path')} {t('size')} {files.map((file) => ( {file.path} {formatBytes(file.size)} ))}
); }