260202_01_ENH: route 구조 초창기 기획으로 다시 변경 및 Category 별 하위 페이지에 샘플 데이터 모두 적용

This commit is contained in:
2026-02-02 11:32:50 +09:00
parent 4b40c43962
commit 6f8e09bcf3
60 changed files with 1750 additions and 464 deletions

View File

@@ -1,7 +1,7 @@
"use client";
import { useMemo } from "react";
import { cn } from "@/lib/utils";
import { cn, parseNumber } from "@/lib/utils";
import {GaugeColumn} from "../types";
type Props<T extends Record<string, unknown>> = {
@@ -24,14 +24,7 @@ type Props<T extends Record<string, unknown>> = {
valueFormatter?: (v: number) => string;
};
const num = (v: unknown) => {
if (typeof v === "number" && Number.isFinite(v)) return v;
if (typeof v === "string") {
const n = Number(v.replaceAll(",", "").replaceAll("%", "").trim());
return Number.isFinite(n) ? n : null;
}
return null;
};
// num은 utils.ts의 parseNumber로 통합됨
const GaugeTable = <T extends Record<string, unknown>>({
columns,
@@ -130,7 +123,7 @@ const GaugeTable = <T extends Record<string, unknown>>({
}
const raw = row[c.key];
const v = num(raw);
const v = parseNumber(raw);
const max = c.max ?? 100;
const ratio = v === null ? 0 : clamp01((v * scale) / max);
const pct = ratio * 100;