changes
This commit is contained in:
@@ -19,16 +19,18 @@ export default function RecapBanners({ moldChangeStartMs, offlineForMin, ongoing
|
||||
const moldStartLabel = moldChangeStartMs
|
||||
? new Date(moldChangeStartMs).toLocaleTimeString(locale, { hour: "2-digit", minute: "2-digit" })
|
||||
: "--:--";
|
||||
const showOffline = offlineForMin != null && offlineForMin > 10;
|
||||
const hideMoldBecauseOffline = showOffline && moldChangeStartMs != null;
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{moldChangeStartMs ? (
|
||||
{moldChangeStartMs && !hideMoldBecauseOffline ? (
|
||||
<div className="rounded-xl border border-amber-400/40 bg-amber-400/10 px-3 py-2 text-sm text-amber-200">
|
||||
{t("recap.banner.moldChange", { time: moldStartLabel })}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{offlineForMin != null && offlineForMin > 10 ? (
|
||||
{showOffline ? (
|
||||
<div className="rounded-xl border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-200">
|
||||
{t("recap.banner.offline", { min: toInt(offlineForMin) })}
|
||||
</div>
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user