'use client'; import { useState } from 'react'; import Link from 'next/link'; import { FileText, ClipboardSignature } from 'lucide-react'; import { usePaginatedQuery } from '@/hooks/use-paginated-query'; import { StatusPill, type StatusPillStatus } from '@/components/ui/status-pill'; import { FilePreviewDialog } from '@/components/files/file-preview-dialog'; interface HubRootDoc { id: string; title: string; documentType: string; status: string; createdAt: string; } interface HubRootFile { id: string; filename: string; mimeType: string | null; createdAt: string; } interface Props { portSlug: string; } const STATUS_PILL_MAP: Record = { draft: 'draft', sent: 'sent', partially_signed: 'partial', completed: 'completed', signed: 'signed', expired: 'expired', cancelled: 'cancelled', rejected: 'rejected', }; export function HubRootView({ portSlug }: Props) { const [previewFile, setPreviewFile] = useState<{ id: string; name: string; mimeType: string | null; } | null>(null); const { data: workflows, isLoading: workflowsLoading } = usePaginatedQuery({ queryKey: ['documents', 'hub-root', 'workflows'], endpoint: '/api/v1/documents?tab=in_progress', filterDefinitions: [], }); const { data: filesData, isLoading: filesLoading } = usePaginatedQuery({ queryKey: ['files', 'hub-root'], endpoint: '/api/v1/files?sort=createdAt&order=desc&limit=20', filterDefinitions: [], }); return (

Signing in progress

{workflowsLoading ? (
Loading...
) : workflows.length === 0 ? (
No workflows in flight.
) : (
    {workflows.map((w) => (
  • {w.title} {w.status.replace(/_/g, ' ')}
  • ))}
)}

Recent files

{filesLoading ? (
Loading...
) : filesData.length === 0 ? (
No files yet.
) : (
    {filesData.map((f) => (
  • {new Date(f.createdAt).toLocaleDateString(undefined)}
  • ))}
)}
{ if (!open) setPreviewFile(null); }} fileId={previewFile?.id} fileName={previewFile?.name} mimeType={previewFile?.mimeType ?? undefined} />
); }