import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; import { Card } from "../../ui"; import { formatDate } from "../../utils/formatters"; /** One resolved plan record for today (see GET /api/admin/dashboard). */ export interface TodayPlan { shift_date: string; category: string; category_label: string; category_color: string | null; project_id: number | null; project_number: string | null; project_name: string | null; note: string; source: "entry" | "override"; rangeFrom: string | null; rangeTo: string | null; } function projectLabel(p: TodayPlan): string { const parts = [p.project_number, p.project_name].filter(Boolean); return parts.length > 0 ? parts.join(" — ") : "Bez projektu"; } function PlanRow({ plan }: { plan: TodayPlan }) { const color = plan.category_color || "var(--mui-palette-primary-main)"; return ( {plan.category_label} {plan.rangeFrom && plan.rangeTo && plan.rangeFrom !== plan.rangeTo && ( součást rozsahu {formatDate(plan.rangeFrom)} –{" "} {formatDate(plan.rangeTo)} )} {projectLabel(plan)} {plan.note && ( {plan.note} )} ); } /** "Vaše dnešní zařazení" — the logged-in user's resolved plan record(s) for * today (up to 3). Empty array = nothing scheduled. */ export default function DashTodayPlan({ plans }: { plans: TodayPlan[] }) { return ( Vaše dnešní zařazení {plans.length > 0 ? ( {plans.map((p, i) => ( ))} ) : ( Pro dnešek nemáte naplánováno. )} ); }