fix(pitch-print): cover layout, Finanzplan data source, target_date
Build pitch-deck / build-push-deploy (push) Successful in 1m34s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-consent (push) Successful in 30s
CI / test-python-voice (push) Successful in 30s
CI / test-bqas (push) Successful in 28s

Three critical fixes after reviewing the rendered PDF:

Cover (was: indigo block collapsed to top, white content stacked below):
- The .print-page class in print.css forces flex-direction: column !important,
  which broke the horizontal split. Wrap the cover content in a single grid
  container — the column-flex parent then has only one child so direction is
  irrelevant. Indigo block now runs full-height on the left.
- Title reduced 88pt -> 60pt so "BreakPilot ComplAI." fits without wrapping.
- Funding amount formatter now handles sub-€1M cases (€200k vs €0.2M).

Finanzplan (was: "nicht verfügbar" on both pages 20-21):
- page.tsx was querying the legacy pitch_fm_results table which isn't populated
  by the current pipeline. The interactive deck reads from fp_* tables.
- Wire in lib/finanzplan/adapter.ts (finanzplanToFMResults) which bridges the
  live fp_* tables to FMResult[] — same source the interactive deck uses.
- Fall back to live default fp_scenario if the version snapshot's fm_scenarios
  is empty.
- adapter.ts: populate total_customers + new_customers from fp_kunden_summary
  (was hardcoded 0).

The Ask:
- target_date was rendering as raw ISO timestamp "2026-08-01T00:00:00.000Z";
  now formatted as "Aug 2026" (locale-aware).
- Hero funding amount uses same sub-€1M formatter.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-05-20 10:01:53 +02:00
parent bb85ee2e27
commit f30ac73b79
4 changed files with 133 additions and 88 deletions
@@ -6,6 +6,7 @@ import {
PitchCompetitor, PitchFeature, PitchMilestone, PitchMetric, PitchFunding, PitchProduct,
FpScenarioRef, FMResult, FMAssumption,
} from '@/lib/types'
import { finanzplanToFMResults } from '@/lib/finanzplan/adapter'
import PrintDeck from './_components/PrintDeck'
interface Ctx {
@@ -68,17 +69,29 @@ export default async function PitchPrintPage({ params, searchParams }: Ctx) {
// Always fetch FM results + assumptions so the standard PDF can render the
// annex-finanzplan slide. The `financial` flag only adds the extra detail
// P&L page and the cap-table page.
//
// Data source: the live `fp_*` tables (same as the interactive deck), bridged
// to FMResult[] via finanzplanToFMResults. The legacy `pitch_fm_results` table
// is no longer populated by the current pipeline.
let fmResults: FMResult[] = []
let fmAssumptions: FMAssumption[] = []
const scenarios = (map.fm_scenarios || []) as FpScenarioRef[]
const defaultScenario = scenarios.find(s => s.is_default) ?? scenarios[0] ?? null
if (defaultScenario?.id) {
const resultsRes = await pool.query(
`SELECT * FROM pitch_fm_results WHERE scenario_id = $1 ORDER BY month`,
[defaultScenario.id],
)
fmResults = resultsRes.rows as FMResult[]
// Snapshot stores fp_scenario IDs under `fm_scenarios`; fall back to the live
// default fp scenario if the snapshot is empty (older versions).
let scenarioId: string | null = defaultScenario?.id ? String(defaultScenario.id) : null
if (!scenarioId) {
const liveRes = await pool.query(`SELECT id FROM fp_scenarios WHERE is_default = true LIMIT 1`)
scenarioId = liveRes.rows[0]?.id ? String(liveRes.rows[0].id) : null
}
if (scenarioId) {
try {
const fpResponse = await finanzplanToFMResults(pool, scenarioId)
fmResults = fpResponse.results
} catch {
fmResults = []
}
}
const rawAssumptions = (map.fm_assumptions || []) as Array<Record<string, unknown>>