// THE CHART BAND (module `chart`, region `chart`): the headcount band the // first report cuts drew in place of the footer -- the legacy chrome, before // the deck (`render.chromeEngine`). Not render-cached: it re-renders whole. // compose-chrome.mjs `chartBandHtml` writes the page. import path from "node:path"; import { readFile } from "node:fs/promises"; import { contentWidth } from "../render-cards.mjs"; import { ledgerTotals } from "../ledger-totals.mjs"; import { assertRegion, defineModule } from "./contract.mjs"; export default defineModule({ id: "chart", version: 1, z: 5, kind: "overlay-whole", slot: "footer", title: "Chart band (legacy)", summary: "The headcount band of the first cuts, drawn in place of the footer.", region: "chart", cached: false, async page(ctx) { const { chartBandHtml } = await import("../compose-chrome.mjs"); const sched = ctx.schedule ?? JSON.parse(await readFile(path.join(ctx.base, "schedule.json"), "utf8")); const fonts = await ctx.fonts({ regular: "regular", bold: "bold" }, { strict: false }); const totals = ledgerTotals(ctx.manifest.ledger); return chartBandHtml(ctx.manifest, totals, sched, { fonts, ...(ctx.duration ? { duration: ctx.duration } : {}) }); }, regions(_schedule, { render, outDir }) { const H = render.chart?.height ?? 200; return [assertRegion({ name: "chart", frames: path.join(outDir, "chrome", "chart-frames"), x: 0, y: render.height - H, width: contentWidth(render), height: H, })]; }, });