diff --git a/fe-admin/src/components/EmptyState.tsx b/fe-admin/src/components/EmptyState.tsx new file mode 100644 index 0000000..d80287e --- /dev/null +++ b/fe-admin/src/components/EmptyState.tsx @@ -0,0 +1,29 @@ +import type { ReactNode } from 'react' +import { cn } from '@/lib/cn' + +export function EmptyState({ + icon: Icon, + title, + description, + action, + className, +}: { + icon?: React.ComponentType<{ className?: string }> + title: ReactNode + description?: ReactNode + action?: ReactNode + className?: string +}) { + return ( +
+ {Icon && ( +
+ +
+ )} +
{title}
+ {description &&
{description}
} + {action &&
{action}
} +
+ ) +} diff --git a/fe-user/src/components/EmptyState.tsx b/fe-user/src/components/EmptyState.tsx new file mode 100644 index 0000000..d80287e --- /dev/null +++ b/fe-user/src/components/EmptyState.tsx @@ -0,0 +1,29 @@ +import type { ReactNode } from 'react' +import { cn } from '@/lib/cn' + +export function EmptyState({ + icon: Icon, + title, + description, + action, + className, +}: { + icon?: React.ComponentType<{ className?: string }> + title: ReactNode + description?: ReactNode + action?: ReactNode + className?: string +}) { + return ( +
+ {Icon && ( +
+ +
+ )} +
{title}
+ {description &&
{description}
} + {action &&
{action}
} +
+ ) +} diff --git a/fe-user/src/pages/contracts/MyContractsPage.tsx b/fe-user/src/pages/contracts/MyContractsPage.tsx index 8e5f8f0..f33478d 100644 --- a/fe-user/src/pages/contracts/MyContractsPage.tsx +++ b/fe-user/src/pages/contracts/MyContractsPage.tsx @@ -1,10 +1,12 @@ import { useQuery } from '@tanstack/react-query' import { useNavigate } from 'react-router-dom' -import { FileText } from 'lucide-react' +import { FileText, Plus } from 'lucide-react' import { PageHeader } from '@/components/PageHeader' import { DataTable, type Column } from '@/components/DataTable' import { PhaseBadge } from '@/components/PhaseBadge' import { SlaTimer } from '@/components/SlaTimer' +import { EmptyState } from '@/components/EmptyState' +import { Button } from '@/components/ui/Button' import { api } from '@/lib/api' import type { Paged } from '@/types/master' import type { ContractListItem } from '@/types/contracts' @@ -47,7 +49,19 @@ export function MyContractsPage() { rows={list.data?.items ?? []} getRowKey={c => c.id} isLoading={list.isLoading} - empty="Bạn chưa tạo HĐ nào." + empty={ + navigate('/contracts/new')}> + + Tạo HĐ mới + + } + /> + } onRowClick={c => navigate(`/contracts/${c.id}`)} />