feat: implement BlockView component for financial data rendering#122
feat: implement BlockView component for financial data rendering#122
Conversation
…cial data rendering
…tureId instead of reportId and structureType
… integrate BlockView for item rendering
…nd package-lock.json
|
@claude please review this PR |
|
Claude finished @jfrench9's task in 2m 50s —— View job PR Review: feat: implement BlockView component for financial data renderingTasks:
Overall AssessmentThis is a well-executed structural refactor. The projection-based dispatch pattern cleanly separates data-fetching (panel shells), routing (BlockView), and rendering (projections), and the test coverage is thorough. Below are issues found during review, from highest to lowest priority. Issues🔴 Medium — Potentially non-unique row key in
|
Summary
Introduces the
BlockViewcomponent system — a composable, projection-based architecture for rendering financial data blocks (statements, schedules, and fact tables) within the ledger close workflow. This PR also refactors existing panel components and the report viewer to leverage the newBlockViewabstraction, significantly reducing code duplication and improving maintainability.Changes
New Components
BlockView— Core component that accepts a typed envelope and delegates rendering to the appropriate projection based on the data shape.StatementRendering— Projection for rendering financial statement blocks with line items, sections, and totals.ScheduleRendering— Projection for rendering schedule-type blocks with tabular detail data.FactTable— Projection for rendering simple key/value fact tables.blockview/types.ts— Shared TypeScript types for block envelopes, projections, and rendering contracts.blockview/index.ts— Public barrel export for clean imports.Refactors
SchedulePanel&StatementPanel— Streamlined to remove inline rendering logic; now delegate toBlockViewprojections, reducing ~200 lines of duplicated code.ReportViewerContent(reports/[id]/content.tsx) — Refactored to utilizeReportPackageand integrateBlockViewfor item rendering, reducing the file from ~350+ lines of mixed concerns to a leaner orchestration layer.StructureSidebar— Updated prop interface to acceptstructureIdinstead ofreportId+structureType, simplifying the API and aligning with the domain model.content.tsx(ledger/close) — Updated to passstructureIdto sidebar and child components.Dependencies
@robosystems/clientfrom previous version to 0.3.14 (likely includes types/API surface needed for block envelopes).Key UI/UX Improvements
Breaking Changes
StructureSidebarprops changed:reportIdandstructureTypeprops replaced withstructureId. Any consumers of this component outside this PR will need to update their prop usage.SchedulePanelandStatementPanelinterfaces may have changed as part of the simplification — reviewers should verify any external consumers.Testing
Automated Tests Added
BlockView.test.tsx— Unit tests for envelope dispatching to correct projections, edge cases for unknown types.FactTable.test.tsx— Rendering tests for key/value fact table projection.ScheduleRendering.test.tsx— Rendering tests for schedule block projection with mock envelope data.StatementRendering.test.tsx— Rendering tests for statement block projection with sections, line items, and totals._envelope-fixtures.ts— Shared mock data fixtures used across all BlockView test suites.StructureSidebarandcontentupdated to reflect thestructureIdprop change.Manual Testing Notes for Reviewers
main.structureIdrefactor.Browser Compatibility
🤖 Generated with Claude Code
Branch Info:
feature/block-viewersmainCo-Authored-By: Claude noreply@anthropic.com