// — one scheduled prompt as a card: its name as the title, // "agents: foo, bar" beneath, then the message, the cadence and when it // fires next. Edit, pause/resume and remove sit at the foot; edit swaps the // card for `ScheduleForm` (the page owns that swap). import { Badge, type BadgeTone } from "@hive/shared/badge.js"; import { Button } from "../../ui/button/Button.js"; import { Card } from "../../ui/card/Card.js"; import { RelativeTime } from "../../ui/relative-time/RelativeTime.js"; import { fmtInterval, fmtLocal, scheduleState, type Schedule, type ScheduleState, } from "./ScheduleTypes.js"; import "./ScheduleCard.css"; const STATE_TONE: Record = { active: "positive", paused: "warning", past: "neutral", }; export function ScheduleCard({ schedule, pending, onEdit, onTogglePaused, onRemove, }: { schedule: Schedule; /** A pause/resume or remove for this schedule is in flight. */ pending: boolean; onEdit: () => void; onTogglePaused: () => void; onRemove: () => void; }) { const state = scheduleState(schedule); return (

{schedule.name}

agents: {schedule.agents.join(", ")}

{schedule.body}

{schedule.next_fire_unix !== null ? ( <> next fire:{" "} ) : state === "paused" ? ( "paused, will not fire" ) : ( <> time passed{" "} )}
); }