Compare commits
8 Commits
f0461861c1
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 7953cf41e2 | |||
| 345d496919 | |||
| f63de2afd2 | |||
| cfc88018aa | |||
| c12fd7133e | |||
| 63fff1ff25 | |||
| c73093f34f | |||
| 665b27c50a |
3
.env
Normal file
3
.env
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
NEXT_PUBLIC_API_BASE=/api
|
||||||
|
NEXT_PUBLIC_STORE_KEY=ksif-manage!-store-key-2026-kri!
|
||||||
|
NEXT_PUBLIC_STORE_IV=ksif-manage!-iv1
|
||||||
4
.env.local
Normal file
4
.env.local
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
NEXT_PUBLIC_ENV=local
|
||||||
|
ENV=local
|
||||||
|
API_SERVER=http://localhost:6109/api/v1
|
||||||
|
NEXT_PUBLIC_FILE_ORIGIN=http://localhost:6109
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -14,8 +14,5 @@ npm-debug.log*
|
|||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
.pnpm-debug.log*
|
.pnpm-debug.log*
|
||||||
.env
|
|
||||||
.env.local
|
|
||||||
.env.*.local
|
|
||||||
.idea/
|
.idea/
|
||||||
*.iml
|
*.iml
|
||||||
|
|||||||
11
AGENTS.md
11
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.
|
- 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.
|
- 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
|
### Change Safety
|
||||||
|
|
||||||
- Pin or constrain the package version according to the consumer repository's dependency policy and commit its lockfile changes.
|
- Pin or constrain the package version according to the consumer repository's dependency policy and commit its lockfile changes.
|
||||||
|
|||||||
114
package-lock.json
generated
114
package-lock.json
generated
@@ -101,7 +101,6 @@
|
|||||||
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
|
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.29.7",
|
"@babel/code-frame": "^7.29.7",
|
||||||
"@babel/generator": "^7.29.7",
|
"@babel/generator": "^7.29.7",
|
||||||
@@ -269,7 +268,6 @@
|
|||||||
"integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==",
|
"integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.29.7",
|
"@babel/code-frame": "^7.29.7",
|
||||||
"@babel/parser": "^7.29.7",
|
"@babel/parser": "^7.29.7",
|
||||||
@@ -318,6 +316,29 @@
|
|||||||
"integrity": "sha512-lwYN/vDPeNRULcepoE/LO2Pgx+7/RV+S9ARfbc9lr2DtGkOD7pAiruHvbR1RX3Qyf6ja47EWJDMsNK5vK08DJg==",
|
"integrity": "sha512-lwYN/vDPeNRULcepoE/LO2Pgx+7/RV+S9ARfbc9lr2DtGkOD7pAiruHvbR1RX3Qyf6ja47EWJDMsNK5vK08DJg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@emnapi/core": {
|
||||||
|
"version": "1.11.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.3.tgz",
|
||||||
|
"integrity": "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@emnapi/wasi-threads": "1.2.3",
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@emnapi/runtime": {
|
||||||
|
"version": "1.11.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz",
|
||||||
|
"integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@emnapi/wasi-threads": {
|
"node_modules/@emnapi/wasi-threads": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz",
|
||||||
@@ -325,6 +346,7 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
}
|
}
|
||||||
@@ -487,7 +509,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.8.0.tgz",
|
||||||
"integrity": "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==",
|
"integrity": "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@floating-ui/core": "^1.8.0",
|
"@floating-ui/core": "^1.8.0",
|
||||||
"@floating-ui/utils": "^0.2.12"
|
"@floating-ui/utils": "^0.2.12"
|
||||||
@@ -3138,6 +3159,72 @@
|
|||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": {
|
||||||
|
"version": "1.11.1",
|
||||||
|
"dev": true,
|
||||||
|
"inBundle": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@emnapi/wasi-threads": "1.2.2",
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": {
|
||||||
|
"version": "1.11.1",
|
||||||
|
"dev": true,
|
||||||
|
"inBundle": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
|
||||||
|
"version": "1.2.2",
|
||||||
|
"dev": true,
|
||||||
|
"inBundle": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"dev": true,
|
||||||
|
"inBundle": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@tybys/wasm-util": "^0.10.1"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/Brooooooklyn"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@emnapi/core": "^1.7.1",
|
||||||
|
"@emnapi/runtime": "^1.7.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": {
|
||||||
|
"version": "0.10.2",
|
||||||
|
"dev": true,
|
||||||
|
"inBundle": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"dev": true,
|
||||||
|
"inBundle": true,
|
||||||
|
"license": "0BSD",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"node_modules/@tailwindcss/oxide-win32-arm64-msvc": {
|
"node_modules/@tailwindcss/oxide-win32-arm64-msvc": {
|
||||||
"version": "4.3.3",
|
"version": "4.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.3.tgz",
|
||||||
@@ -3201,7 +3288,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.101.4.tgz",
|
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.101.4.tgz",
|
||||||
"integrity": "sha512-yRg2pfOCxIs4ZJW3XYYHU/WgtD04FHSnfHlpRT7h7pR77hwkdRG4wxbKe4aq6P0RvXUTBSQpQeadS1SUYUe+KA==",
|
"integrity": "sha512-yRg2pfOCxIs4ZJW3XYYHU/WgtD04FHSnfHlpRT7h7pR77hwkdRG4wxbKe4aq6P0RvXUTBSQpQeadS1SUYUe+KA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tanstack/query-core": "5.101.4"
|
"@tanstack/query-core": "5.101.4"
|
||||||
},
|
},
|
||||||
@@ -3251,7 +3337,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-3.30.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-3.30.2.tgz",
|
||||||
"integrity": "sha512-QbZC/s1OOqcoUdkhIY16TjR/gCtR0qAk9e4bJwUqOJqZuv5ozqCL5hzWm22jjTPp6c6Ei2tPd6t30VwfIKW4lQ==",
|
"integrity": "sha512-QbZC/s1OOqcoUdkhIY16TjR/gCtR0qAk9e4bJwUqOJqZuv5ozqCL5hzWm22jjTPp6c6Ei2tPd6t30VwfIKW4lQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/ueberdosis"
|
"url": "https://github.com/sponsors/ueberdosis"
|
||||||
@@ -3527,7 +3612,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-list/-/extension-list-3.30.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tiptap/extension-list/-/extension-list-3.30.2.tgz",
|
||||||
"integrity": "sha512-MIUpo1Bd9Rf1Qg+TNYNwDZ4xsfFeQahjU9Xhy6UcaszKQzbAM7KCzn5BObNytK1NdcqNHsC8Wj5vFvMKEzrXdw==",
|
"integrity": "sha512-MIUpo1Bd9Rf1Qg+TNYNwDZ4xsfFeQahjU9Xhy6UcaszKQzbAM7KCzn5BObNytK1NdcqNHsC8Wj5vFvMKEzrXdw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/ueberdosis"
|
"url": "https://github.com/sponsors/ueberdosis"
|
||||||
@@ -3620,7 +3704,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-table/-/extension-table-3.30.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tiptap/extension-table/-/extension-table-3.30.2.tgz",
|
||||||
"integrity": "sha512-zWp0ehZnx6N5lwRa8anSTn17GBEF3wxHXfOJGbBugf4Vwmp5keUEAXrgeIS4j7gIdxjN3XawdwjuMImG93N+Fg==",
|
"integrity": "sha512-zWp0ehZnx6N5lwRa8anSTn17GBEF3wxHXfOJGbBugf4Vwmp5keUEAXrgeIS4j7gIdxjN3XawdwjuMImG93N+Fg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/ueberdosis"
|
"url": "https://github.com/sponsors/ueberdosis"
|
||||||
@@ -3700,7 +3783,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-text-style/-/extension-text-style-3.30.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tiptap/extension-text-style/-/extension-text-style-3.30.2.tgz",
|
||||||
"integrity": "sha512-o3YMN3JNHg/rCCLZB3PUcAfl4bkrsXDoYoHRXvrbE9cl/RT+qAEFAAssI8kBC1fp9en9V2F4Z7Uy2uuzkbecKw==",
|
"integrity": "sha512-o3YMN3JNHg/rCCLZB3PUcAfl4bkrsXDoYoHRXvrbE9cl/RT+qAEFAAssI8kBC1fp9en9V2F4Z7Uy2uuzkbecKw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/ueberdosis"
|
"url": "https://github.com/sponsors/ueberdosis"
|
||||||
@@ -3727,7 +3809,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@tiptap/extensions/-/extensions-3.30.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tiptap/extensions/-/extensions-3.30.2.tgz",
|
||||||
"integrity": "sha512-2LqAHXk26QDsryW+beECxYeBzv5Ylk4GuB3cOmfghS7/G37R2W+Te3TkUK7BT0EWoDryvBT57/5q0DEFIhfZZg==",
|
"integrity": "sha512-2LqAHXk26QDsryW+beECxYeBzv5Ylk4GuB3cOmfghS7/G37R2W+Te3TkUK7BT0EWoDryvBT57/5q0DEFIhfZZg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/ueberdosis"
|
"url": "https://github.com/sponsors/ueberdosis"
|
||||||
@@ -3742,7 +3823,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-3.30.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-3.30.2.tgz",
|
||||||
"integrity": "sha512-BJN8tUx4ppFN3R3cV/FJfrJbJkvo1lj4uciq+nwpjwzdRvFzqIuglWf+HLcJ6CwlYpLOHp7ArgkBg4Q5e60Gog==",
|
"integrity": "sha512-BJN8tUx4ppFN3R3cV/FJfrJbJkvo1lj4uciq+nwpjwzdRvFzqIuglWf+HLcJ6CwlYpLOHp7ArgkBg4Q5e60Gog==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"prosemirror-changeset": "^2.4.1",
|
"prosemirror-changeset": "^2.4.1",
|
||||||
"prosemirror-commands": "^1.7.1",
|
"prosemirror-commands": "^1.7.1",
|
||||||
@@ -3873,7 +3953,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz",
|
||||||
"integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==",
|
"integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"csstype": "^3.2.2"
|
"csstype": "^3.2.2"
|
||||||
}
|
}
|
||||||
@@ -3883,7 +3962,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.4.tgz",
|
||||||
"integrity": "sha512-Bsc+QHgp+P/F02XDzNCY9jnZNCUuLki36KT7VKrTXXLdHf+vHMNZnW1rVu5DNW/rCK+fya3DATySbLM4yhtKUw==",
|
"integrity": "sha512-Bsc+QHgp+P/F02XDzNCY9jnZNCUuLki36KT7VKrTXXLdHf+vHMNZnW1rVu5DNW/rCK+fya3DATySbLM4yhtKUw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@types/react": "^19.2.0"
|
"@types/react": "^19.2.0"
|
||||||
}
|
}
|
||||||
@@ -3946,7 +4024,6 @@
|
|||||||
"integrity": "sha512-fUBfTuuEulWqX6V8+O3PtScV01tzYYRUDTAirHFKoRAt7nOzoGiPt0M/bB47wWNy0coOOcgEwAMUtBpykMxl6w==",
|
"integrity": "sha512-fUBfTuuEulWqX6V8+O3PtScV01tzYYRUDTAirHFKoRAt7nOzoGiPt0M/bB47wWNy0coOOcgEwAMUtBpykMxl6w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "8.67.0",
|
"@typescript-eslint/scope-manager": "8.67.0",
|
||||||
"@typescript-eslint/types": "8.67.0",
|
"@typescript-eslint/types": "8.67.0",
|
||||||
@@ -4550,7 +4627,6 @@
|
|||||||
"integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
|
"integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -4858,7 +4934,6 @@
|
|||||||
"integrity": "sha512-Ixm8tFfoKKIPYdCCKYTsqv+Fd4IJ0DQqMyEimo+pxUOMUR9cVPlwTrFt9Avu+3cb6Zp3mAzl+t1MrG2fxxKsxw==",
|
"integrity": "sha512-Ixm8tFfoKKIPYdCCKYTsqv+Fd4IJ0DQqMyEimo+pxUOMUR9cVPlwTrFt9Avu+3cb6Zp3mAzl+t1MrG2fxxKsxw==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/types": "^7.26.0"
|
"@babel/types": "^7.26.0"
|
||||||
}
|
}
|
||||||
@@ -4926,7 +5001,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.11.12",
|
"baseline-browser-mapping": "^2.11.12",
|
||||||
"caniuse-lite": "^1.0.30001809",
|
"caniuse-lite": "^1.0.30001809",
|
||||||
@@ -5618,7 +5692,6 @@
|
|||||||
"integrity": "sha512-DgZS62aPLXKlnxILS/AYCoRvHaZeXceIzlXPkkGGzJWSow1aEk0lbTlxUSlyjC8jcaKxAdOnTDz+o1JFSBsyjw==",
|
"integrity": "sha512-DgZS62aPLXKlnxILS/AYCoRvHaZeXceIzlXPkkGGzJWSow1aEk0lbTlxUSlyjC8jcaKxAdOnTDz+o1JFSBsyjw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.8.0",
|
"@eslint-community/eslint-utils": "^4.8.0",
|
||||||
"@eslint-community/regexpp": "^4.12.1",
|
"@eslint-community/regexpp": "^4.12.1",
|
||||||
@@ -5804,7 +5877,6 @@
|
|||||||
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
|
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rtsao/scc": "^1.1.0",
|
"@rtsao/scc": "^1.1.0",
|
||||||
"array-includes": "^3.1.9",
|
"array-includes": "^3.1.9",
|
||||||
@@ -7026,7 +7098,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/jotai/-/jotai-2.20.2.tgz",
|
"resolved": "https://registry.npmjs.org/jotai/-/jotai-2.20.2.tgz",
|
||||||
"integrity": "sha512-aHB4CNb9qRcyf0mwSB6EO5bCGAjx8cTwFgOFCE2leOnTzqACbnSWG8XoWB3LxCT1Qoj03I1OWAHszDmN4uHb/w==",
|
"integrity": "sha512-aHB4CNb9qRcyf0mwSB6EO5bCGAjx8cTwFgOFCE2leOnTzqACbnSWG8XoWB3LxCT1Qoj03I1OWAHszDmN4uHb/w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.20.0"
|
"node": ">=12.20.0"
|
||||||
},
|
},
|
||||||
@@ -8320,7 +8391,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz",
|
||||||
"integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==",
|
"integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@@ -8356,7 +8426,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz",
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz",
|
||||||
"integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==",
|
"integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"scheduler": "^0.27.0"
|
"scheduler": "^0.27.0"
|
||||||
},
|
},
|
||||||
@@ -9173,7 +9242,6 @@
|
|||||||
"integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
|
"integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -9346,7 +9414,6 @@
|
|||||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@@ -9722,7 +9789,6 @@
|
|||||||
"integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",
|
"integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/colinhacks"
|
"url": "https://github.com/sponsors/colinhacks"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export default function AdminSettingsPage() {
|
|||||||
{ id: "target", header: "팝업 대상", size: 120, cell: ({ row }) => <CenterTargetCell centerCds={row.original.centerCds} centers={centersQuery.data ?? []} /> },
|
{ id: "target", header: "팝업 대상", size: 120, cell: ({ row }) => <CenterTargetCell centerCds={row.original.centerCds} centers={centersQuery.data ?? []} /> },
|
||||||
{ accessorKey: "startDt", header: "팝업 시작", size: 110, cell: ({ row }) => row.original.startDt?.slice(0, 10) },
|
{ accessorKey: "startDt", header: "팝업 시작", size: 110, cell: ({ row }) => row.original.startDt?.slice(0, 10) },
|
||||||
{ accessorKey: "endDt", header: "팝업 종료", size: 110, cell: ({ row }) => row.original.endDt?.slice(0, 10) },
|
{ accessorKey: "endDt", header: "팝업 종료", size: 110, cell: ({ row }) => row.original.endDt?.slice(0, 10) },
|
||||||
{ accessorKey: "regUser", header: "게시자", size: 100 },
|
{ accessorKey: "regUser", header: "게시자", size: 100, cell: ({ row }) => row.original.regUserName ?? row.original.regUser },
|
||||||
{ accessorKey: "regDt", header: "게시일", size: 110, cell: ({ row }) => row.original.regDt?.slice(0, 10) },
|
{ accessorKey: "regDt", header: "게시일", size: 110, cell: ({ row }) => row.original.regDt?.slice(0, 10) },
|
||||||
], [totalElements, pagination.pageIndex, pagination.pageSize, centersQuery.data]);
|
], [totalElements, pagination.pageIndex, pagination.pageSize, centersQuery.data]);
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export function NoticeViewDialog({ noticeId, onEdit, onDeleted }: NoticeViewDial
|
|||||||
) : (
|
) : (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="flex flex-wrap items-center gap-1 text-sm text-muted-foreground">
|
<div className="flex flex-wrap items-center gap-1 text-sm text-muted-foreground">
|
||||||
<span>{notice.regUser} · {notice.regDt?.slice(0, 10)}</span>
|
<span>{notice.regUserName ?? notice.regUser} · {notice.regDt?.slice(0, 10)}</span>
|
||||||
{admin ? (
|
{admin ? (
|
||||||
<>
|
<>
|
||||||
<span>· 공지 대상:</span>
|
<span>· 공지 대상:</span>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export default function NoticesPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
base.push(
|
base.push(
|
||||||
{ accessorKey: "regUser", header: "게시자", size: 100 },
|
{ accessorKey: "regUser", header: "게시자", size: 100, cell: ({ row }) => row.original.regUserName ?? row.original.regUser },
|
||||||
{ accessorKey: "regDt", header: "게시일", size: 110, cell: ({ row }) => row.original.regDt?.slice(0, 10) },
|
{ accessorKey: "regDt", header: "게시일", size: 110, cell: ({ row }) => row.original.regDt?.slice(0, 10) },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import { MultiSelect } from "@/components/common/multi-select";
|
|||||||
import { ExcelDownloadButton } from "@/components/report/ExcelDownloadButton";
|
import { ExcelDownloadButton } from "@/components/report/ExcelDownloadButton";
|
||||||
import { exportReportToExcel } from "@/components/report/exportReportToExcel";
|
import { exportReportToExcel } from "@/components/report/exportReportToExcel";
|
||||||
import { ReportTable, type ReportLeadingColumn } from "@/components/report/ReportTable";
|
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 { useAuth } from "@/hooks/useAuth";
|
||||||
import { useCentersQuery } from "@/query/center";
|
import { useCentersQuery } from "@/query/center";
|
||||||
import { useProgressReportQuery } from "@/query/report";
|
import { useProgressReportQuery } from "@/query/report";
|
||||||
@@ -13,7 +15,7 @@ import { isAdminRole } from "@/types/auth";
|
|||||||
|
|
||||||
const LEADING_COLUMNS: ReportLeadingColumn[] = [
|
const LEADING_COLUMNS: ReportLeadingColumn[] = [
|
||||||
{ key: "centerCd", label: "id", width: 64, sticky: true, render: (row) => row.centerCd },
|
{ 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: "targetCount", label: "목표 표본", width: 100, render: (row) => row.targetCount },
|
||||||
{ key: "completeCount", label: "완료 수", width: 100, render: (row) => row.completeCount ?? "-" },
|
{ key: "completeCount", label: "완료 수", width: 100, render: (row) => row.completeCount ?? "-" },
|
||||||
];
|
];
|
||||||
@@ -31,6 +33,9 @@ export default function ProgressPage() {
|
|||||||
|
|
||||||
const reportQuery = useProgressReportQuery();
|
const reportQuery = useProgressReportQuery();
|
||||||
|
|
||||||
|
// 비관리자(Center)에게는 설문 항목(리포트 헤더) 컬럼을 숨기고 id/학당명/목표 표본/완료 수만 노출한다.
|
||||||
|
const visibleHeaders = admin ? (reportQuery.data?.headers ?? []) : [];
|
||||||
|
|
||||||
const content = useMemo(() => {
|
const content = useMemo(() => {
|
||||||
const rows = reportQuery.data?.content ?? [];
|
const rows = reportQuery.data?.content ?? [];
|
||||||
if (!admin || selectedCenterCds.length === 0) return rows;
|
if (!admin || selectedCenterCds.length === 0) return rows;
|
||||||
@@ -39,15 +44,24 @@ export default function ProgressPage() {
|
|||||||
return rows.filter((row) => row.centerCd === 0 || selected.has(row.centerCd));
|
return rows.filter((row) => row.centerCd === 0 || selected.has(row.centerCd));
|
||||||
}, [reportQuery.data, admin, selectedCenterCds]);
|
}, [reportQuery.data, admin, selectedCenterCds]);
|
||||||
|
|
||||||
|
const centerNameWidth = useAutoFitCenterNameWidth(content);
|
||||||
|
// 사용자가 핸들로 폭을 조절하면 그 값을 우선 사용하고, 그 이후엔 자동 맞춤을 멈춘다(새로고침 시 초기화).
|
||||||
|
const [manualCenterNameWidth, setManualCenterNameWidth] = useState<number | null>(null);
|
||||||
|
const effectiveCenterNameWidth = manualCenterNameWidth ?? centerNameWidth;
|
||||||
|
const leadingColumns = useMemo(
|
||||||
|
() => LEADING_COLUMNS.map((column) => column.key === "centerName" ? { ...column, width: effectiveCenterNameWidth, resizable: true } : column),
|
||||||
|
[effectiveCenterNameWidth],
|
||||||
|
);
|
||||||
|
|
||||||
const handleDownload = () => {
|
const handleDownload = () => {
|
||||||
if (!reportQuery.data) return;
|
if (!reportQuery.data) return;
|
||||||
exportReportToExcel({
|
exportReportToExcel({
|
||||||
fileName: `진행현황_${new Date().toISOString().slice(0, 10)}.xlsx`,
|
fileName: `진행현황_${new Date().toISOString().slice(0, 10)}.xlsx`,
|
||||||
sheetName: "진행현황",
|
sheetName: "진행현황",
|
||||||
headers: reportQuery.data.headers,
|
headers: visibleHeaders,
|
||||||
content,
|
content,
|
||||||
scale: "current",
|
scale: "current",
|
||||||
leadingColumns: LEADING_COLUMNS,
|
leadingColumns,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -55,24 +69,26 @@ export default function ProgressPage() {
|
|||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<AppPageTitle title="진행 현황" description="학당별 목표 표본 대비 설문 완료 현황입니다." />
|
<AppPageTitle title="진행 현황" description="학당별 목표 표본 대비 설문 완료 현황입니다." />
|
||||||
|
|
||||||
<div className="flex items-center justify-between gap-2">
|
{/* 필터(학당 선택)와 Excel 다운로드는 관리자 전용. 비관리자는 툴바 자체를 노출하지 않는다. */}
|
||||||
{admin ? (
|
{admin ? (
|
||||||
|
<div className="flex items-center justify-between gap-2">
|
||||||
<MultiSelect className="w-105" maxCount={2} options={centerOptions} defaultValue={selectedCenterCds} onValueChange={setSelectedCenterCds} placeholder="학당 선택 (전체)" />
|
<MultiSelect className="w-105" maxCount={2} options={centerOptions} defaultValue={selectedCenterCds} onValueChange={setSelectedCenterCds} placeholder="학당 선택 (전체)" />
|
||||||
) : (
|
|
||||||
<span />
|
|
||||||
)}
|
|
||||||
<ExcelDownloadButton disabled={!reportQuery.data} onClick={handleDownload} />
|
<ExcelDownloadButton disabled={!reportQuery.data} onClick={handleDownload} />
|
||||||
</div>
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{reportQuery.isLoading ? (
|
{reportQuery.isLoading ? (
|
||||||
<p className="text-sm text-muted-foreground">불러오는 중...</p>
|
<p className="text-sm text-muted-foreground">불러오는 중...</p>
|
||||||
) : (
|
) : (
|
||||||
<ReportTable
|
<ReportTable
|
||||||
headers={reportQuery.data?.headers ?? []}
|
headers={visibleHeaders}
|
||||||
content={content}
|
content={content}
|
||||||
scale="current"
|
scale="current"
|
||||||
leadingColumns={LEADING_COLUMNS}
|
leadingColumns={leadingColumns}
|
||||||
mergeLeadingColumnsWhen={(row) => row.centerCd === 0}
|
mergeLeadingColumnsWhen={(row) => row.centerCd === 0}
|
||||||
|
onColumnResize={(key, width) => {
|
||||||
|
if (key === "centerName") setManualCenterNameWidth(width);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export function QnaAnswerSection({ questionId, answer, admin, onChanged }: QnaAn
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-3 rounded-md border p-3">
|
<div className="space-y-3 rounded-md border p-3">
|
||||||
<div className="text-sm text-muted-foreground">
|
<div className="text-sm text-muted-foreground">
|
||||||
답변자: {answer?.regUser} · {answer?.regDt?.slice(0, 10)}
|
답변자: {answer?.regUserName ?? answer?.regUser} · {answer?.regDt?.slice(0, 10)}
|
||||||
</div>
|
</div>
|
||||||
<div dangerouslySetInnerHTML={{ __html: answer?.contentHtml ?? "" }} />
|
<div dangerouslySetInnerHTML={{ __html: answer?.contentHtml ?? "" }} />
|
||||||
<FileAttachmentField
|
<FileAttachmentField
|
||||||
|
|||||||
@@ -66,8 +66,7 @@ export function QnaViewDialog({ questionId, onEdit, onChanged }: QnaViewDialogPr
|
|||||||
) : (
|
) : (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="text-sm text-muted-foreground">
|
<div className="text-sm text-muted-foreground">
|
||||||
{question.regUser} · {question.regDt?.slice(0, 10)}
|
{question.regUser} · {question.regDt?.slice(0, 10)} · {question.centerName}
|
||||||
{admin ? ` · ${question.centerName}` : ""}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="rounded-md border p-3" dangerouslySetInnerHTML={{ __html: question.contentHtml }} />
|
<div className="rounded-md border p-3" dangerouslySetInnerHTML={{ __html: question.contentHtml }} />
|
||||||
<FileAttachmentField
|
<FileAttachmentField
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export default function QnaPage() {
|
|||||||
cell: ({ row }) => totalElements - pagination.pageIndex * pagination.pageSize - row.index,
|
cell: ({ row }) => totalElements - pagination.pageIndex * pagination.pageSize - row.index,
|
||||||
},
|
},
|
||||||
{ accessorKey: "title", header: "문의 제목" },
|
{ accessorKey: "title", header: "문의 제목" },
|
||||||
{ accessorKey: "regUser", header: "게시자", size: 100 },
|
{ accessorKey: "regUser", header: "게시자", size: 100, cell: ({ row }) => row.original.regUser },
|
||||||
{ accessorKey: "regDt", header: "게시일", size: 110, cell: ({ row }) => row.original.regDt?.slice(0, 10) },
|
{ accessorKey: "regDt", header: "게시일", size: 110, cell: ({ row }) => row.original.regDt?.slice(0, 10) },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,15 @@ import { MultiSelect } from "@/components/common/multi-select";
|
|||||||
import { ExcelDownloadButton } from "@/components/report/ExcelDownloadButton";
|
import { ExcelDownloadButton } from "@/components/report/ExcelDownloadButton";
|
||||||
import { exportReportToExcel } from "@/components/report/exportReportToExcel";
|
import { exportReportToExcel } from "@/components/report/exportReportToExcel";
|
||||||
import { ReportTable, type ReportLeadingColumn } from "@/components/report/ReportTable";
|
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 { useAuth } from "@/hooks/useAuth";
|
||||||
import { useCentersQuery } from "@/query/center";
|
import { useCentersQuery } from "@/query/center";
|
||||||
import { useFinalReportQuery } from "@/query/report";
|
import { useFinalReportQuery } from "@/query/report";
|
||||||
import { isAdminRole } from "@/types/auth";
|
import { isAdminRole } from "@/types/auth";
|
||||||
|
|
||||||
const LEADING_COLUMNS: ReportLeadingColumn[] = [
|
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 },
|
{ key: "completeCount", label: "완료 수", width: 100, render: (row) => row.completeCount ?? 0 },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -37,6 +39,15 @@ export default function ReportPage() {
|
|||||||
return rows.filter((row) => row.centerCd === 0 || selected.has(row.centerCd));
|
return rows.filter((row) => row.centerCd === 0 || selected.has(row.centerCd));
|
||||||
}, [reportQuery.data, admin, selectedCenterCds]);
|
}, [reportQuery.data, admin, selectedCenterCds]);
|
||||||
|
|
||||||
|
const centerNameWidth = useAutoFitCenterNameWidth(content);
|
||||||
|
const [manualCenterNameWidth, setManualCenterNameWidth] = useState<number | null>(null);
|
||||||
|
const effectiveCenterNameWidth = manualCenterNameWidth ?? centerNameWidth;
|
||||||
|
|
||||||
|
const leadingColumns = useMemo(
|
||||||
|
() => LEADING_COLUMNS.map((column) => column.key === "centerName" ? { ...column, width: effectiveCenterNameWidth, resizable: true } : column),
|
||||||
|
[effectiveCenterNameWidth],
|
||||||
|
);
|
||||||
|
|
||||||
const handleDownload = () => {
|
const handleDownload = () => {
|
||||||
if (!reportQuery.data) return;
|
if (!reportQuery.data) return;
|
||||||
exportReportToExcel({
|
exportReportToExcel({
|
||||||
@@ -45,7 +56,7 @@ export default function ReportPage() {
|
|||||||
headers: reportQuery.data.headers,
|
headers: reportQuery.data.headers,
|
||||||
content,
|
content,
|
||||||
scale: "final",
|
scale: "final",
|
||||||
leadingColumns: LEADING_COLUMNS,
|
leadingColumns,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -65,7 +76,15 @@ export default function ReportPage() {
|
|||||||
{reportQuery.isLoading ? (
|
{reportQuery.isLoading ? (
|
||||||
<p className="text-sm text-muted-foreground">불러오는 중...</p>
|
<p className="text-sm text-muted-foreground">불러오는 중...</p>
|
||||||
) : (
|
) : (
|
||||||
<ReportTable headers={reportQuery.data?.headers ?? []} content={content} scale="final" leadingColumns={LEADING_COLUMNS} />
|
<ReportTable
|
||||||
|
headers={reportQuery.data?.headers ?? []}
|
||||||
|
content={content}
|
||||||
|
scale="final"
|
||||||
|
leadingColumns={leadingColumns}
|
||||||
|
onColumnResize={(key, width) => {
|
||||||
|
if (key === "centerName") setManualCenterNameWidth(width);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { redirect } from "next/navigation";
|
||||||
|
|
||||||
export default function NotFound() {
|
export default function NotFound() {
|
||||||
|
redirect("/");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="flex min-h-screen flex-col items-center justify-center gap-4 p-6 text-center">
|
<main className="flex min-h-screen flex-col items-center justify-center gap-4 p-6 text-center">
|
||||||
<p className="text-sm text-muted-foreground">404</p>
|
<p className="text-sm text-muted-foreground">404</p>
|
||||||
|
|||||||
@@ -48,10 +48,20 @@ export function ActivePopupGate() {
|
|||||||
|
|
||||||
const dismiss = () => setDismissedIds((ids) => [...ids, current.popupId]);
|
const dismiss = () => setDismissedIds((ids) => [...ids, current.popupId]);
|
||||||
|
|
||||||
const hideToday = () => {
|
// 닫기 전까지는 체크를 다시 해제할 수 있어야 하므로, 체크/해제 모두 쿠키에 반영한다.
|
||||||
|
const setHideToday = (next: boolean) => {
|
||||||
|
if (next) {
|
||||||
const nextHiddenIds = [...new Set([...readHiddenPopupIds(), current.popupId])];
|
const nextHiddenIds = [...new Set([...readHiddenPopupIds(), current.popupId])];
|
||||||
cookieStore.set(CookieKeys.PopupHideToday, JSON.stringify(nextHiddenIds), { expires: getEndOfToday() });
|
cookieStore.set(CookieKeys.PopupHideToday, JSON.stringify(nextHiddenIds), { expires: getEndOfToday() });
|
||||||
setHideTodayChecked(true);
|
} 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 (
|
return (
|
||||||
@@ -65,7 +75,7 @@ export function ActivePopupGate() {
|
|||||||
footer={
|
footer={
|
||||||
<>
|
<>
|
||||||
<label className="flex items-center gap-2 text-sm text-muted-foreground">
|
<label className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||||
<Checkbox checked={hideTodayChecked} onCheckedChange={(checked) => checked === true && hideToday()} />
|
<Checkbox checked={hideTodayChecked} onCheckedChange={(checked) => setHideToday(checked === true)} />
|
||||||
오늘 하루 보지 않기
|
오늘 하루 보지 않기
|
||||||
</label>
|
</label>
|
||||||
<Button type="button" onClick={dismiss}>닫기</Button>
|
<Button type="button" onClick={dismiss}>닫기</Button>
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ export function DataTable<TData, TValue = unknown>({
|
|||||||
<div className="rounded-md border">
|
<div className="rounded-md border">
|
||||||
<div
|
<div
|
||||||
ref={scrollContainerRef}
|
ref={scrollContainerRef}
|
||||||
className="relative w-full overflow-visible"
|
className="relative w-full overflow-x-auto"
|
||||||
style={maxBodyHeight ? { maxHeight: maxBodyHeight } : undefined}
|
style={maxBodyHeight ? { maxHeight: maxBodyHeight } : undefined}
|
||||||
>
|
>
|
||||||
<table className="w-full caption-bottom text-sm">
|
<table className="w-full caption-bottom text-sm">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"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 { TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import type { ReportContent, ReportHeader } from "@/types/report";
|
import type { ReportContent, ReportHeader } from "@/types/report";
|
||||||
@@ -11,6 +11,8 @@ export interface ReportLeadingColumn {
|
|||||||
label: string;
|
label: string;
|
||||||
width: number;
|
width: number;
|
||||||
sticky?: boolean;
|
sticky?: boolean;
|
||||||
|
// true면 헤더 우측 경계에 드래그 핸들을 표시해 사용자가 폭을 조절할 수 있다(onColumnResize와 함께 사용).
|
||||||
|
resizable?: boolean;
|
||||||
render: (row: ReportContent) => ReactNode;
|
render: (row: ReportContent) => ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,9 +27,15 @@ export interface ReportTableProps {
|
|||||||
leafColumnWidth?: number;
|
leafColumnWidth?: number;
|
||||||
// 0을 "-"로 표시할지(기본값), "0.00"/"0.0"처럼 반올림된 값 그대로 표시할지 선택한다.
|
// 0을 "-"로 표시할지(기본값), "0.00"/"0.0"처럼 반올림된 값 그대로 표시할지 선택한다.
|
||||||
zeroAsDash?: boolean;
|
zeroAsDash?: boolean;
|
||||||
|
// resizable 컬럼의 드래그 핸들로 폭이 바뀔 때 호출된다. 실제 폭 상태는 상위에서 관리한다.
|
||||||
|
onColumnResize?: (key: string, width: number) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 드래그로 줄일 수 있는 최소 폭(px). sticky 컬럼이 뭉개지지 않도록 하한을 둔다.
|
||||||
|
const MIN_RESIZE_WIDTH = 80;
|
||||||
|
|
||||||
const BODY_CELL_TEXT_CLASS = "truncate";
|
const BODY_CELL_TEXT_CLASS = "truncate";
|
||||||
|
const CENTER_NAME_CELL_CLASS = "whitespace-pre-line break-keep";
|
||||||
|
|
||||||
// value7은 소수점 2자리(예: "7.00"), value100은 소수점 1자리(예: "100.0")로 반올림 표기한다.
|
// value7은 소수점 2자리(예: "7.00"), value100은 소수점 1자리(예: "100.0")로 반올림 표기한다.
|
||||||
// null은 항상 "-"로 표시하고, 0은 zeroAsDash 옵션에 따라 "-" 또는 반올림된 값("0.00"/"0.0")으로 표시한다.
|
// null은 항상 "-"로 표시하고, 0은 zeroAsDash 옵션에 따라 "-" 또는 반올림된 값("0.00"/"0.0")으로 표시한다.
|
||||||
@@ -43,6 +51,10 @@ const formatReportValue = (raw: string | null, field: "value7" | "value100", zer
|
|||||||
// 공백이 없으면 단어 중간(한글 글자 사이)도 끊어버려서, 한국어에 맞는 break-keep(word-break: keep-all)을 쓴다.
|
// 공백이 없으면 단어 중간(한글 글자 사이)도 끊어버려서, 한국어에 맞는 break-keep(word-break: keep-all)을 쓴다.
|
||||||
const HEADER_CELL_TEXT_CLASS = "whitespace-normal break-keep";
|
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({
|
export function ReportTable({
|
||||||
headers,
|
headers,
|
||||||
content,
|
content,
|
||||||
@@ -52,6 +64,7 @@ export function ReportTable({
|
|||||||
maxBodyHeight = "70vh",
|
maxBodyHeight = "70vh",
|
||||||
leafColumnWidth = 120,
|
leafColumnWidth = 120,
|
||||||
zeroAsDash = true,
|
zeroAsDash = true,
|
||||||
|
onColumnResize,
|
||||||
}: ReportTableProps) {
|
}: ReportTableProps) {
|
||||||
const layout = useMemo(() => buildReportHeaderLayout(headers, scale), [headers, scale]);
|
const layout = useMemo(() => buildReportHeaderLayout(headers, scale), [headers, scale]);
|
||||||
const totalColumns = leadingColumns.length + layout.leafColumns.length;
|
const totalColumns = leadingColumns.length + layout.leafColumns.length;
|
||||||
@@ -71,6 +84,12 @@ export function ReportTable({
|
|||||||
const theadRef = useRef<HTMLTableSectionElement>(null);
|
const theadRef = useRef<HTMLTableSectionElement>(null);
|
||||||
const [rowTopOffsets, setRowTopOffsets] = useState<number[]>([]);
|
const [rowTopOffsets, setRowTopOffsets] = useState<number[]>([]);
|
||||||
|
|
||||||
|
// 리사이즈 가능한 컬럼의 <col>과 헤더 <th>. 드래그 중에는 이 요소들의 폭만 직접 갱신해
|
||||||
|
// 표 전체 리렌더 없이 부드럽게 리사이즈하고, 최종 폭만 mouseup에서 state로 커밋한다.
|
||||||
|
const resizableColRef = useRef<HTMLTableColElement>(null);
|
||||||
|
const resizableHeadRef = useRef<HTMLTableCellElement>(null);
|
||||||
|
const resizeRafRef = useRef<number | null>(null);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
const thead = theadRef.current;
|
const thead = theadRef.current;
|
||||||
if (!thead) return;
|
if (!thead) return;
|
||||||
@@ -78,12 +97,15 @@ export function ReportTable({
|
|||||||
const measure = () => {
|
const measure = () => {
|
||||||
const rows = Array.from(thead.querySelectorAll("tr"));
|
const rows = Array.from(thead.querySelectorAll("tr"));
|
||||||
let acc = 0;
|
let acc = 0;
|
||||||
setRowTopOffsets(
|
const next = rows.map((tr) => {
|
||||||
rows.map((tr) => {
|
|
||||||
const offset = acc;
|
const offset = acc;
|
||||||
acc += tr.getBoundingClientRect().height;
|
acc += tr.getBoundingClientRect().height;
|
||||||
return offset;
|
return offset;
|
||||||
}),
|
});
|
||||||
|
// 가로 리사이즈처럼 높이가 그대로면 오프셋 값도 동일하다. 값이 같으면 배열 참조를 유지해
|
||||||
|
// 불필요한 리렌더(리사이즈 중 ResizeObserver 발동으로 인한 이중 렌더)를 막는다.
|
||||||
|
setRowTopOffsets((prev) =>
|
||||||
|
prev.length === next.length && prev.every((value, index) => value === next[index]) ? prev : next,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -93,16 +115,70 @@ export function ReportTable({
|
|||||||
return () => observer.disconnect();
|
return () => observer.disconnect();
|
||||||
}, [layout]);
|
}, [layout]);
|
||||||
|
|
||||||
|
// 헤더 우측 핸들을 누른 지점을 기준으로 마우스 이동량만큼 폭을 조절한다.
|
||||||
|
// 드래그 중에는 setState 대신 <col>/<th>의 폭만 직접 갱신(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 (
|
return (
|
||||||
<div className="rounded-md border">
|
// leaf 컬럼이 없으면 테이블이 내용 폭만 차지하므로, 외곽 border 박스도 w-fit으로 함께 줄여
|
||||||
|
// 빈 영역이 넓게 남지 않도록 한다(가로가 넘칠 땐 max-w-full로 컨테이너를 넘지 않게 제한).
|
||||||
|
<div className={cn("rounded-md border", layout.leafColumns.length === 0 && "w-fit max-w-full")}>
|
||||||
{/* DataTable.tsx와 동일하게 x/y 스크롤을 하나의 컨테이너에서 처리해야 sticky의 기준 컨테이너가 어긋나지 않는다.
|
{/* DataTable.tsx와 동일하게 x/y 스크롤을 하나의 컨테이너에서 처리해야 sticky의 기준 컨테이너가 어긋나지 않는다.
|
||||||
overflow-x-auto만 있는 별도 wrapper를 추가로 두면 CSS 스펙상 overflow-y도 auto로 강제되어
|
overflow-x-auto만 있는 별도 wrapper를 추가로 두면 CSS 스펙상 overflow-y도 auto로 강제되어
|
||||||
중첩 스크롤 컨테이너가 생기고 sticky top이 깨진다. */}
|
중첩 스크롤 컨테이너가 생기고 sticky top이 깨진다. */}
|
||||||
<div className="relative w-full overflow-auto" style={{ maxHeight: maxBodyHeight }}>
|
<div className="relative w-full overflow-auto" style={{ maxHeight: maxBodyHeight }}>
|
||||||
<table className="w-full table-fixed caption-bottom text-sm">
|
{/* leaf 컬럼이 없으면(예: 비관리자 진행현황) w-full로 늘리면 leading 컬럼이 과하게 벌어지므로
|
||||||
|
내용 폭(=지정한 컬럼 폭 합)만큼만 차지하도록 w-auto로 둔다. */}
|
||||||
|
<table className={cn("table-fixed caption-bottom text-sm", layout.leafColumns.length > 0 ? "w-full" : "w-auto")}>
|
||||||
<colgroup>
|
<colgroup>
|
||||||
{leadingColumns.map((column) => (
|
{leadingColumns.map((column) => (
|
||||||
<col key={column.key} style={{ width: column.width }} />
|
<col
|
||||||
|
key={column.key}
|
||||||
|
ref={column.resizable ? resizableColRef : undefined}
|
||||||
|
style={{ width: column.width }}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
{layout.leafColumns.map((leaf, index) => (
|
{layout.leafColumns.map((leaf, index) => (
|
||||||
<col key={`${leaf.headerId}-${leaf.field}-${index}`} style={{ width: leafColumnWidth }} />
|
<col key={`${leaf.headerId}-${leaf.field}-${index}`} style={{ width: leafColumnWidth }} />
|
||||||
@@ -124,14 +200,25 @@ export function ReportTable({
|
|||||||
maxWidth: column.width,
|
maxWidth: column.width,
|
||||||
};
|
};
|
||||||
if (column.sticky) style.left = leftOffsets[columnIndex];
|
if (column.sticky) style.left = leftOffsets[columnIndex];
|
||||||
|
const isStickyEdge = columnIndex === stickyCount - 1;
|
||||||
return (
|
return (
|
||||||
<TableHead
|
<TableHead
|
||||||
key={column.key}
|
key={column.key}
|
||||||
|
ref={column.resizable ? resizableHeadRef : undefined}
|
||||||
rowSpan={layout.rowCount}
|
rowSpan={layout.rowCount}
|
||||||
style={style}
|
style={style}
|
||||||
className={cn("h-auto bg-muted py-2 text-center align-middle font-semibold text-foreground", HEADER_CELL_TEXT_CLASS)}
|
className={cn("h-auto bg-muted py-2 text-center align-middle font-semibold text-foreground", HEADER_CELL_TEXT_CLASS, isStickyEdge && STICKY_EDGE_BORDER_CLASS)}
|
||||||
>
|
>
|
||||||
{column.label}
|
{column.label}
|
||||||
|
{column.resizable && onColumnResize ? (
|
||||||
|
// sticky 셀은 position이 static이 아니므로 이 핸들의 absolute 기준이 된다.
|
||||||
|
<span
|
||||||
|
role="separator"
|
||||||
|
aria-orientation="vertical"
|
||||||
|
onMouseDown={handleResizeStart(column.key, column.width)}
|
||||||
|
className="absolute inset-y-0 right-0 z-10 w-1.5 cursor-col-resize select-none hover:bg-primary/40"
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
</TableHead>
|
</TableHead>
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@@ -166,18 +253,18 @@ export function ReportTable({
|
|||||||
return (
|
return (
|
||||||
<TableRow key={row.centerCd}>
|
<TableRow key={row.centerCd}>
|
||||||
{merged ? (
|
{merged ? (
|
||||||
<TableCell colSpan={stickyCount} style={{ position: "sticky", left: 0, zIndex: 10 }} className={cn("bg-background text-center font-medium", BODY_CELL_TEXT_CLASS)}>
|
<TableCell colSpan={stickyCount} style={{ position: "sticky", left: 0, zIndex: 10 }} className={cn("bg-background text-center font-medium", leadingColumns[stickyCount - 1].key === "centerName" ? CENTER_NAME_CELL_CLASS : BODY_CELL_TEXT_CLASS, STICKY_EDGE_BORDER_CLASS)}>
|
||||||
{leadingColumns[stickyCount - 1].render(row)}
|
{leadingColumns[stickyCount - 1].render(row)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
) : (
|
) : (
|
||||||
leadingColumns.slice(0, stickyCount).map((column, columnIndex) => (
|
leadingColumns.slice(0, stickyCount).map((column, columnIndex) => (
|
||||||
<TableCell key={column.key} style={{ position: "sticky", left: leftOffsets[columnIndex], zIndex: 10 }} className={cn("bg-background text-center", BODY_CELL_TEXT_CLASS)}>
|
<TableCell key={column.key} style={{ position: "sticky", left: leftOffsets[columnIndex], zIndex: 10 }} className={cn("bg-background text-center", column.key === "centerName" ? CENTER_NAME_CELL_CLASS : BODY_CELL_TEXT_CLASS, columnIndex === stickyCount - 1 && STICKY_EDGE_BORDER_CLASS)}>
|
||||||
{column.render(row)}
|
{column.render(row)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
{leadingColumns.slice(stickyCount).map((column) => (
|
{leadingColumns.slice(stickyCount).map((column) => (
|
||||||
<TableCell key={column.key} className={cn("text-center", BODY_CELL_TEXT_CLASS)}>
|
<TableCell key={column.key} className={cn("text-center", column.key === "centerName" ? CENTER_NAME_CELL_CLASS : BODY_CELL_TEXT_CLASS)}>
|
||||||
{column.render(row)}
|
{column.render(row)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
))}
|
))}
|
||||||
|
|||||||
3
src/components/report/formatCenterName.ts
Normal file
3
src/components/report/formatCenterName.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export function formatCenterName(centerName: string): string {
|
||||||
|
return centerName.replace(/^(.+?[가-힣][가-힣0-9]*)\s+(?=[A-Za-z])/, "$1\n");
|
||||||
|
}
|
||||||
49
src/components/report/useAutoFitCenterNameWidth.ts
Normal file
49
src/components/report/useAutoFitCenterNameWidth.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ export interface Notice {
|
|||||||
files: FileItem[];
|
files: FileItem[];
|
||||||
viewed: boolean;
|
viewed: boolean;
|
||||||
regUser: string;
|
regUser: string;
|
||||||
|
regUserName?: string | null;
|
||||||
regDt: string;
|
regDt: string;
|
||||||
modUser: string;
|
modUser: string;
|
||||||
modDt: string;
|
modDt: string;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export interface Popup {
|
|||||||
endDt: string;
|
endDt: string;
|
||||||
viewed: boolean;
|
viewed: boolean;
|
||||||
regUser: string;
|
regUser: string;
|
||||||
|
regUserName?: string | null;
|
||||||
regDt: string;
|
regDt: string;
|
||||||
modUser: string;
|
modUser: string;
|
||||||
modDt: string;
|
modDt: string;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export interface QnaAnswer {
|
|||||||
viewUser?: string | null;
|
viewUser?: string | null;
|
||||||
viewDt?: string | null;
|
viewDt?: string | null;
|
||||||
regUser: string;
|
regUser: string;
|
||||||
|
regUserName?: string | null;
|
||||||
regDt: string;
|
regDt: string;
|
||||||
modUser: string;
|
modUser: string;
|
||||||
modDt: string;
|
modDt: string;
|
||||||
@@ -33,6 +34,7 @@ export interface QnaQuestion {
|
|||||||
files: FileItem[];
|
files: FileItem[];
|
||||||
answer: QnaAnswer | null;
|
answer: QnaAnswer | null;
|
||||||
regUser: string;
|
regUser: string;
|
||||||
|
regUserName?: string | null;
|
||||||
regDt: string;
|
regDt: string;
|
||||||
modUser: string;
|
modUser: string;
|
||||||
modDt: string;
|
modDt: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user