"use client";
import { cn } from "@/lib/utils";
import { Inbox, Loader2, AlertCircle } from "lucide-react";
import { Button } from "./Button";
export function PageHeader({
title,
description,
actions,
}: {
title: string;
description?: string;
actions?: React.ReactNode;
}) {
return (
{title}
{description ?
{description}
: null}
{actions ?
{actions}
: null}
);
}
export function EmptyState({
title = "موردی یافت نشد",
description = "هنوز دادهای ثبت نشده است.",
action,
}: {
title?: string;
description?: string;
action?: React.ReactNode;
}) {
return (
);
}
export function LoadingState({ label = "در حال بارگذاری…" }: { label?: string }) {
return (
{label}
);
}
export function ErrorState({
message,
onRetry,
}: {
message: string;
onRetry?: () => void;
}) {
return (
{message}
{onRetry ? (
) : null}
);
}
export function DataTable({
columns,
rows,
empty,
}: {
columns: { key: string; header: string; className?: string; render?: (row: Record) => React.ReactNode }[];
rows: Record[];
empty?: React.ReactNode;
}) {
if (!rows.length) return <>{empty}>;
return (
{columns.map((c) => (
|
{c.header}
|
))}
{rows.map((row, i) => (
{columns.map((c) => (
|
{c.render ? c.render(row) : String(row[c.key] ?? "—")}
|
))}
))}
);
}
export function StatCard({
label,
value,
hint,
}: {
label: string;
value: string | number;
hint?: string;
}) {
return (
{label}
{value}
{hint ?
{hint}
: null}
);
}