import { CircleAlert } from "lucide-react";
import type { ReactNode } from "react";
import { useI18n } from "../i18n";
import { formatDate } from "../lib/format";
import type { AuditLogRow } from "../types";
type Tone = "neutral" | "good" | "danger" | "warn";
export function PageFrame({
title,
eyebrow,
children,
actions
}: {
title: string;
eyebrow?: string;
children: ReactNode;
actions?: ReactNode;
}) {
return (
{eyebrow &&
{eyebrow}
}
{title}
{actions &&
{actions}
}
{children}
);
}
export function QueryPanel({ children }: { children: ReactNode }) {
return {children}
;
}
export function SplitLayout({ main, side }: { main: ReactNode; side: ReactNode }) {
return (
);
}
export function SectionHead({ title, text, action }: { title: string; text?: string; action?: ReactNode }) {
return (
);
}
export function Alert({ children }: { children: ReactNode }) {
return {children}
;
}
export function Badge({ children, tone = "neutral" }: { children: ReactNode; tone?: Tone }) {
return {children};
}
export function StatusItem({ label, value, tone }: { label: string; value: string; tone: "neutral" | "good" | "warn" }) {
return (
{label}
{value}
);
}
export function Metric({ label, value, tone = "neutral", mono = false }: { label: string; value: string; tone?: Tone; mono?: boolean }) {
return (
{label}
{value}
);
}
export function Summary({ label, value, mono = false }: { label: string; value: string; mono?: boolean }) {
return (
{label}
{value}
);
}
export function AuditTable({ rows }: { rows: AuditLogRow[] }) {
const { t } = useI18n();
return (
| {t("audit.id")} | {t("audit.commandID")} | {t("audit.action")} | {t("audit.actor")} | {t("audit.status")} | {t("audit.dryRun")} | {t("audit.reason")} | {t("audit.time")} |
{rows.map((row) => (
| {row.ID} |
{row.CommandID} |
{row.Action} |
{row.Actor} |
{row.Status} |
{row.DryRun ? t("common.yes") : t("common.no")} |
{row.Reason} |
{formatDate(row.CreatedAt)} |
))}
{rows.length === 0 && }
);
}
export function EmptyRow({ colSpan }: { colSpan: number }) {
const { t } = useI18n();
return | {t("common.noResults")} |
;
}
export function LoadingSurface({ label }: { label: string }) {
return ;
}
export function JsonBlock({ value }: { value: string }) {
return {value || "{}"};
}