Skip to content

feat(web): render every chart from API data and refresh the dashboard UI - #490

Merged
MonaaEid merged 16 commits into
mainfrom
feat/web-shadcn-ui
Sep 29, 2026
Merged

MonaaEid merged 16 commits into
mainfrom
feat/web-shadcn-ui

Conversation

@danielmarv

@danielmarv danielmarv commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Description:

Replace every chart PNG on the dashboard with an interactive chart drawn from typed JSON in the data API, and refresh the dashboard shell (header, sidebar, stat tiles, tables) on shadcn/ui.

The data flow is: pipeline CSV → validated chart document (export/chart_data.py) → React view. Drawing options are declared per chart in dashboard_spec/, not coded per chart, so adding a chart means writing a spec entry, not a component. The exporter never aggregates, so the charts show the analysis's own numbers.

  • Add a chart-data contract to API v1, added without breaking it: each chart variant gains an optional interactive reference to data/api/v1/<org>/charts/<chart>.json. The document kinds are timeseries, categories, matrix, network and events.
  • Declare a data source for all 62 chart variants (43 hiero-ledger, 19 hiero-hackers). Pipelines that only wrote PNGs now also write their CSVs:
    • affiliation (single-employer counts)
    • CODEOWNERS and runners
    • HIP evidence by status
    • the hackers overview
    • Discord, which keeps its archive date
  • Render charts with Recharts plus plain SVG/HTML:
    • bars, lines and areas, including cumulative stacked lines
    • heatmaps
    • a status meter and a funnel
    • repository networks with a deterministic, overlap-free layout and a matrix view
    • a release timeline
  • Give every chart:
    • exact values on hover and keyboard focus
    • a Chart / Data toggle
    • a CSV of the selected rows
    • an expanded view
    • light and dark themes
    • a footer stating the counting rule, the window and freshness
  • Add exploration features:
    • a dashboard-wide focus (repo, contributor, organisation or team) that highlights charts and filters tables
    • view state kept in the URL, so shared links reopen the same view
    • comparisons with the previous period
    • a span brush on long time series
  • Stop showing chart images in the dashboard. PNGs are still generated for external reports.
  • Refresh the UI:
    • header: org switcher with GitHub avatars, data-freshness status, page name shown on scroll
    • sidebar: reading-progress rail, "No data" markers for empty tabs, Bricolage Grotesque display font
    • stat tiles with meters
    • compact chart toolbars
    • tables with share bars, repo links and role colours
  • Add a percent column format (Python COLUMN_FORMATS and FormattedCell).
  • Update the output contract on purpose: every produced chart variant must have a loadable chart document, and every declared chart must name a data source.

Related issue(s):

Refs #333. That issue migrates the first chart (the contributor heatmap). This PR migrates all of them, following the per-kind design discussed there.

Overlaps with open PRs, so we should agree a merge order with their authors:

Notes for reviewer:

  • Counting rules:
    • Distinct-people counts are never summed across periods: span controls only pick existing buckets.
    • Flows fill empty buckets with zero, stocks carry their level forward, and snapshots are never gap-filled.
    • Partial buckets are flagged.
  • Deliberate divergences from the PNGs:
    • The Scorecard breakdown is a repository × check matrix on a fixed 0–10 scale, because Scorecard weights its checks rather than adding them.
    • The network relaxes the PNG layout so no bubble or label overlaps.
    • The HIP funnel, CODEOWNERS and push-activity charts use a funnel or meter instead of bars.
  • Compatibility: v1 only gains fields. An older manifest without chart documents shows a "data not available yet" message for each chart, never a broken image.
  • Bundle: Recharts is in a lazily loaded chunk (about 129 kB gzipped). The display font adds a self-hosted woff2 of about 77 kB (Latin subset), so the CSP is unchanged apart from allowing https://github.com images, needed for org avatars.
  • Size: 128 files, about +11.6k / −2.1k lines, excluding lockfiles. The largest new files are in web/src/components/charts/ and src/hiero_analytics/export/chart_data.py.
  • Verified locally:
    • uv run pytest (858 passed) and uv run ruff check src tests.
    • In web/: npm test (127 passed), npm run lint, npm run build.
    • Every tab checked in a browser in light and dark mode and at phone width.
  • Screenshots: to be attached.

feat: implement ToggleGroup and ToggleGroupItem components for grouped toggle functionality

feat: create Toggle component with variant and size support

feat: add useIsMobile hook for mobile detection

refactor: export cn utility from utils

feat: implement navigation model for dashboard navigation

test: add shell component tests for theme menu and sidebar tabs

test: add theme tests for theme storage and application logic

feat: implement theme management with localStorage support

feat: create table of contents functionality for section navigation

feat: add useActiveSection hook for scroll-spy functionality
Signed-off-by: Ntege Daniel <danientege785@gmail.com>
feat: implement ToggleGroup and ToggleGroupItem components for grouped toggle functionality

feat: create Toggle component with variant and size support

feat: add useIsMobile hook for mobile detection

refactor: export cn utility from utils

feat: implement navigation model for dashboard navigation

test: add shell component tests for theme menu and sidebar tabs

test: add theme tests for theme storage and application logic

feat: implement theme management with localStorage support

feat: create table of contents functionality for section navigation

feat: add useActiveSection hook for scroll-spy functionality
Signed-off-by: Ntege Daniel <danientege785@gmail.com>
Signed-off-by: Ntege Daniel <danientege785@gmail.com>
…L state management

