Skip to content

Conversation

@linh2020
Copy link

@linh2020 linh2020 commented Jan 20, 2026

Description

This PR improves the usability and clarity of the Materials table in the BM Dashboard by adding visual indicators and usage insights.

Previously, the table displayed only raw numeric values (Bought, Used, Available, Wasted, Hold), requiring admins to manually interpret stock health and material consumption. This made it easy to miss low-stock or high-usage items, especially when managing large datasets.

This update enhances the table with intuitive visual cues and summary insights, allowing admins to quickly identify materials that may require attention.

Implements:
(WBS: Add Material Usage Insights & Visual Indicators)

Related PRs (if any)

N/A – frontend-only changes.

Main changes explained

Stock Health Indicator

Added a new Stock Health column to the Materials table.
Displays color-coded icons to represent inventory status:

  • Green: Healthy
  • Yellow: Low stock
  • Red: Critical stock
  • Gray: No purchases recorded

Status is calculated using Available / Bought with default thresholds:

  • Critical ≤ 20%
  • Low ≤ 40%
  • Healthy > 40%

Added hover tooltips explaining:

  • Available vs. Bought values
  • Stock ratio percentage
  • Health status

Usage Percentage Bar

Added a Usage % column showing material consumption as Used / Bought.
Displays a progress bar with contextual text (e.g., 7.1 / 40 (18%)).
Safely handles edge cases:

  • Displays N/A when Bought = 0
  • Prevents overflow by clamping values
    Tooltips provide clear explanations of usage calculations.

Summary Panel
Added a summary panel above the Materials table displaying:

  • Total materials
  • % at low stock (Low + Critical)
  • % over usage threshold (≥ 80% used)
  • Items on Hold

Metrics are calculated based on the currently displayed dataset (frontend-only).

How to test

  1. Check out this branch: linh_materials_usage_insights_visual_indicators
  2. Run npm install (or yarn install) and start the frontend locally.
  3. Clear browser cache / site data if needed.
  4. Log in as an admin user.
  5. Navigate to the Materials page: /bmdashboard/materials
  6. Verify:
  • Stock Health icons display correctly based on inventory levels.
  • Usage % bars reflect correct consumption values.
  • Tooltips explain calculations clearly.
  • Summary panel metrics update correctly.
  • UI renders properly in both light and dark mode.
  • Layout remains responsive on different screen sizes.
  • Screenshots or videos of changes

(Attach screenshots for light mode and dark mode here)

Note

This PR focuses on frontend-only enhancements using existing material data.
Custom low-stock thresholds per project or global configuration are intentionally left as a future enhancement and will require backend support.

- Implement usage percentage calculation (Used / Bought)
- Implement stock ratio calculation (Available / Bought)
- Add stock health status determination (Critical/Low/Healthy/No-Data)
- Add formatting utilities for floating point precision handling
- Create tooltip generation functions for visual indicators
- Include summary metrics calculation from material lists
- All calculations include safe guards for zero/null values
- MaterialSummaryPanel: displays 4 key metrics (total, low stock %, usage %, on hold)
- ItemsTable: adds Stock Health Indicator and Usage % Bar columns
- ItemListView: integrates summary panel above table
- Components support dark mode, responsive design, and accessibility
@netlify
Copy link

netlify bot commented Jan 20, 2026

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 985c852
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/697062360c88c30008c55c4f
😎 Deploy Preview https://deploy-preview-4736--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@linh2020 linh2020 changed the title Linh materials usage insights visual indicators Linh – Add Material Usage Insights & Visual Indicators to Materials Table Jan 20, 2026
@linh2020 linh2020 changed the title Linh – Add Material Usage Insights & Visual Indicators to Materials Table Linh – Add Material Usage Insights & Visual Indicators to Materials Table [WIP] Jan 20, 2026
@sonarqubecloud
Copy link

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