Dashboard UX re-design#2781
Conversation
3a3f7ac to
40fc461
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2781 +/- ##
==========================================
- Coverage 77.11% 76.32% -0.80%
==========================================
Files 326 326
Lines 23437 23441 +4
Branches 2354 2326 -28
==========================================
- Hits 18074 17891 -183
- Misses 5315 5502 +187
Partials 48 48
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
40fc461 to
dfd81d6
Compare
|
@copilot I need a rework of the filtering implementation in
Implementation detailsWhat changes:
|
…sync Co-authored-by: pylipp <10617122+pylipp@users.noreply.github.com>
Done. Here's a summary of what was implemented: New files:
Updated sections (Dashboard.tsx / ItemsAndBoxes / MovedBoxes / Demographics):
URL scheme (as specified): Filter containers (
ESLint (v9), Prettier, TypeScript, all 6 tests, and build all pass. |
…s to AccordionPanel Co-authored-by: pylipp <10617122+pylipp@users.noreply.github.com>
Co-authored-by: pylipp <10617122+pylipp@users.noreply.github.com>
Co-authored-by: pylipp <10617122+pylipp@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR implements the “Dashboard UX re-design” filtering rework for Statviz: replacing the previous global reactive-variable filter state with per-dashboard-section, staged filter panels, and syncing the applied filter state via section-prefixed URL parameters.
Changes:
- Introduces a shared URL (de)serialization layer for stock/movement/demographics filters (
dashboardFilters.ts) and generalizesfilterByTags. - Refactors dashboard sections (Stock, Movement, Beneficiaries) to use local staged filter drawers (Apply commits to URL) and to pass applied filter props down into data/filter containers.
- Adds a new Stock Overview “ring” visualization and updates chart styling (PieChart inner radius/label geometry).
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| shared-front/src/App.tsx | Switches public “shared-front” stock view to URL-derived applied filters and the new stock ring filter container. |
| shared-components/statviz/utils/filterByTags.ts | Generalizes tag filtering utility input type to { id: number }[]. |
| shared-components/statviz/utils/dashboardFilters.ts | New central utilities/types for reading/writing section-prefixed filters to URL params. |
| shared-components/statviz/utils/analytics/constants.ts | Removes an unused/retired graph type constant. |
| shared-components/statviz/dashboard/StockOverview.tsx | Removes legacy StockOverview accordion section component. |
| shared-components/statviz/dashboard/MovedBoxes.tsx | Refactors Movement section to staged filters + URL sync + boxes/items toggle. |
| shared-components/statviz/dashboard/ItemsAndBoxes.tsx | Refactors Stock section to staged filters + URL sync + boxes/items toggle + new ring chart container. |
| shared-components/statviz/dashboard/Demographics.tsx | Refactors Beneficiaries section to staged filters + URL sync. |
| shared-components/statviz/dashboard/Dashboard.tsx | Adds single “filter option” query (products/locations/tags) and wires section components with option props. |
| shared-components/statviz/components/visualizations/stock/StockOverviewRingFilterContainer.tsx | New filter container applying StockAppliedFilters to the stock overview ring visualization. |
| shared-components/statviz/components/visualizations/stock/StockOverviewRingDataContainer.tsx | New data container fetching stock overview data for the ring chart. |
| shared-components/statviz/components/visualizations/stock/StockOverviewRing.tsx | New ring (pie) visualization with grouping selector persisted via URL. |
| shared-components/statviz/components/visualizations/movedBoxes/MovedBoxesFilterContainer.tsx | Drops reactive-var filters; filters moved box facts by applied filter props. |
| shared-components/statviz/components/visualizations/movedBoxes/MovedBoxesDataContainer.tsx | Accepts applied filters + boxes/items and passes them into the filter container. |
| shared-components/statviz/components/visualizations/movedBoxes/MovedBoxes.test.tsx | Updates moved-boxes data-container test to supply required new props. |
| shared-components/statviz/components/visualizations/demographic/DemographicFilterContainer.tsx | Drops reactive-var filters; filters demographic facts by applied filter props (age/gender/tags). |
| shared-components/statviz/components/visualizations/demographic/DemographicDataContainer.tsx | Accepts applied filters and passes them into the filter container. |
| shared-components/statviz/components/visualizations/createdBoxes/TopCreatedProducts.tsx | Removes the “Top Created Products” visualization. |
| shared-components/statviz/components/visualizations/createdBoxes/CreatedBoxesFilterContainer.tsx | Drops reactive-var filters; filters created-box facts by applied filter props and renders only the created-box chart. |
| shared-components/statviz/components/visualizations/createdBoxes/CreatedBoxesDataContainer.tsx | Accepts applied filters + boxes/items and passes them into the filter container. |
| shared-components/statviz/components/visualizations/createdBoxes/CreatedBoxesCharts.tsx | Removes the multi-chart wrapper previously combining created boxes + top products. |
| shared-components/statviz/components/nivo/PieChart.tsx | Adjusts pie chart geometry for center labels and link label lengths. |
| shared-components/statviz/components/filter/StockFilters.tsx | New staged Stock filter panel UI (gender/product/category/location/tags). |
| shared-components/statviz/components/filter/MovementFilters.tsx | New staged Movement filter panel UI (date range + gender/product/category/tags). |
| shared-components/statviz/components/filter/FilterPanel.tsx | New reusable drawer-based filter panel wrapper (icon button + drawer). |
| shared-components/statviz/components/filter/DemographicsFilters.tsx | New staged demographics filter panel UI (age ranges + gender + tags). |
| package.json | Moves react-icons dependency to the workspace root (used by shared-components FilterPanel). |
| front/package.json | Removes react-icons dependency from the front app (now provided at root). |
| pnpm-lock.yaml | Lockfile update reflecting dependency move. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
| const defaults = defaultMovementFilters(); | ||
| return { | ||
| dateFrom: searchParams.get(MOVEMENT_URL_PARAMS.dateFrom) ?? defaults.dateFrom, | ||
| dateTo: searchParams.get(MOVEMENT_URL_PARAMS.dateTo) ?? defaults.dateTo, |
| const handleClear = useCallback(() => { | ||
| setStaged((prev) => ({ | ||
| ...prev, | ||
| products: [], | ||
| genders: [], | ||
| categories: [], | ||
| includedTags: [], | ||
| excludedTags: [], | ||
| })); | ||
| }, []); |
| <Select | ||
| size="md" | ||
| value={boxesOrItems} | ||
| onChange={handleBoxesOrItemsChange} | ||
| width="120px" | ||
| > |
| <Select | ||
| size="md" | ||
| value={boxesOrItems} | ||
| onChange={handleBoxesOrItemsChange} | ||
| width="120px" | ||
| > |
| export function readStockFiltersFromUrl( | ||
| searchParams: URLSearchParams, | ||
| allProducts: IProductOption[], | ||
| allCategories: ICategoryOption[], | ||
| allLocations: ILocationOption[], | ||
| allTags: ITagOption[], |
https://trello.com/c/Hd8yfFuD
Filtering rework (
shared-components/statviz)Replaced the global Apollo Reactive Variable filter state with per-section local filter state, controlled by staged
FilterPanelcomponents (Apply action only commits filters).Filter dimensions per section
Key changes
DASHBOARD_FILTER_DATA_QUERYfetches the base's products, locations, and tags to populate filter options; categories are derived from productss(stock),m(movement),b(beneficiaries). Parameters:d1/d2for dates,pproduct,ggender,ccategory,ttags,aage — e.g.?md1=2026-03-22&md2=2026-06-22&sp=1234&bt=9,10Dashboard.tsx*FilterContainercomponents no longer use reactive variables; all filter state is passed as propsuseReactiveVar(*FilterValuesVar),*FilterValuesVar()writes, anduseMultiSelectFiltercalls from filter containersStockFilterPanel,MovementFilterPanel,DemographicsFilterPanelfilterByTagsutility generalised to accept any{ id: number }[]