diff --git a/client/src/pages/home/components/AlertCards.tsx b/client/src/pages/home/components/AlertCards.tsx index 1663e8b..c75528d 100644 --- a/client/src/pages/home/components/AlertCards.tsx +++ b/client/src/pages/home/components/AlertCards.tsx @@ -1,6 +1,7 @@ -import { ExclamationCircleOutlined, PrinterOutlined, DashboardOutlined } from "@ant-design/icons"; +import { ExclamationCircleOutlined, PrinterOutlined, DashboardOutlined, WarningOutlined } from "@ant-design/icons"; import { useList, useTranslate } from "@refinedev/core"; -import { Badge, Card, Col, Row, theme } from "antd"; +import { Badge, Card, Col, Row, theme, Typography } from "antd"; +import { useState } from "react"; import { Link } from "react-router"; import { ISpool } from "../../spools/model"; import { IPrintJob } from "../../spools/model"; @@ -39,9 +40,14 @@ function AlertCard({ icon, label, count, to, color, loading }: AlertCardProps) { ); } -export function AlertCards() { +interface AlertCardsProps { + reveal?: boolean; +} + +export function AlertCards({ reveal }: AlertCardsProps) { const t = useTranslate(); const { token } = useToken(); + const [hovered, setHovered] = useState(false); // Low stock spools const { result: lowStockResult, query: lowStockQuery } = useList({ @@ -105,6 +111,40 @@ export function AlertCards() { if (visibleAlerts.length === 0) return null; + const totalAlertCount = visibleAlerts.reduce((sum, a) => sum + a.count, 0); + + if (reveal) { + return ( +
setHovered(true)} + onMouseLeave={() => setHovered(false)} + style={{ marginTop: 8 }} + > + + + {totalAlertCount} {totalAlertCount === 1 ? "alert" : "alerts"} + +
+ + {visibleAlerts.map((alert, i) => ( + + ))} + +
+
+ ); + } + return ( {visibleAlerts.map((alert, i) => ( diff --git a/client/src/pages/home/index.tsx b/client/src/pages/home/index.tsx index 6d0cd2a..88d56c6 100644 --- a/client/src/pages/home/index.tsx +++ b/client/src/pages/home/index.tsx @@ -133,8 +133,8 @@ export const Home: React.FC = () => { - +