From 63fff1ff253c56e7ad91150b235b923d985e5789 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Mon, 31 Aug 2026 11:58:42 +0900 Subject: [PATCH 1/4] =?UTF-8?q?260831=5F01=5FENH:=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=ED=85=8C=EC=9D=B4=EB=B8=94=20overflow-x=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 11 +++++++++++ src/components/data-table/DataTable.tsx | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 85a4d9a..dedad31 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -251,6 +251,17 @@ When implementation is complete, report in Korean: - Validate external data at runtime; a shared TypeScript type alone does not validate an API response or persisted value. - Prefer named public exports and retain the consumer project's current module system and bundler conventions. +### React Compiler and Manual Memoization + +- `createKriNextConfig` enables `reactCompiler: true` unless the project overrides it; confirm the effective configuration. +- When enabled, rely on React Compiler instead of adding `useMemo`, `useCallback`, or `React.memo` as a routine performance precaution. +- Use manual memoization only for required reference stability, an Effect or third-party contract, compiler-incompatible code, or a measured performance problem. +- Preserve existing memoization unless approved and verified for removal. Use `"use memo"` or `"use no memo"` only for a documented compiler boundary. + +### Project Instruction Budget + +- Keep `.agent/project.md` at or below 8 KiB (8,192 bytes) as the normal target. Do not delete material rules merely to meet the budget; move schemas, endpoint inventories, examples, and temporary issue history to linked project documentation, and keep concise read-routing instructions here. + ### Change Safety - Pin or constrain the package version according to the consumer repository's dependency policy and commit its lockfile changes. diff --git a/src/components/data-table/DataTable.tsx b/src/components/data-table/DataTable.tsx index 8da381c..5f78529 100644 --- a/src/components/data-table/DataTable.tsx +++ b/src/components/data-table/DataTable.tsx @@ -200,7 +200,7 @@ export function DataTable({
-- 2.49.0.windows.1 From c12fd7133ebb05b94852d038985ec5875f996a24 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Wed, 2 Sep 2026 09:09:19 +0900 Subject: [PATCH 2/4] =?UTF-8?q?260902=5F01=5FENH:=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=EC=97=90=EC=84=9C=20=ED=95=99=EB=8B=B9=EB=AA=85?= =?UTF-8?q?=EC=9E=98=EB=A6=AC=EC=A7=80=20=EC=95=8A=EA=B2=8C=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20(=EC=98=81=EB=AC=B8=EB=AA=85=20=EC=A4=84=EB=B0=94?= =?UTF-8?q?=EA=BF=88,=20=EA=B0=80=EC=9E=A5=20=EA=B8=B4=20=ED=95=99?= =?UTF-8?q?=EB=8B=B9=20=EB=AA=85=20=EA=B8=B0=EC=A4=80=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(pages)/(main)/progress/page.tsx | 14 ++++-- src/app/(pages)/(main)/report/page.tsx | 14 ++++-- src/components/report/ReportTable.tsx | 7 +-- src/components/report/formatCenterName.ts | 3 ++ .../report/useAutoFitCenterNameWidth.ts | 49 +++++++++++++++++++ 5 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 src/components/report/formatCenterName.ts create mode 100644 src/components/report/useAutoFitCenterNameWidth.ts diff --git a/src/app/(pages)/(main)/progress/page.tsx b/src/app/(pages)/(main)/progress/page.tsx index 841b930..a4f306c 100644 --- a/src/app/(pages)/(main)/progress/page.tsx +++ b/src/app/(pages)/(main)/progress/page.tsx @@ -6,6 +6,8 @@ import { MultiSelect } from "@/components/common/multi-select"; import { ExcelDownloadButton } from "@/components/report/ExcelDownloadButton"; import { exportReportToExcel } from "@/components/report/exportReportToExcel"; import { ReportTable, type ReportLeadingColumn } from "@/components/report/ReportTable"; +import { formatCenterName } from "@/components/report/formatCenterName"; +import { useAutoFitCenterNameWidth } from "@/components/report/useAutoFitCenterNameWidth"; import { useAuth } from "@/hooks/useAuth"; import { useCentersQuery } from "@/query/center"; import { useProgressReportQuery } from "@/query/report"; @@ -13,7 +15,7 @@ import { isAdminRole } from "@/types/auth"; const LEADING_COLUMNS: ReportLeadingColumn[] = [ { key: "centerCd", label: "id", width: 64, sticky: true, render: (row) => row.centerCd }, - { key: "centerName", label: "학당명", width: 200, sticky: true, render: (row) => row.centerName }, + { key: "centerName", label: "학당명", width: 200, sticky: true, render: (row) => formatCenterName(row.centerName) }, { key: "targetCount", label: "목표 표본", width: 100, render: (row) => row.targetCount }, { key: "completeCount", label: "완료 수", width: 100, render: (row) => row.completeCount ?? "-" }, ]; @@ -39,6 +41,12 @@ export default function ProgressPage() { return rows.filter((row) => row.centerCd === 0 || selected.has(row.centerCd)); }, [reportQuery.data, admin, selectedCenterCds]); + const centerNameWidth = useAutoFitCenterNameWidth(content); + const leadingColumns = useMemo( + () => LEADING_COLUMNS.map((column) => column.key === "centerName" ? { ...column, width: centerNameWidth } : column), + [centerNameWidth], + ); + const handleDownload = () => { if (!reportQuery.data) return; exportReportToExcel({ @@ -47,7 +55,7 @@ export default function ProgressPage() { headers: reportQuery.data.headers, content, scale: "current", - leadingColumns: LEADING_COLUMNS, + leadingColumns, }); }; @@ -71,7 +79,7 @@ export default function ProgressPage() { headers={reportQuery.data?.headers ?? []} content={content} scale="current" - leadingColumns={LEADING_COLUMNS} + leadingColumns={leadingColumns} mergeLeadingColumnsWhen={(row) => row.centerCd === 0} /> )} diff --git a/src/app/(pages)/(main)/report/page.tsx b/src/app/(pages)/(main)/report/page.tsx index 650bc52..2adaa8d 100644 --- a/src/app/(pages)/(main)/report/page.tsx +++ b/src/app/(pages)/(main)/report/page.tsx @@ -6,13 +6,15 @@ import { MultiSelect } from "@/components/common/multi-select"; import { ExcelDownloadButton } from "@/components/report/ExcelDownloadButton"; import { exportReportToExcel } from "@/components/report/exportReportToExcel"; import { ReportTable, type ReportLeadingColumn } from "@/components/report/ReportTable"; +import { formatCenterName } from "@/components/report/formatCenterName"; +import { useAutoFitCenterNameWidth } from "@/components/report/useAutoFitCenterNameWidth"; import { useAuth } from "@/hooks/useAuth"; import { useCentersQuery } from "@/query/center"; import { useFinalReportQuery } from "@/query/report"; import { isAdminRole } from "@/types/auth"; const LEADING_COLUMNS: ReportLeadingColumn[] = [ - { key: "centerName", label: "학당명", width: 200, sticky: true, render: (row) => row.centerName }, + { key: "centerName", label: "학당명", width: 200, sticky: true, render: (row) => formatCenterName(row.centerName) }, { key: "completeCount", label: "완료 수", width: 100, render: (row) => row.completeCount ?? 0 }, ]; @@ -37,6 +39,12 @@ export default function ReportPage() { return rows.filter((row) => row.centerCd === 0 || selected.has(row.centerCd)); }, [reportQuery.data, admin, selectedCenterCds]); + const centerNameWidth = useAutoFitCenterNameWidth(content); + const leadingColumns = useMemo( + () => LEADING_COLUMNS.map((column) => column.key === "centerName" ? { ...column, width: centerNameWidth } : column), + [centerNameWidth], + ); + const handleDownload = () => { if (!reportQuery.data) return; exportReportToExcel({ @@ -45,7 +53,7 @@ export default function ReportPage() { headers: reportQuery.data.headers, content, scale: "final", - leadingColumns: LEADING_COLUMNS, + leadingColumns, }); }; @@ -65,7 +73,7 @@ export default function ReportPage() { {reportQuery.isLoading ? (

불러오는 중...

) : ( - + )} ); diff --git a/src/components/report/ReportTable.tsx b/src/components/report/ReportTable.tsx index 8d5247e..45293b5 100644 --- a/src/components/report/ReportTable.tsx +++ b/src/components/report/ReportTable.tsx @@ -28,6 +28,7 @@ export interface ReportTableProps { } const BODY_CELL_TEXT_CLASS = "truncate"; +const CENTER_NAME_CELL_CLASS = "whitespace-pre-line break-keep"; // value7은 소수점 2자리(예: "7.00"), value100은 소수점 1자리(예: "100.0")로 반올림 표기한다. // null은 항상 "-"로 표시하고, 0은 zeroAsDash 옵션에 따라 "-" 또는 반올림된 값("0.00"/"0.0")으로 표시한다. @@ -166,18 +167,18 @@ export function ReportTable({ return ( {merged ? ( - + {leadingColumns[stickyCount - 1].render(row)} ) : ( leadingColumns.slice(0, stickyCount).map((column, columnIndex) => ( - + {column.render(row)} )) )} {leadingColumns.slice(stickyCount).map((column) => ( - + {column.render(row)} ))} diff --git a/src/components/report/formatCenterName.ts b/src/components/report/formatCenterName.ts new file mode 100644 index 0000000..e0ddcb4 --- /dev/null +++ b/src/components/report/formatCenterName.ts @@ -0,0 +1,3 @@ +export function formatCenterName(centerName: string): string { + return centerName.replace(/^(.+?[가-힣][가-힣0-9]*)\s+(?=[A-Za-z])/, "$1\n"); +} diff --git a/src/components/report/useAutoFitCenterNameWidth.ts b/src/components/report/useAutoFitCenterNameWidth.ts new file mode 100644 index 0000000..2c5913a --- /dev/null +++ b/src/components/report/useAutoFitCenterNameWidth.ts @@ -0,0 +1,49 @@ +import { useLayoutEffect, useState } from "react"; +import type { ReportContent } from "@/types/report"; +import { formatCenterName } from "./formatCenterName"; + +const DEFAULT_WIDTH = 200; +const MIN_WIDTH = 200; +const MAX_WIDTH = 400; +const CELL_HORIZONTAL_PADDING = 10; + +const measureCenterNameWidth = (names: string[]): number => { + if (typeof document === "undefined") return DEFAULT_WIDTH; + + const canvas = document.createElement("canvas"); + const context = canvas.getContext("2d"); + if (!context) return DEFAULT_WIDTH; + + const style = window.getComputedStyle(document.body); + context.font = [style.fontStyle, style.fontVariant, style.fontWeight, style.fontSize, style.fontFamily] + .filter(Boolean) + .join(" "); + + const maxTextWidth = Math.max( + context.measureText("학당명").width, + ...names.flatMap((name) => formatCenterName(name).split("\n")).map((line) => context.measureText(line).width), + ); + + return Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, Math.ceil(maxTextWidth + CELL_HORIZONTAL_PADDING))); +}; + +export function useAutoFitCenterNameWidth(content: ReportContent[]): number { + const [width, setWidth] = useState(DEFAULT_WIDTH); + + useLayoutEffect(() => { + let cancelled = false; + const measure = () => { + if (cancelled) return; + setWidth(measureCenterNameWidth(content.map((row) => row.centerName))); + }; + + measure(); + document.fonts?.ready.then(measure); + + return () => { + cancelled = true; + }; + }, [content]); + + return width; +} -- 2.49.0.windows.1 From cfc88018aa4894dd1697eca00599ad23edf7f83f Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Thu, 17 Sep 2026 14:02:06 +0900 Subject: [PATCH 3/4] =?UTF-8?q?260917=5F01=5FENH:=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=EC=97=90=EC=84=9C=20=ED=95=99=EB=8B=B9=EB=AA=85=20?= =?UTF-8?q?=ED=95=B8=EB=93=A4=EB=9F=AC=20=EB=B6=80=EC=97=AC=ED=95=98?= =?UTF-8?q?=EA=B3=A0=20=EC=82=AC=EC=9A=A9=EC=9E=90=EA=B0=80=20=EA=B0=80?= =?UTF-8?q?=EB=B3=80=EC=B2=98=EB=A6=AC=20=ED=95=A0=EC=88=98=20=EC=9E=88?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(pages)/(main)/progress/page.tsx | 10 ++- src/app/(pages)/(main)/report/page.tsx | 17 +++- src/components/report/ReportTable.tsx | 104 ++++++++++++++++++++--- 3 files changed, 115 insertions(+), 16 deletions(-) diff --git a/src/app/(pages)/(main)/progress/page.tsx b/src/app/(pages)/(main)/progress/page.tsx index a4f306c..6236631 100644 --- a/src/app/(pages)/(main)/progress/page.tsx +++ b/src/app/(pages)/(main)/progress/page.tsx @@ -42,9 +42,12 @@ export default function ProgressPage() { }, [reportQuery.data, admin, selectedCenterCds]); const centerNameWidth = useAutoFitCenterNameWidth(content); + // 사용자가 핸들로 폭을 조절하면 그 값을 우선 사용하고, 그 이후엔 자동 맞춤을 멈춘다(새로고침 시 초기화). + const [manualCenterNameWidth, setManualCenterNameWidth] = useState(null); + const effectiveCenterNameWidth = manualCenterNameWidth ?? centerNameWidth; const leadingColumns = useMemo( - () => LEADING_COLUMNS.map((column) => column.key === "centerName" ? { ...column, width: centerNameWidth } : column), - [centerNameWidth], + () => LEADING_COLUMNS.map((column) => column.key === "centerName" ? { ...column, width: effectiveCenterNameWidth, resizable: true } : column), + [effectiveCenterNameWidth], ); const handleDownload = () => { @@ -81,6 +84,9 @@ export default function ProgressPage() { scale="current" leadingColumns={leadingColumns} mergeLeadingColumnsWhen={(row) => row.centerCd === 0} + onColumnResize={(key, width) => { + if (key === "centerName") setManualCenterNameWidth(width); + }} /> )} diff --git a/src/app/(pages)/(main)/report/page.tsx b/src/app/(pages)/(main)/report/page.tsx index 2adaa8d..2032003 100644 --- a/src/app/(pages)/(main)/report/page.tsx +++ b/src/app/(pages)/(main)/report/page.tsx @@ -40,9 +40,12 @@ export default function ReportPage() { }, [reportQuery.data, admin, selectedCenterCds]); const centerNameWidth = useAutoFitCenterNameWidth(content); + const [manualCenterNameWidth, setManualCenterNameWidth] = useState(null); + const effectiveCenterNameWidth = manualCenterNameWidth ?? centerNameWidth; + const leadingColumns = useMemo( - () => LEADING_COLUMNS.map((column) => column.key === "centerName" ? { ...column, width: centerNameWidth } : column), - [centerNameWidth], + () => LEADING_COLUMNS.map((column) => column.key === "centerName" ? { ...column, width: effectiveCenterNameWidth, resizable: true } : column), + [effectiveCenterNameWidth], ); const handleDownload = () => { @@ -73,7 +76,15 @@ export default function ReportPage() { {reportQuery.isLoading ? (

불러오는 중...

) : ( - + { + if (key === "centerName") setManualCenterNameWidth(width); + }} + /> )} ); diff --git a/src/components/report/ReportTable.tsx b/src/components/report/ReportTable.tsx index 45293b5..f0d436b 100644 --- a/src/components/report/ReportTable.tsx +++ b/src/components/report/ReportTable.tsx @@ -1,6 +1,6 @@ "use client"; -import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from "react"; +import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent as ReactMouseEvent, type ReactNode } from "react"; import { TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { cn } from "@/lib/utils"; import type { ReportContent, ReportHeader } from "@/types/report"; @@ -11,6 +11,8 @@ export interface ReportLeadingColumn { label: string; width: number; sticky?: boolean; + // true면 헤더 우측 경계에 드래그 핸들을 표시해 사용자가 폭을 조절할 수 있다(onColumnResize와 함께 사용). + resizable?: boolean; render: (row: ReportContent) => ReactNode; } @@ -25,8 +27,13 @@ export interface ReportTableProps { leafColumnWidth?: number; // 0을 "-"로 표시할지(기본값), "0.00"/"0.0"처럼 반올림된 값 그대로 표시할지 선택한다. zeroAsDash?: boolean; + // resizable 컬럼의 드래그 핸들로 폭이 바뀔 때 호출된다. 실제 폭 상태는 상위에서 관리한다. + onColumnResize?: (key: string, width: number) => void; } +// 드래그로 줄일 수 있는 최소 폭(px). sticky 컬럼이 뭉개지지 않도록 하한을 둔다. +const MIN_RESIZE_WIDTH = 80; + const BODY_CELL_TEXT_CLASS = "truncate"; const CENTER_NAME_CELL_CLASS = "whitespace-pre-line break-keep"; @@ -44,6 +51,10 @@ const formatReportValue = (raw: string | null, field: "value7" | "value100", zer // 공백이 없으면 단어 중간(한글 글자 사이)도 끊어버려서, 한국어에 맞는 break-keep(word-break: keep-all)을 쓴다. const HEADER_CELL_TEXT_CLASS = "whitespace-normal break-keep"; +// 마지막 sticky(고정) 컬럼 우측에 주는 강조 경계선. 가로 스크롤 시 고정 영역이 어디까지인지 +// 시각적으로 분명히 보여준다. 옅은 기본 border 대신 2px muted-foreground를 사용한다. +const STICKY_EDGE_BORDER_CLASS = "border-r-2 border-r-muted-foreground/40"; + export function ReportTable({ headers, content, @@ -53,6 +64,7 @@ export function ReportTable({ maxBodyHeight = "70vh", leafColumnWidth = 120, zeroAsDash = true, + onColumnResize, }: ReportTableProps) { const layout = useMemo(() => buildReportHeaderLayout(headers, scale), [headers, scale]); const totalColumns = leadingColumns.length + layout.leafColumns.length; @@ -72,6 +84,12 @@ export function ReportTable({ const theadRef = useRef(null); const [rowTopOffsets, setRowTopOffsets] = useState([]); + // 리사이즈 가능한 컬럼의
과 헤더 /
. 드래그 중에는 이 요소들의 폭만 직접 갱신해 + // 표 전체 리렌더 없이 부드럽게 리사이즈하고, 최종 폭만 mouseup에서 state로 커밋한다. + const resizableColRef = useRef(null); + const resizableHeadRef = useRef(null); + const resizeRafRef = useRef(null); + useLayoutEffect(() => { const thead = theadRef.current; if (!thead) return; @@ -79,12 +97,15 @@ export function ReportTable({ const measure = () => { const rows = Array.from(thead.querySelectorAll("tr")); let acc = 0; - setRowTopOffsets( - rows.map((tr) => { - const offset = acc; - acc += tr.getBoundingClientRect().height; - return offset; - }), + const next = rows.map((tr) => { + const offset = acc; + acc += tr.getBoundingClientRect().height; + return offset; + }); + // 가로 리사이즈처럼 높이가 그대로면 오프셋 값도 동일하다. 값이 같으면 배열 참조를 유지해 + // 불필요한 리렌더(리사이즈 중 ResizeObserver 발동으로 인한 이중 렌더)를 막는다. + setRowTopOffsets((prev) => + prev.length === next.length && prev.every((value, index) => value === next[index]) ? prev : next, ); }; @@ -94,6 +115,52 @@ export function ReportTable({ return () => observer.disconnect(); }, [layout]); + // 헤더 우측 핸들을 누른 지점을 기준으로 마우스 이동량만큼 폭을 조절한다. + // 드래그 중에는 setState 대신
의 폭만 직접 갱신(rAF로 프레임당 1회)해서 표 바디의 + // 리렌더/reconciliation을 피하고, 최종 폭만 mouseup에서 state로 커밋한다. + // (리사이즈 대상은 항상 마지막 sticky 컬럼이라 이후 sticky 컬럼의 left 오프셋을 다시 계산할 필요가 없다.) + // document 리스너로 처리해 커서가 셀 밖으로 나가도 드래그가 유지되게 한다. + const handleResizeStart = (key: string, startWidth: number) => (event: ReactMouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + const startX = event.clientX; + let latestWidth = startWidth; + + const applyWidth = () => { + resizeRafRef.current = null; + const col = resizableColRef.current; + if (col) col.style.width = `${latestWidth}px`; + const head = resizableHeadRef.current; + if (head) { + head.style.width = `${latestWidth}px`; + head.style.minWidth = `${latestWidth}px`; + head.style.maxWidth = `${latestWidth}px`; + } + }; + + const onMouseMove = (moveEvent: MouseEvent) => { + latestWidth = Math.max(MIN_RESIZE_WIDTH, startWidth + (moveEvent.clientX - startX)); + if (resizeRafRef.current === null) resizeRafRef.current = requestAnimationFrame(applyWidth); + }; + const onMouseUp = () => { + document.removeEventListener("mousemove", onMouseMove); + document.removeEventListener("mouseup", onMouseUp); + document.body.style.userSelect = ""; + document.body.style.cursor = ""; + if (resizeRafRef.current !== null) { + cancelAnimationFrame(resizeRafRef.current); + resizeRafRef.current = null; + } + // 최종 폭만 state로 커밋 → 자동 맞춤/새로고침/후속 렌더와 일관되게 동기화한다. + onColumnResize?.(key, latestWidth); + }; + + document.body.style.userSelect = "none"; + document.body.style.cursor = "col-resize"; + document.addEventListener("mousemove", onMouseMove); + document.addEventListener("mouseup", onMouseUp); + }; + return (
{/* DataTable.tsx와 동일하게 x/y 스크롤을 하나의 컨테이너에서 처리해야 sticky의 기준 컨테이너가 어긋나지 않는다. @@ -103,7 +170,11 @@ export function ReportTable({ {leadingColumns.map((column) => ( - + ))} {layout.leafColumns.map((leaf, index) => ( @@ -125,14 +196,25 @@ export function ReportTable({ maxWidth: column.width, }; if (column.sticky) style.left = leftOffsets[columnIndex]; + const isStickyEdge = columnIndex === stickyCount - 1; return ( {column.label} + {column.resizable && onColumnResize ? ( + // sticky 셀은 position이 static이 아니므로 이 핸들의 absolute 기준이 된다. + + ) : null} ); }) @@ -167,12 +249,12 @@ export function ReportTable({ return ( {merged ? ( - + {leadingColumns[stickyCount - 1].render(row)} ) : ( leadingColumns.slice(0, stickyCount).map((column, columnIndex) => ( - + {column.render(row)} )) -- 2.49.0.windows.1 From f63de2afd28820c634c4246b3429b6b8c561f8f5 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Thu, 17 Sep 2026 16:16:18 +0900 Subject: [PATCH 4/4] =?UTF-8?q?260917=5F02=5FENH:=20=ED=8C=9D=EC=97=85=20?= =?UTF-8?q?=EC=98=A4=EB=8A=98=ED=95=98=EB=A3=A8=EB=A7=8C=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=EB=B0=95=EC=8A=A4=20=ED=86=A0=EA=B8=80=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=ED=95=98=EA=B2=8C=20=EC=88=98=EC=A0=95,=20=ED=95=99?= =?UTF-8?q?=EB=8B=B9=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=8B=9C=20=EC=A7=84?= =?UTF-8?q?=ED=96=89=ED=98=84=ED=99=A9=EC=97=90=EC=84=9C=20=EC=84=B8?= =?UTF-8?q?=EB=B6=80=EC=A0=81=EC=9D=B8=20=EB=82=B4=EC=9A=A9=EC=9D=80=20?= =?UTF-8?q?=EB=B3=B4=EC=9D=B4=EC=A7=80=20=EC=95=8A=EA=B2=8C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(pages)/(main)/progress/page.tsx | 20 +++++++++++--------- src/components/app-shell/ActivePopupGate.tsx | 20 +++++++++++++++----- src/components/report/ReportTable.tsx | 8 ++++++-- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/app/(pages)/(main)/progress/page.tsx b/src/app/(pages)/(main)/progress/page.tsx index 6236631..21ecdaa 100644 --- a/src/app/(pages)/(main)/progress/page.tsx +++ b/src/app/(pages)/(main)/progress/page.tsx @@ -33,6 +33,9 @@ export default function ProgressPage() { const reportQuery = useProgressReportQuery(); + // 비관리자(Center)에게는 설문 항목(리포트 헤더) 컬럼을 숨기고 id/학당명/목표 표본/완료 수만 노출한다. + const visibleHeaders = admin ? (reportQuery.data?.headers ?? []) : []; + const content = useMemo(() => { const rows = reportQuery.data?.content ?? []; if (!admin || selectedCenterCds.length === 0) return rows; @@ -55,7 +58,7 @@ export default function ProgressPage() { exportReportToExcel({ fileName: `진행현황_${new Date().toISOString().slice(0, 10)}.xlsx`, sheetName: "진행현황", - headers: reportQuery.data.headers, + headers: visibleHeaders, content, scale: "current", leadingColumns, @@ -66,20 +69,19 @@ export default function ProgressPage() {
-
- {admin ? ( + {/* 필터(학당 선택)와 Excel 다운로드는 관리자 전용. 비관리자는 툴바 자체를 노출하지 않는다. */} + {admin ? ( +
- ) : ( - - )} - -
+ +
+ ) : null} {reportQuery.isLoading ? (

불러오는 중...

) : ( setDismissedIds((ids) => [...ids, current.popupId]); - const hideToday = () => { - const nextHiddenIds = [...new Set([...readHiddenPopupIds(), current.popupId])]; - cookieStore.set(CookieKeys.PopupHideToday, JSON.stringify(nextHiddenIds), { expires: getEndOfToday() }); - setHideTodayChecked(true); + // 닫기 전까지는 체크를 다시 해제할 수 있어야 하므로, 체크/해제 모두 쿠키에 반영한다. + const setHideToday = (next: boolean) => { + if (next) { + const nextHiddenIds = [...new Set([...readHiddenPopupIds(), current.popupId])]; + cookieStore.set(CookieKeys.PopupHideToday, JSON.stringify(nextHiddenIds), { expires: getEndOfToday() }); + } else { + const nextHiddenIds = readHiddenPopupIds().filter((id) => id !== current.popupId); + if (nextHiddenIds.length === 0) { + cookieStore.remove(CookieKeys.PopupHideToday); + } else { + cookieStore.set(CookieKeys.PopupHideToday, JSON.stringify(nextHiddenIds), { expires: getEndOfToday() }); + } + } + setHideTodayChecked(next); }; return ( @@ -65,7 +75,7 @@ export function ActivePopupGate() { footer={ <> diff --git a/src/components/report/ReportTable.tsx b/src/components/report/ReportTable.tsx index f0d436b..5823a78 100644 --- a/src/components/report/ReportTable.tsx +++ b/src/components/report/ReportTable.tsx @@ -162,12 +162,16 @@ export function ReportTable({ }; return ( -
+ // leaf 컬럼이 없으면 테이블이 내용 폭만 차지하므로, 외곽 border 박스도 w-fit으로 함께 줄여 + // 빈 영역이 넓게 남지 않도록 한다(가로가 넘칠 땐 max-w-full로 컨테이너를 넘지 않게 제한). +
{/* DataTable.tsx와 동일하게 x/y 스크롤을 하나의 컨테이너에서 처리해야 sticky의 기준 컨테이너가 어긋나지 않는다. overflow-x-auto만 있는 별도 wrapper를 추가로 두면 CSS 스펙상 overflow-y도 auto로 강제되어 중첩 스크롤 컨테이너가 생기고 sticky top이 깨진다. */}
-
+ {/* leaf 컬럼이 없으면(예: 비관리자 진행현황) w-full로 늘리면 leading 컬럼이 과하게 벌어지므로 + 내용 폭(=지정한 컬럼 폭 합)만큼만 차지하도록 w-auto로 둔다. */} +
0 ? "w-full" : "w-auto")}> {leadingColumns.map((column) => (