Add interactive dashboard with Build Canada charts library#15
Open
xrendan wants to merge 3 commits into
Open
Conversation
Wires the @buildcanada/charts library (plus its @buildcanada/colours and @buildcanada/components peers) into TradingPost as file: dependencies pointing at the sibling bcds checkout. The dashboard renders an interactive Grapher with the LifeExpectancyGrapher sample dataset and exposes controls to switch chart type (Line / Discrete Bar / Stacked Area / Slope) and entity preset. Notes on the integration: - The Grapher component uses MobX, mounts via observers that touch window/document, and is not RSC-safe. The page boundary loads it via next/dynamic with ssr: false from a client wrapper so Next does not try to prerender it (mobx decorators initialize on import, so even SSR of an otherwise-client component fails). - @buildcanada/charts ships a single SCSS entry point as its './styles.css' export. Adding 'sass' as a dependency lets Next compile that .scss directly when imported from the dashboard route. - mobx (^6.15) and mobx-react (^7.6) are required as peer deps by the charts package. mobx-react 7.6 still declares React 16/17/18 as its peer but works against React 19 for the @observer usage in Grapher. Together with the matching fix in bcds (TC-39 stage 3 decorator emit + automatic JSX runtime in the charts build), /dashboard now mounts the Grapher cleanly and survives chart-type / entity-preset switching.
Now that bcds#7 is merged and @buildcanada/charts@0.3.9 is published (with the TC-39 stage 3 decorator emit + automatic JSX runtime fix), TradingPost no longer needs the local file:../bcds/packages/* links. Switching to ^0.3.9 / ^0.3.5 / ^0.3.3 so the integration works on a fresh checkout (CI, other developers) without a sibling bcds tree. Verified end-to-end: pnpm install resolves the registry packages, `next dev` boots, /dashboard mounts the Grapher (12 SVGs, 17 interactive buttons), chart-type and entity-preset switching both work, no pageerrors.
These are peer dependencies that pnpm auto-installs on our behalf: - sass is a peer of next 16 (Next ships built-in Sass support) - mobx and mobx-react are peers of @buildcanada/charts Since this repo is pnpm-only (packageManager: pnpm@9.5.0) and pnpm 8+ defaults auto-install-peers to true, declaring them ourselves is redundant — pnpm pulls them in either way. Removing keeps package.json focused on direct dependencies and avoids version-pin drift between us and the charts peer-dep declaration. Verified: pnpm install resolves mobx@6.15.3 and mobx-react@7.6.0 via peer auto-install; /dashboard mounts the Grapher cleanly (12 SVGs, 17 interactive buttons, no pageerrors).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new interactive dashboard page that showcases the
@buildcanada/chartslibrary's Grapher component with life expectancy data visualization capabilities.Key Changes
src/app/dashboard/page.tsx): Server component that sets up metadata and imports the Build Canada charts stylesheetsrc/app/dashboard/Dashboard.tsx): Interactive client component featuring:src/app/dashboard/DashboardClient.tsx): Client-side dynamic import with SSR disabled and loading skeleton for better UX@buildcanada/charts,@buildcanada/colours,@buildcanada/components,mobx,mobx-react, andsassto support the charting libraryImplementation Details
useState,useMemo,useEffect) to manage chart type, entity selection, and responsive sizinghttps://claude.ai/code/session_01H5n1EL6QDosMXGTS8UndR9