/** Task history sub-view: filter chips + search + the timeline of entries. * * Extracted from the panel (renderers/ pattern). State the panel owns — * the active filter, the search text, the currency symbol — plus the * callbacks that mutate it or open the edit dialog are passed in via * HistoryContext, keeping these functions pure of component internals. */ import { html, nothing } from "lit"; import { t, formatDateTime, STATUS_ICONS } from "../styles"; import type { MaintenanceTask, HistoryEntry, HomeAssistant } from "../types"; import "../components/history-photo"; export interface HistoryContext { lang: string; /** Home Assistant object — used to sign completion-photo URLs. */ hass: HomeAssistant; /** Active type filter, or null for "all". */ filter: string | null; /** Free-text search over entry notes. */ search: string; /** Currency symbol for cost display (defaults to €). */ currencySymbol: string; setFilter: (filter: string | null) => void; setSearch: (search: string) => void; openEdit: (entry: HistoryEntry) => void; /** v2.20 (#83): unit + delta-vs-previous for reading-task entries. */ readingUnit?: string | null; readingDelta?: (entry: HistoryEntry) => number | null; } const _FILTER_TYPES = ["completed", "skipped", "missed", "reset", "triggered"] as const; export function renderHistoryFilters(task: MaintenanceTask, ctx: HistoryContext) { const L = ctx.lang; return html`
${t("no_history", L)}
`; } return html`