import { tDyn, getLang } from "./i18n"; // Flat-list (table) rendering for /projects. // Extracted from the pre-t-paliad-149 client/projects.ts so the orchestrator // can mount/unmount table view alongside the tree view without code duplication. export interface ProjectFlatRow { id: string; type: string; parent_id?: string | null; path: string; title: string; reference?: string | null; status: string; client_number?: string | null; matter_number?: string | null; updated_at: string; } interface RenderOpts { rows: ProjectFlatRow[]; } // renderFlatList writes the table rows + wires row-click navigation. // Caller is responsible for showing/hiding the wrapping table element. export function renderFlatList(opts: RenderOpts) { const tbody = document.getElementById("projects-body")!; tbody.innerHTML = opts.rows .map((p) => { const typeLabel = tDyn(`projects.type.${p.type}`) || p.type; const statusLabel = tDyn(`projects.filter.status.${p.status}`) || p.status; const clientMatter = p.client_number && p.matter_number ? `${p.client_number}.${p.matter_number}` : p.client_number || p.matter_number || ""; const refCell = p.reference ? esc(p.reference) : "—"; const clientMatterCell = clientMatter ? esc(clientMatter) : "—"; return `