Files
vkv/resources/js/components/EvaluationHistoryPanel.tsx
Zdeněk Burda 41e3ce6f25 Initial commit
2026-01-09 21:26:40 +01:00

47 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { type EvaluationRun } from "@/hooks/useRoundEvaluationRun";
type EvaluationHistoryPanelProps = {
runs: EvaluationRun[];
historyOpen: boolean;
onToggle: () => void;
formatEventTime: (value?: string | null) => string | null;
};
export default function EvaluationHistoryPanel({
runs,
historyOpen,
onToggle,
formatEventTime,
}: EvaluationHistoryPanelProps) {
return (
<div className="space-y-2 text-sm text-foreground-700">
<button
type="button"
className="flex w-full items-center justify-between text-left font-semibold"
onClick={onToggle}
>
<span>Historie vyhodnocování</span>
<span>{historyOpen ? "" : "+"}</span>
</button>
{historyOpen && (
<>
{runs.length === 0 && <div className="text-foreground-600">Zatím bez historie.</div>}
{runs.length > 0 && (
<div className="space-y-2">
{runs.map((item) => (
<div key={item.id} className="rounded border border-divider p-2">
<div className="font-semibold">Run #{item.id}</div>
<div>Stav: {item.status ?? "—"}</div>
{item.result_type && <div>Výsledek: {item.result_type}</div>}
<div>Start: {formatEventTime(item.started_at ?? item.created_at) ?? "—"}</div>
<div>Konec: {formatEventTime(item.finished_at) ?? "—"}</div>
</div>
))}
</div>
)}
</>
)}
</div>
);
}