[CLAUDE] FE: EmptyState component + MyContracts CTA empty state
Some checks failed
Deploy SOLUTION_ERP / build-deploy (push) Has been cancelled
Some checks failed
Deploy SOLUTION_ERP / build-deploy (push) Has been cancelled
This commit is contained in:
29
fe-admin/src/components/EmptyState.tsx
Normal file
29
fe-admin/src/components/EmptyState.tsx
Normal file
@ -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 (
|
||||||
|
<div className={cn('flex flex-col items-center justify-center gap-2 py-10 text-center', className)}>
|
||||||
|
{Icon && (
|
||||||
|
<div className="rounded-full bg-slate-100 p-3 text-slate-400">
|
||||||
|
<Icon className="h-6 w-6" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="text-sm font-medium text-slate-700">{title}</div>
|
||||||
|
{description && <div className="max-w-sm text-xs text-slate-400">{description}</div>}
|
||||||
|
{action && <div className="mt-2">{action}</div>}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
29
fe-user/src/components/EmptyState.tsx
Normal file
29
fe-user/src/components/EmptyState.tsx
Normal file
@ -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 (
|
||||||
|
<div className={cn('flex flex-col items-center justify-center gap-2 py-10 text-center', className)}>
|
||||||
|
{Icon && (
|
||||||
|
<div className="rounded-full bg-slate-100 p-3 text-slate-400">
|
||||||
|
<Icon className="h-6 w-6" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="text-sm font-medium text-slate-700">{title}</div>
|
||||||
|
{description && <div className="max-w-sm text-xs text-slate-400">{description}</div>}
|
||||||
|
{action && <div className="mt-2">{action}</div>}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -1,10 +1,12 @@
|
|||||||
import { useQuery } from '@tanstack/react-query'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { FileText } from 'lucide-react'
|
import { FileText, Plus } from 'lucide-react'
|
||||||
import { PageHeader } from '@/components/PageHeader'
|
import { PageHeader } from '@/components/PageHeader'
|
||||||
import { DataTable, type Column } from '@/components/DataTable'
|
import { DataTable, type Column } from '@/components/DataTable'
|
||||||
import { PhaseBadge } from '@/components/PhaseBadge'
|
import { PhaseBadge } from '@/components/PhaseBadge'
|
||||||
import { SlaTimer } from '@/components/SlaTimer'
|
import { SlaTimer } from '@/components/SlaTimer'
|
||||||
|
import { EmptyState } from '@/components/EmptyState'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
import { api } from '@/lib/api'
|
import { api } from '@/lib/api'
|
||||||
import type { Paged } from '@/types/master'
|
import type { Paged } from '@/types/master'
|
||||||
import type { ContractListItem } from '@/types/contracts'
|
import type { ContractListItem } from '@/types/contracts'
|
||||||
@ -47,7 +49,19 @@ export function MyContractsPage() {
|
|||||||
rows={list.data?.items ?? []}
|
rows={list.data?.items ?? []}
|
||||||
getRowKey={c => c.id}
|
getRowKey={c => c.id}
|
||||||
isLoading={list.isLoading}
|
isLoading={list.isLoading}
|
||||||
empty="Bạn chưa tạo HĐ nào."
|
empty={
|
||||||
|
<EmptyState
|
||||||
|
icon={FileText}
|
||||||
|
title="Bạn chưa có HĐ nào"
|
||||||
|
description="Tạo HĐ mới để bắt đầu quy trình soạn thảo và trình ký."
|
||||||
|
action={
|
||||||
|
<Button onClick={() => navigate('/contracts/new')}>
|
||||||
|
<Plus className="mr-1 h-4 w-4" />
|
||||||
|
Tạo HĐ mới
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
onRowClick={c => navigate(`/contracts/${c.id}`)}
|
onRowClick={c => navigate(`/contracts/${c.id}`)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user