diff --git a/distribution_fe/app/(dashboard)/suppliers/[id]/payments/_components/supplier-payments-client.tsx b/distribution_fe/app/(dashboard)/suppliers/[id]/payments/_components/supplier-payments-client.tsx index 63bf17f..809fc44 100644 --- a/distribution_fe/app/(dashboard)/suppliers/[id]/payments/_components/supplier-payments-client.tsx +++ b/distribution_fe/app/(dashboard)/suppliers/[id]/payments/_components/supplier-payments-client.tsx @@ -31,6 +31,8 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table' import { toast } from '@/components/ui/toast' import { TopLoader } from '@/components/shared/top-loader' +import { EmptyState } from '@/components/shared/empty-state' +import { ReceiptDollarIcon } from '@hugeicons/core-free-icons' function formatDate(value: string) { return new Date(value).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) @@ -84,24 +86,26 @@ export function SupplierPaymentsClient({ supplierId }: { supplierId: string }) {
- - - - Paid At - Method - Amount - Cheque / Account - GRNs - Notes - - - - {loading ? ( - Loading… - ) : payments.length === 0 ? ( - No payments yet. - ) : ( - payments.map(p => ( + {!loading && payments.length === 0 ? ( + + ) : ( +
+ + + Paid At + Method + Amount + Cheque / Account + GRNs + Notes + + + + {payments.map(p => ( {formatDate(p.paidAt)} {p.method} @@ -112,10 +116,10 @@ export function SupplierPaymentsClient({ supplierId }: { supplierId: string }) { {p.allocations.length} {p.notes ?? '—'} - )) - )} - -
+ ))} + + + )}
diff --git a/distribution_fe/components/shared/empty-state.tsx b/distribution_fe/components/shared/empty-state.tsx new file mode 100644 index 0000000..342aa33 --- /dev/null +++ b/distribution_fe/components/shared/empty-state.tsx @@ -0,0 +1,48 @@ +'use client' + +import { HugeiconsIcon } from '@hugeicons/react' +import { cn } from '@/lib/utils' + +type HugeiconDef = React.ComponentProps['icon'] + +interface EmptyStateProps { + icon?: HugeiconDef + title: string + description?: string + action?: React.ReactNode + className?: string +} + +/** + * Centered empty-state for lists and tables. Soft icon in a ringed circle, + * tight title and a muted one-liner underneath. Caller can slot an action button. + */ +export function EmptyState({ icon, title, description, action, className }: EmptyStateProps) { + return ( +
+ {icon && ( +
+
+ +
+ )} +
+

{title}

+ {description && ( +

+ {description} +

+ )} +
+ {action &&
{action}
} +
+ ) +}