Skip to content

Report builder + Monitoring Prototype#430

Draft
01painadam wants to merge 14 commits intodevelopfrom
report-builder-final
Draft

Report builder + Monitoring Prototype#430
01painadam wants to merge 14 commits intodevelopfrom
report-builder-final

Conversation

@01painadam
Copy link
Collaborator

⚠️ This is a proof-of-concept
The features are functional but intended for internal evaluation, not production use.

Report Builder (/report-builder)

  • Pin charts from chat directly into a report
  • Drag-and-drop block reordering (titles, text, insights/charts)
  • AI-generated text blocks with inline editing and markdown support
  • Export to PDF with rasterised charts and styled layout
  • Mock mode fallback when the sidecar API is unavailable

Dashboard Monitoring (/monitor)

  • Guided setup wizard: pick datasets, areas (GADM hierarchy), and date ranges
  • Streams analytics from multiple datasets in parallel
  • Review and curate generated charts per dataset
  • Merged per-area charts with area selector
  • Raw data tables with CSV download

Supporting Changes

  • Prototype mode header (amber banner, PROTOTYPE badge) via
    NEXT_PUBLIC_PROTOTYPE_MODE
  • New dependencies: @dnd-kit/react, @react-pdf/renderer, idb-keyval

01painadam and others added 13 commits March 6, 2026 13:46
When NEXT_PUBLIC_PROTOTYPE_MODE=true the PageHeader switches to
an amber colour scheme (#f59e0b) with dark text, a PROTOTYPE badge
replacing PREVIEW, and a centered 'NOT FOR PRODUCTION USE' label.
All buttons, progress bar and logo adapt. Zero impact when the
env var is unset.
Add core infrastructure for report builder feature:
- Report types (Report, ReportBlock, InsightBlock, TextBlock, TitleBlock)
- Zustand report store with localStorage persistence
- Dependencies: @dnd-kit/react, @react-pdf/renderer, idb-keyval
- Update .gitignore for PRD.md and PLAN.md

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…, and UI polish

- Report canvas with block rendering and layout
- Block components: title, text, insight blocks
- Pin-to-report popover
- App routes: report-builder listing, detail, layout
- Block toolbar, sortable blocks with drag-and-drop
- Block management actions (move, delete, duplicate)
Wire up existing components to report builder:
- Add PinToReportPopover to WidgetMessage for pinning charts
- Update MessageBubble to support report block rendering
- Add report-builder link to sidebar navigation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add metadata, generatedByAi fields to report types
- Add insertBlockAfter store action
- Wire generateInsights chat tool to report store
- Add sidecar host and report generation endpoint config
…widget chat

- Add GenerativeTextBlock component with input/generating/error/done phases
- Add ReportPromptBar for report-level AI text generation
- Upgrade ReportTextBlock with markdown rendering (react-markdown), AI badge,
  click-to-edit workflow
- Add generateText utility calling sidecar API with report context
- Add mockGenerateText for local development
- Update ReportCanvas with prompt bar, per-widget chat flow, generation state
- Thread isGenerating, onGenerate, onChat props through SortableBlock,
  ReportBlock, and BlockToolbar
- Add Chat button to BlockToolbar for insight blocks
- Add generateReportPdf orchestrator: rasterise → render → download
- Add rasteriseReportCharts: off-screen Recharts → SVG → PNG per block
- Add svgToImage: clone SVG, inline styles, canvas rasterisation at 2x
- Add inlineSvgStyles: resolve computed CSS into inline attrs for portability
- Add @react-pdf/renderer document components:
  - ReportPdfDocument with title, block layout (full/half pairing), footer
  - PdfTextBlock with paragraph splitting
  - PdfInsightBlock with chart images, table rendering, placeholders
  - pdfStyles with hardcoded theme colours for PDF reconciler
  - registerFonts for IBM Plex Sans/Mono from Google Fonts
- Wire Export PDF button into ReportCanvas with progress phases
- Fall back to mock text generation when sidecar is not configured
- Make mock mode visually obvious with badges and styling
- Always use mock AI summaries, remove DEVELOPER_MODE gating
…lack text

- Remove absolute positioning from 'NOT FOR PRODUCTION USE' so it flows
  between the nav links and right-side controls instead of overlapping
- Use dark prototype colour for nav button text in prototype mode
…eaming

- Add Dashboard types and dashboardStore (IndexedDB-persisted, Zustand)
- Add monitor app routes: list, detail, new-dashboard wizard
- Add SetupWizard: dataset/area/date selection with multi-dataset streaming
- Add DatasetReviewFlow and DatasetInsightReview for chart selection
- Add DashboardCanvas reusing report block components
- Add ChartCard, GreyedChartCard, AnalyticsTable, AddInsightDialog
- Add StreamStatusBanner and SummaryPrompt components
- Add AreaPicker with GADM country hierarchy
- Add useMultiDatasetStream hook with parallel NDJSON streaming
- Add utility modules: autoDetectChart, convertToBlocks, dateRange,
  extractRows, multiAreaCharts, parseNDJSONStream
- Add constants: datasets, areaFixtures, gadmCountries
- Add API routes: analytics, areas/[code]/children, labs-monitoring stream/summary
- Add Monitor nav link to PageHeader and sidebar
- Exclude parent country from selection when sub-regions chosen
- Merge per-area charts into single block with area selector
- Add raw data tables with CSV download
@vercel
Copy link

vercel bot commented Mar 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
project-zeno-next Ready Ready Preview, Comment Mar 7, 2026 9:25am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant