This commit is contained in:
Marcelo
2026-04-24 15:17:28 +00:00
parent 5d3a2c533f
commit 30513ff73d
9 changed files with 337 additions and 155 deletions

View File

@@ -1,16 +1,26 @@
"use client";
import { useI18n } from "@/lib/i18n/useI18n";
import type { RecapRangeMode } from "@/lib/recap/types";
type Props = {
oeeAvg: number | null;
goodParts: number;
totalStops: number;
scrapParts: number;
rangeMode?: RecapRangeMode;
};
export default function RecapKpiRow({ oeeAvg, goodParts, totalStops, scrapParts }: Props) {
export default function RecapKpiRow({ oeeAvg, goodParts, totalStops, scrapParts, rangeMode = "24h" }: Props) {
const { t } = useI18n();
const oeeLabel =
rangeMode === "shift"
? t("recap.kpi.oeeShift")
: rangeMode === "yesterday"
? t("recap.kpi.oeeYesterday")
: rangeMode === "custom"
? t("recap.kpi.oeeCustom")
: t("recap.kpi.oee24h");
const items = [
{ label: t("recap.kpi.good"), value: String(goodParts), valueClass: "text-white" },
@@ -24,7 +34,7 @@ export default function RecapKpiRow({ oeeAvg, goodParts, totalStops, scrapParts
<div className={`text-2xl font-semibold ${oeeAvg == null || Number.isNaN(oeeAvg) ? "text-zinc-400" : "text-emerald-300"}`}>
{oeeAvg == null || Number.isNaN(oeeAvg) ? "—" : `${oeeAvg.toFixed(1)}%`}
</div>
<div className="mt-1 text-xs uppercase tracking-wide text-zinc-400">{t("recap.kpi.oee")}</div>
<div className="mt-1 text-xs uppercase tracking-wide text-zinc-400">{oeeLabel}</div>
{oeeAvg == null || Number.isNaN(oeeAvg) ? (
<div className="mt-1 text-xs text-zinc-500">{t("recap.kpi.noData")}</div>
) : null}