{eyebrow}
+diff --git a/client/src/modules/dashboard/DashboardPage.tsx b/client/src/modules/dashboard/DashboardPage.tsx index 592061b..3cf6ede 100644 --- a/client/src/modules/dashboard/DashboardPage.tsx +++ b/client/src/modules/dashboard/DashboardPage.tsx @@ -1,7 +1,7 @@ import { permissions } from "@mrp/shared"; import type { DemandPlanningRollupDto } from "@mrp/shared/dist/sales/types.js"; import { useEffect, useState } from "react"; -import { Link } from "react-router-dom"; +import type { ReactNode } from "react"; import { useAuth } from "../../auth/AuthProvider"; import { ApiError, api } from "../../lib/api"; @@ -37,14 +37,74 @@ function sumNumber(values: number[]) { return values.reduce((total, value) => total + value, 0); } +function formatPercent(value: number, total: number) { + if (total <= 0) { + return "0%"; + } + + return `${Math.round((value / total) * 100)}%`; +} + +function ProgressBar({ + value, + total, + tone, +}: { + value: number; + total: number; + tone: string; +}) { + const width = total > 0 ? Math.max(6, Math.round((value / total) * 100)) : 0; + + return ( +
{eyebrow}
+{card.label}
-