feat(reports): shared ReportEmptyState component
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
39
src/components/reports/shared/report-empty-state.tsx
Normal file
39
src/components/reports/shared/report-empty-state.tsx
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import Link from 'next/link';
|
||||||
|
import type { Route } from 'next';
|
||||||
|
import type { LucideIcon } from 'lucide-react';
|
||||||
|
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
|
||||||
|
interface ReportEmptyStateProps {
|
||||||
|
icon: LucideIcon;
|
||||||
|
title: string;
|
||||||
|
body: string;
|
||||||
|
actionLabel: string;
|
||||||
|
actionHref: Route;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Report-level empty state. Rendered when a report's `hasData` flag is
|
||||||
|
* false (the port has no underlying data at all), in place of the report
|
||||||
|
* body — distinct from the per-chart "no data in this window" states.
|
||||||
|
*/
|
||||||
|
export function ReportEmptyState({
|
||||||
|
icon: Icon,
|
||||||
|
title,
|
||||||
|
body,
|
||||||
|
actionLabel,
|
||||||
|
actionHref,
|
||||||
|
}: ReportEmptyStateProps) {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-center justify-center rounded-lg border border-dashed border-border px-6 py-20 text-center">
|
||||||
|
<div className="mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted">
|
||||||
|
<Icon className="h-6 w-6 text-muted-foreground" aria-hidden />
|
||||||
|
</div>
|
||||||
|
<h2 className="text-lg font-semibold text-foreground">{title}</h2>
|
||||||
|
<p className="mt-1.5 max-w-sm text-sm text-muted-foreground">{body}</p>
|
||||||
|
<Button asChild className="mt-5">
|
||||||
|
<Link href={actionHref}>{actionLabel}</Link>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user