import type { ReactNode } from "react";
import { AlertCircle, Loader2 } from "lucide-react";
import { Alert, Button, Card, Loading, Space, Tag } from "tdesign-react";
export function Page({ eyebrow, title, subtitle, actions, children, className = "" }: {
eyebrow?: string;
title: string;
subtitle?: string;
actions?: ReactNode;
children: ReactNode;
className?: string;
}) {
return
{eyebrow &&
{eyebrow}
}
{title}
{subtitle &&
{subtitle}
}
{actions &&
{actions}
}
{children}
;
}
export function AsyncState({ loading, error, empty, onRetry, children }: {
loading: boolean;
error?: string;
empty?: ReactNode;
onRetry?: () => void;
children: ReactNode;
}) {
if (loading && empty) return
;
if (error && empty) return ;
return <>
{loading && 正在更新…
}
{error && }
{empty || children}
>;
}
export function ErrorBanner({ message, onRetry }: { message: string; onRetry?: () => void }) {
return } message={
{message}{onRetry && }} />
;
}
export function BusyIcon() { return ; }
export function StatusTag({ status }: { status: "unreimbursed" | "reimbursed" | "active" | "disabled" }) {
const labels = { unreimbursed: "未报销", reimbursed: "已报销", active: "有效", disabled: "已停用" } as const;
const themes = { unreimbursed: "warning", reimbursed: "success", active: "success", disabled: "default" } as const;
return {labels[status]};
}
export function Surface({ children, className = "" }: { children: ReactNode; className?: string }) {
return {children};
}