diff --git a/web/client/src/components/AlertsPanel.jsx b/web/client/src/components/AlertsPanel.jsx new file mode 100644 index 0000000..7a4c8e5 --- /dev/null +++ b/web/client/src/components/AlertsPanel.jsx @@ -0,0 +1,56 @@ +import React from 'react'; +import { useInventoryStore } from '../store/inventoryStore'; +import { formatItemName } from '../utils/itemUtils'; +import ItemIcon from './ItemIcon'; +import './AlertsPanel.css'; + +function AlertsPanel() { + const alerts = useInventoryStore((state) => state.alerts); + + return ( +
+
+

🔔 Low-Stock Alerts

+ + {alerts.length} alert{alerts.length !== 1 ? 's' : ''} + +
+ + {alerts.length > 0 ? ( +
+ {alerts.map((alert, idx) => ( +
+
+ {alert.triggered ? '🔴' : '🟢'} +
+
+
+ + {formatItemName(alert.item)} +
+
+ + Stock: {alert.current ?? '?'} + + + Min: {alert.threshold || alert.min || '?'} + +
+
+
+ {alert.triggered ? 'LOW' : 'OK'} +
+
+ ))} +
+ ) : ( +
+ ✅ + No alerts configured or all stock levels are OK +
+ )} +
+ ); +} + +export default AlertsPanel;