- Created  to test various functionalities of the InteractiveChart component, including data handling, user interactions, and error states.
- Created  to test specialized chart types such as heatmaps, networks, and release timelines, ensuring correct rendering and data manipulation.
- Introduced  to manage URL parameters for the application, allowing for state persistence across navigation and user interactions.
- Implemented functions to read and write URL parameters, supporting various data types including strings, lists, integers, and booleans.

Signed-off-by: Ntege Daniel <danientege785@gmail.com>
- Changed favicon to new Hiero brand mark.
- Updated App component to include sidebar width and TOC based on navigation state.
- Enhanced app styles with new brand colors and improved layout for header and sidebar.
- Refactored AppHeader to include new HieroBrand component and improved organization switcher.
- Updated AppSidebar to include Hiero branding and improved footer with GitHub contribution link.
- Added NavigationSearch component for improved navigation experience with keyboard shortcuts.
- Implemented tests for navigation search functionality.
- Added new Hiero brand assets including logos and marks.

Signed-off-by: Ntege Daniel <danientege785@gmail.com>
- Changed favicon to new Hiero brand mark.
- Updated App component to include sidebar width and TOC based on navigation state.
- Enhanced app styles with new brand colors and improved layout for header and sidebar.
- Refactored AppHeader to include new HieroBrand component and improved organization switcher.
- Updated AppSidebar to include Hiero branding and improved footer with GitHub contribution link.
- Added NavigationSearch component for improved navigation experience with keyboard shortcuts.
- Implemented tests for navigation search functionality.
- Added new Hiero brand assets including logos and marks.

Signed-off-by: Ntege Daniel <danientege785@gmail.com>
…r readability

Signed-off-by: Ntege Daniel <danientege785@gmail.com>
…d layout

Signed-off-by: Ntege Daniel <danientege785@gmail.com>
…parate line options

Signed-off-by: Ntege Daniel <danientege785@gmail.com>
- Updated PeriodTabs to improve styling and interaction.
- Enhanced SectionCard to include header actions and improved date display.
- Refactored SectionTable to integrate header actions and controls.
- Improved VariantTabs with segmented appearance and icon support.
- Modified ChartShell to support toolbar integration for better layout.
- Updated EventsView and MatrixView for improved controls and styling.
- Enhanced NetworkView with segmented variant tabs and improved search functionality.
- Refactored SeriesView to streamline toolbar and controls for better user experience.
- Added RepoCell and RoleCell components for better representation of repository and governance roles.
- Introduced ChartLeading and OrgContext for better context management in charts.
- Updated tests to reflect changes in UI and functionality.

Signed-off-by: Ntege Daniel <danientege785@gmail.com>
Signed-off-by: Ntege Daniel <danientege785@gmail.com>
Comment thread tests/contracts/test_output_contract.py Fixed
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

📊 Dashboard preview

The dashboard was built for this PR.

➡️ Download dashboard-preview-490, unzip, then serve it with python3 -m http.server -d . and open the URL it prints. (The app fetches its data over HTTP, so opening index.html directly shows an empty page.)

The artifact is built from this PR — treat it as contributor-authored code and glance at the diff before opening it. It expires after 7 days and is replaced on each new push.

Signed-off-by: Ntege Daniel <danientege785@gmail.com>
- Added  and  components to catch rendering errors in specific sections without affecting the entire application.
- Integrated  for global error handling, allowing users to reload the application when an error occurs.
- Updated  to utilize new utility functions for calculating visible totals, shares, and cumulative values, improving chart data processing.
- Introduced  for managing URL parameters with a delay, preventing excessive state updates during user interactions.
- Enhanced tests for error boundaries, series rows calculations, and URL state management to ensure robustness and reliability.

Signed-off-by: Ntege Daniel <danientege785@gmail.com>
Brings in the printable dashboard tabs (#473) and the ClusterFuzzLite base
image bump (#486). #473 was written against the PNG-gallery dashboard this
branch replaces, so its print feature is carried onto the shadcn/ui and
interactive-chart components rather than merged line by line:

- Print readiness waits on data-print-pending / data-print-error markers on
  loading and failed charts instead of decoding chart images.
- Radix collapsibles (section groups, cards, the tab explainer) are forced
  open while printing and restore the reader's state afterwards.
- Toggle-group selections print as text; controls stay mounted but hidden.
- print.css targets data attributes and shadcn data-slots; buttons that carry
  data (chart legends, row names) are kept with data-print-keep.
- Dialogs ignore Escape and outside clicks while printing and restore their
  scroll; an expanded chart prints in place.
- Dark mode (the Tailwind dark variant) is scoped to screen.

The component and Playwright suites are ported to the new DOM, with real chart
datasets in the e2e fixtures and GitHub avatar requests answered locally.
docs/printing.md records the port.

Signed-off-by: Ntege Daniel <danientege785@gmail.com>

@MonaaEid MonaaEid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@MonaaEid
MonaaEid merged commit 67a5c05 into main Sep 29, 2026
13 checks passed
danielmarv added a commit to 5affron/analytics that referenced this pull request Sep 30, 2026
The dashboard rework (hiero-hackers#490) replaced the chart images, lightbox and TabBar this branch changed; conflicts resolve to main's versions.

Signed-off-by: Ntege Daniel <danientege785@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants