{children}
);
}
export function MoreLink({ href, children }: { href: string; children: ReactNode }) {
return (
{children} →
);
}
export function Empty({ children }: { children: ReactNode }) {
return
{children}
;
}
/** Monospace task/project key, optionally a link. */
export function Key({ children, href, className }: { children: ReactNode; href?: string; className?: string }) {
const cls = cn("font-mono text-[0.9em] whitespace-nowrap", href ? "text-primary hover:underline" : "text-muted-foreground", className);
return href ? {children} : {children};
}
export function StatusBadge({ status, kind = "task" }: { status: string; kind?: "task" | "session" }) {
const s = (kind === "task" ? TASK_STATUS : SESSION_STATUS)[status] ?? { label: status, tone: "muted" as const };
return (
{kind === "session" && }
{s.label}
);
}
export function Flash({ error }: { error?: string }) {
return error ? (
// Sticky: an action far down the page (a board card, «Принять») must not fail silently above the fold.
{error}
) : null;
}
export function Notice({ children }: { children: ReactNode }) {
return (
{children}
);
}
/** Collapsible block styled as a card (native : no client JS). */
export function Disclosure({ summary, children, open, className }: { summary: ReactNode; children: ReactNode; open?: boolean; className?: string }) {
return (
›
{summary}
{children}
);
}
export function ago(d: Date | null | undefined): string {
if (!d) return "—";
const s = Math.round((Date.now() - d.getTime()) / 1000);
if (s < 60) return `${s} с назад`;
if (s < 3600) return `${Math.round(s / 60)} мин назад`;
if (s < 86400) return `${Math.round(s / 3600)} ч назад`;
return d.toLocaleDateString("ru-RU");
}