260702_01_ENH: 리스트 작업 도중 공용 ui를 적용하기 위한 중간 커밋
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
NEXT_PUBLIC_ENV=dev
|
||||
NEXT_PUBLIC_API_BASE=http://localhost:4000/api
|
||||
NEXT_PUBLIC_API_INTERNAL=https://intranet.kric.com
|
||||
|
||||
ENV=dev
|
||||
CONTACT_SERVER=http://localhost:4001
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
NEXT_PUBLIC_ENV=local
|
||||
NEXT_PUBLIC_API_BASE=http://localhost:4000/api
|
||||
NEXT_PUBLIC_API_INTERNAL=https://intranet.kric.com
|
||||
|
||||
ENV=local
|
||||
CONTACT_SERVER=http://localhost:4001
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
NEXT_PUBLIC_ENV=prod
|
||||
NEXT_PUBLIC_API_BASE=http://localhost:4000/api
|
||||
NEXT_PUBLIC_API_INTERNAL=https://intranet.kric.com
|
||||
|
||||
ENV=prod
|
||||
CONTACT_SERVER=http://localhost:4001
|
||||
|
||||
8
.idea/dictionaries/project.xml
generated
Normal file
8
.idea/dictionaries/project.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="project">
|
||||
<words>
|
||||
<w>Hder</w>
|
||||
<w>prjct</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
2
.npmrc
Normal file
2
.npmrc
Normal file
@@ -0,0 +1,2 @@
|
||||
@kri:registry=https://gitea.kric.com/api/packages/KRi/npm/
|
||||
//gitea.kric.com/api/packages/KRi/npm/:_authToken=${GITEA_NPM_TOKEN}
|
||||
@@ -1,15 +1,16 @@
|
||||
import type { NextConfig } from "next";
|
||||
import { createEnv, createKriNextConfig, env } from "@kri/common/config";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
output: "standalone",
|
||||
reactCompiler: true,
|
||||
const nextEnv = createEnv({
|
||||
CONTACT_SERVER: env.required("CONTACT_SERVER", process.env.CONTACT_SERVER),
|
||||
});
|
||||
|
||||
const nextConfig = createKriNextConfig({
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: "/contact-senario/:path*",
|
||||
destination: `${process.env.CONTACT_SERVER}/contact-senario/:path*`,
|
||||
destination: `${nextEnv.CONTACT_SERVER}/contact-senario/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
@@ -19,17 +20,17 @@ const nextConfig: NextConfig = {
|
||||
{
|
||||
source: "/api/external/:path*",
|
||||
headers: [
|
||||
{key: "Access-Control-Allow-Credentials", value: "true"},
|
||||
{key: "Access-Control-Allow-Origin", value: "*"},
|
||||
{key: "Access-Control-Allow-Methods", value: "GET,POST,PUT,PATCH,DELETE"},
|
||||
{ key: "Access-Control-Allow-Credentials", value: "true" },
|
||||
{ key: "Access-Control-Allow-Origin", value: "*" },
|
||||
{ key: "Access-Control-Allow-Methods", value: "GET,POST,PUT,PATCH,DELETE" },
|
||||
{
|
||||
key: "Access-Control-Allow-Headers",
|
||||
value: "Content-Type, Authorization, X-Requested-With",
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
];
|
||||
},
|
||||
};
|
||||
}) satisfies NextConfig;
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
416
package-lock.json
generated
416
package-lock.json
generated
@@ -8,6 +8,10 @@
|
||||
"name": "contact-front",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@kri/common": "^0.12.0",
|
||||
"@radix-ui/react-checkbox": "^1.3.3",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||
@@ -34,11 +38,9 @@
|
||||
"@tiptap/extension-underline": "^3.13.0",
|
||||
"@tiptap/react": "^3.12.0",
|
||||
"@tiptap/starter-kit": "^3.12.0",
|
||||
"@types/lodash": "^4.17.21",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"cmdk": "^1.1.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dompurify": "^3.4.10",
|
||||
"jotai": "^2.15.1",
|
||||
"lucide-react": "^0.553.0",
|
||||
"next": "^16.0.7",
|
||||
@@ -46,12 +48,10 @@
|
||||
"react": "^19.2.1",
|
||||
"react-dom": "^19.2.1",
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^3.4.0"
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4",
|
||||
"@tanstack/react-query-devtools": "^5.91.3",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
@@ -103,6 +103,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz",
|
||||
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
||||
"devOptional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
"@babel/generator": "^7.28.5",
|
||||
@@ -259,6 +260,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz",
|
||||
"integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==",
|
||||
"devOptional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
"@babel/parser": "^7.27.2",
|
||||
@@ -299,6 +301,60 @@
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@dnd-kit/accessibility": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@dnd-kit/accessibility/-/accessibility-3.1.1.tgz",
|
||||
"integrity": "sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@dnd-kit/core": {
|
||||
"version": "6.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz",
|
||||
"integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@dnd-kit/accessibility": "^3.1.1",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@dnd-kit/sortable": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@dnd-kit/sortable/-/sortable-10.0.0.tgz",
|
||||
"integrity": "sha512-+xqhmIIzvAYMGfBYYnbKuNicfSsk4RksY2XdmJhT+HAC01nix6fHCztU68jooFiMUB01Ky3F0FyOvhG/BZrWkg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@dnd-kit/core": "^6.3.0",
|
||||
"react": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@dnd-kit/utilities": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@dnd-kit/utilities/-/utilities-3.2.2.tgz",
|
||||
"integrity": "sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/core": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.7.0.tgz",
|
||||
@@ -475,6 +531,7 @@
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.4.tgz",
|
||||
"integrity": "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/core": "^1.7.3",
|
||||
"@floating-ui/utils": "^0.2.10"
|
||||
@@ -1031,6 +1088,33 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@kri/common": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://gitea.kric.com/api/packages/KRi/npm/%40kri%2Fcommon/-/0.12.0/common-0.12.0.tgz",
|
||||
"integrity": "sha512-VRtV1leu9OTHr/M9tK4duk8DXjf+NvT8bm98isSYml/oCbgYrKGm2ji33bG9ukPdk0wqhyM8XI0RQ9fvo0Evtg==",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"clsx": "^2.1.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"tailwind-merge": "^3.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tanstack/react-query": ">=5 <6",
|
||||
"jotai": ">=2",
|
||||
"react": ">=18"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@tanstack/react-query": {
|
||||
"optional": true
|
||||
},
|
||||
"jotai": {
|
||||
"optional": true
|
||||
},
|
||||
"react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/wasm-runtime": {
|
||||
"version": "0.2.12",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.12.tgz",
|
||||
@@ -1044,9 +1128,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@next/env": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-16.1.6.tgz",
|
||||
"integrity": "sha512-N1ySLuZjnAtN3kFnwhAwPvZah8RJxKasD7x1f8shFqhncnWZn4JMfg37diLNuoHsLAlrDfM3g4mawVdtAG8XLQ==",
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-16.2.4.tgz",
|
||||
"integrity": "sha512-dKkkOzOSwFYe5RX6y26fZgkSpVAlIOJKQHIiydQcrWH6y/97+RceSOAdjZ14Qa3zLduVUy0TXcn+EiM6t4rPgw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@next/eslint-plugin-next": {
|
||||
@@ -1059,9 +1143,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-darwin-arm64": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.1.6.tgz",
|
||||
"integrity": "sha512-wTzYulosJr/6nFnqGW7FrG3jfUUlEf8UjGA0/pyypJl42ExdVgC6xJgcXQ+V8QFn6niSG2Pb8+MIG1mZr2vczw==",
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.2.4.tgz",
|
||||
"integrity": "sha512-OXTFFox5EKN1Ym08vfrz+OXxmCcEjT4SFMbNRsWZE99dMqt2Kcusl5MqPXcW232RYkMLQTy0hqgAMEsfEd/l2A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1075,9 +1159,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-darwin-x64": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.1.6.tgz",
|
||||
"integrity": "sha512-BLFPYPDO+MNJsiDWbeVzqvYd4NyuRrEYVB5k2N3JfWncuHAy2IVwMAOlVQDFjj+krkWzhY2apvmekMkfQR0CUQ==",
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.2.4.tgz",
|
||||
"integrity": "sha512-XhpVnUfmYWvD3YrXu55XdcAkQtOnvaI6wtQa8fuF5fGoKoxIUZ0kWPtcOfqJEWngFF/lOS9l3+O9CcownhiQxQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1091,9 +1175,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-arm64-gnu": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.1.6.tgz",
|
||||
"integrity": "sha512-OJYkCd5pj/QloBvoEcJ2XiMnlJkRv9idWA/j0ugSuA34gMT6f5b7vOiCQHVRpvStoZUknhl6/UxOXL4OwtdaBw==",
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.2.4.tgz",
|
||||
"integrity": "sha512-Mx/tjlNA3G8kg14QvuGAJ4xBwPk1tUHq56JxZ8CXnZwz1Etz714soCEzGQQzVMz4bEnGPowzkV6Xrp6wAkEWOQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1107,9 +1191,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-arm64-musl": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.1.6.tgz",
|
||||
"integrity": "sha512-S4J2v+8tT3NIO9u2q+S0G5KdvNDjXfAv06OhfOzNDaBn5rw84DGXWndOEB7d5/x852A20sW1M56vhC/tRVbccQ==",
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.2.4.tgz",
|
||||
"integrity": "sha512-iVMMp14514u7Nup2umQS03nT/bN9HurK8ufylC3FZNykrwjtx7V1A7+4kvhbDSCeonTVqV3Txnv0Lu+m2oDXNg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1123,9 +1207,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-x64-gnu": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.1.6.tgz",
|
||||
"integrity": "sha512-2eEBDkFlMMNQnkTyPBhQOAyn2qMxyG2eE7GPH2WIDGEpEILcBPI/jdSv4t6xupSP+ot/jkfrCShLAa7+ZUPcJQ==",
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.2.4.tgz",
|
||||
"integrity": "sha512-EZOvm1aQWgnI/N/xcWOlnS3RQBk0VtVav5Zo7n4p0A7UKyTDx047k8opDbXgBpHl4CulRqRfbw3QrX2w5UOXMQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1139,9 +1223,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-x64-musl": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.1.6.tgz",
|
||||
"integrity": "sha512-oicJwRlyOoZXVlxmIMaTq7f8pN9QNbdes0q2FXfRsPhfCi8n8JmOZJm5oo1pwDaFbnnD421rVU409M3evFbIqg==",
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.2.4.tgz",
|
||||
"integrity": "sha512-h9FxsngCm9cTBf71AR4fGznDEDx1hS7+kSEiIRjq5kO1oXWm07DxVGZjCvk0SGx7TSjlUqhI8oOyz7NfwAdPoA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1155,9 +1239,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-arm64-msvc": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.1.6.tgz",
|
||||
"integrity": "sha512-gQmm8izDTPgs+DCWH22kcDmuUp7NyiJgEl18bcr8irXA5N2m2O+JQIr6f3ct42GOs9c0h8QF3L5SzIxcYAAXXw==",
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.2.4.tgz",
|
||||
"integrity": "sha512-3NdJV5OXMSOeJYijX+bjaLge3mJBlh4ybydbT4GFoB/2hAojWHtMhl3CYlYoMrjPuodp0nzFVi4Tj2+WaMg+Ow==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1171,9 +1255,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-x64-msvc": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.1.6.tgz",
|
||||
"integrity": "sha512-NRfO39AIrzBnixKbjuo2YiYhB6o9d8v/ymU9m/Xk8cyVk+k7XylniXkHwjs4s70wedVffc6bQNbufk5v0xEm0A==",
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.2.4.tgz",
|
||||
"integrity": "sha512-kMVGgsqhO5YTYODD9IPGGhA6iprWidQckK3LmPeW08PIFENRmgfb4MjXHO+p//d+ts2rpjvK5gXWzXSMrPl9cw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -2455,22 +2539,12 @@
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/query-devtools": {
|
||||
"version": "5.93.0",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.93.0.tgz",
|
||||
"integrity": "sha512-+kpsx1NQnOFTZsw6HAFCW3HkKg0+2cepGtAWXjiiSOJJ1CtQpt72EE2nyZb+AjAbLRPoeRmPJ8MtQd8r8gsPdg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/react-query": {
|
||||
"version": "5.90.21",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.90.21.tgz",
|
||||
"integrity": "sha512-0Lu6y5t+tvlTJMTO7oh5NSpJfpg/5D41LlThfepTixPYkJ0sE2Jj0m0f6yYqujBwIXlId87e234+MxG3D3g7kg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@tanstack/query-core": "5.90.20"
|
||||
},
|
||||
@@ -2482,24 +2556,6 @@
|
||||
"react": "^18 || ^19"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/react-query-devtools": {
|
||||
"version": "5.91.3",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.91.3.tgz",
|
||||
"integrity": "sha512-nlahjMtd/J1h7IzOOfqeyDh5LNfG0eULwlltPEonYy0QL+nqrBB+nyzJfULV+moL7sZyxc2sHdNJki+vLA9BSA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tanstack/query-devtools": "5.93.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tanstack/react-query": "^5.90.20",
|
||||
"react": "^18 || ^19"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/react-table": {
|
||||
"version": "8.21.3",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/react-table/-/react-table-8.21.3.tgz",
|
||||
@@ -2535,6 +2591,7 @@
|
||||
"version": "3.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-3.13.0.tgz",
|
||||
"integrity": "sha512-iUelgiTMgPVMpY5ZqASUpk8mC8HuR9FWKaDzK27w9oWip9tuB54Z8mePTxNcQaSPb6ErzEaC8x8egrRt7OsdGQ==",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
@@ -2777,6 +2834,7 @@
|
||||
"version": "3.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-list/-/extension-list-3.12.0.tgz",
|
||||
"integrity": "sha512-RCQb3MPsTsKZZ8Wf0maMnfcICcmYEbMfWJMUNwVUJCfEv1hGiA5J7jMEJWr7z6kH2ULDHmrkhg6BYCdLrJap/w==",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
@@ -2862,6 +2920,7 @@
|
||||
"version": "3.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-table/-/extension-table-3.13.0.tgz",
|
||||
"integrity": "sha512-LcH9KE4QBUJ6IPwt1Uo5iU7zatFjUUvXbctIu2fKQ9nqJ7nNSFxRhkNyporVFkTWYH7/rb0qMoF1VxSUGefG5w==",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
@@ -2935,6 +2994,7 @@
|
||||
"version": "3.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-text-style/-/extension-text-style-3.13.0.tgz",
|
||||
"integrity": "sha512-M7ob3pfYNYgFPihncEp33r9477hXQgC8j3iU8BsewvPlSx2bMSy5jp2XHDXyEX8dV6flr7acH4GkXXw+DHpaPA==",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
@@ -2959,6 +3019,7 @@
|
||||
"version": "3.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extensions/-/extensions-3.13.0.tgz",
|
||||
"integrity": "sha512-i7O0ptSibEtTy+2PIPsNKEvhTvMaFJg1W4Oxfnbuxvaigs7cJV9Q0lwDUcc7CPsNw2T1+44wcxg431CzTvdYoA==",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
@@ -2972,6 +3033,7 @@
|
||||
"version": "3.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-3.13.0.tgz",
|
||||
"integrity": "sha512-WKR4ucALq+lwx0WJZW17CspeTpXorbIOpvKv5mulZica6QxqfMhn8n1IXCkDws/mCoLRx4Drk5d377tIjFNsvQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"prosemirror-changeset": "^2.3.0",
|
||||
"prosemirror-collab": "^1.3.1",
|
||||
@@ -3068,12 +3130,6 @@
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/crypto-js": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.2.2.tgz",
|
||||
"integrity": "sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
|
||||
@@ -3097,11 +3153,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz",
|
||||
"integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q=="
|
||||
},
|
||||
"node_modules/@types/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-FOvQ0YPD5NOfPgMzJihoT+Za5pdkDJWcbpuj1DjaKZIr/gxodQjY/uWEFlTNqW2ugXHUiL8lRQgw63dzKHZdeQ=="
|
||||
},
|
||||
"node_modules/@types/markdown-it": {
|
||||
"version": "14.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz",
|
||||
@@ -3129,6 +3180,7 @@
|
||||
"version": "19.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.4.tgz",
|
||||
"integrity": "sha512-tBFxBp9Nfyy5rsmefN+WXc1JeW/j2BpBHFdLZbEVfs9wn3E3NRFxwV0pJg8M1qQAexFpvz73hJXFofV0ZAu92A==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"csstype": "^3.0.2"
|
||||
}
|
||||
@@ -3137,10 +3189,18 @@
|
||||
"version": "19.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz",
|
||||
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/trusted-types": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
|
||||
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/@types/use-sync-external-store": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
|
||||
@@ -3189,6 +3249,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.46.4.tgz",
|
||||
"integrity": "sha512-tK3GPFWbirvNgsNKto+UmB/cRtn6TZfyw0D6IKrW55n6Vbs7KJoZtI//kpTKzE/DUmmnAFD8/Ca46s7Obs92/w==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.46.4",
|
||||
"@typescript-eslint/types": "8.46.4",
|
||||
@@ -3338,9 +3399,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.3.tgz",
|
||||
"integrity": "sha512-fy6KJm2RawA5RcHkLa1z/ScpBeA762UF9KmZQxwIbDtRJrgLzM10depAiEQ+CXYcoiqW1/m96OAAoke2nE9EeA==",
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz",
|
||||
"integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -3701,6 +3762,7 @@
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
|
||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -3717,6 +3779,15 @@
|
||||
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/adler-32": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
|
||||
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/ajv": {
|
||||
"version": "6.14.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz",
|
||||
@@ -3979,6 +4050,7 @@
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-react-compiler/-/babel-plugin-react-compiler-1.0.0.tgz",
|
||||
"integrity": "sha512-Ixm8tFfoKKIPYdCCKYTsqv+Fd4IJ0DQqMyEimo+pxUOMUR9cVPlwTrFt9Avu+3cb6Zp3mAzl+t1MrG2fxxKsxw==",
|
||||
"devOptional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.26.0"
|
||||
}
|
||||
@@ -3990,18 +4062,23 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/baseline-browser-mapping": {
|
||||
"version": "2.8.27",
|
||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.27.tgz",
|
||||
"integrity": "sha512-2CXFpkjVnY2FT+B6GrSYxzYf65BJWEqz5tIRHCvNsZZ2F3CmsCB37h8SpYgKG7y9C4YAeTipIPWG7EmFmhAeXA==",
|
||||
"version": "2.10.23",
|
||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.23.tgz",
|
||||
"integrity": "sha512-xwVXGqevyKPsiuQdLj+dZMVjidjJV508TBqexND5HrF89cGdCYCJFB3qhcxRHSeMctdCfbR1jrxBajhDy7o29g==",
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"baseline-browser-mapping": "dist/cli.js"
|
||||
"baseline-browser-mapping": "dist/cli.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
||||
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
|
||||
"version": "1.1.14",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
|
||||
"integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
@@ -4038,6 +4115,7 @@
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.8.25",
|
||||
"caniuse-lite": "^1.0.30001754",
|
||||
@@ -4127,6 +4205,19 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/cfb": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
|
||||
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"adler-32": "~1.3.0",
|
||||
"crc-32": "~1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
@@ -4182,6 +4273,15 @@
|
||||
"react-dom": "^18 || ^19 || ^19.0.0-rc"
|
||||
}
|
||||
},
|
||||
"node_modules/codepage": {
|
||||
"version": "1.15.0",
|
||||
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
|
||||
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
@@ -4212,6 +4312,18 @@
|
||||
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/crc-32": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
|
||||
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"crc32": "bin/crc32.njs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/crelt": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz",
|
||||
@@ -4381,6 +4493,15 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dompurify": {
|
||||
"version": "3.4.10",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.10.tgz",
|
||||
"integrity": "sha512-0xzNv0e7oYC6yyuOGZIABPM4qtg3QxLFniDNPP4ZP90wR8Yq3zgwpRbrNiT4N3IKqDbbYFEJLV+JWEs19aZ//w==",
|
||||
"license": "(MPL-2.0 OR Apache-2.0)",
|
||||
"optionalDependencies": {
|
||||
"@types/trusted-types": "^2.0.7"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
@@ -4625,6 +4746,7 @@
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz",
|
||||
"integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.8.0",
|
||||
"@eslint-community/regexpp": "^4.12.1",
|
||||
@@ -4802,6 +4924,7 @@
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz",
|
||||
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@rtsao/scc": "^1.1.0",
|
||||
"array-includes": "^3.1.9",
|
||||
@@ -5140,10 +5263,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/flatted": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz",
|
||||
"integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==",
|
||||
"dev": true
|
||||
"version": "3.4.2",
|
||||
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz",
|
||||
"integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/for-each": {
|
||||
"version": "0.3.5",
|
||||
@@ -5160,6 +5284,15 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/frac": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
|
||||
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
@@ -5934,6 +6067,7 @@
|
||||
"version": "2.15.1",
|
||||
"resolved": "https://registry.npmjs.org/jotai/-/jotai-2.15.1.tgz",
|
||||
"integrity": "sha512-yHT1HAZ3ba2Q8wgaUQ+xfBzEtcS8ie687I8XVCBinfg4bNniyqLIN+utPXWKQE93LMF5fPbQSVRZqgpcN5yd6Q==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
},
|
||||
@@ -6514,14 +6648,14 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/next": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmjs.org/next/-/next-16.1.6.tgz",
|
||||
"integrity": "sha512-hkyRkcu5x/41KoqnROkfTm2pZVbKxvbZRuNvKXLRXxs3VfyO0WhY50TQS40EuKO9SW3rBj/sF3WbVwDACeMZyw==",
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/next/-/next-16.2.4.tgz",
|
||||
"integrity": "sha512-kPvz56wF5frc+FxlHI5qnklCzbq53HTwORaWBGdT0vNoKh1Aya9XC8aPauH4NJxqtzbWsS5mAbctm4cr+EkQ2Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@next/env": "16.1.6",
|
||||
"@next/env": "16.2.4",
|
||||
"@swc/helpers": "0.5.15",
|
||||
"baseline-browser-mapping": "^2.8.3",
|
||||
"baseline-browser-mapping": "^2.9.19",
|
||||
"caniuse-lite": "^1.0.30001579",
|
||||
"postcss": "8.4.31",
|
||||
"styled-jsx": "5.1.6"
|
||||
@@ -6533,15 +6667,15 @@
|
||||
"node": ">=20.9.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@next/swc-darwin-arm64": "16.1.6",
|
||||
"@next/swc-darwin-x64": "16.1.6",
|
||||
"@next/swc-linux-arm64-gnu": "16.1.6",
|
||||
"@next/swc-linux-arm64-musl": "16.1.6",
|
||||
"@next/swc-linux-x64-gnu": "16.1.6",
|
||||
"@next/swc-linux-x64-musl": "16.1.6",
|
||||
"@next/swc-win32-arm64-msvc": "16.1.6",
|
||||
"@next/swc-win32-x64-msvc": "16.1.6",
|
||||
"sharp": "^0.34.4"
|
||||
"@next/swc-darwin-arm64": "16.2.4",
|
||||
"@next/swc-darwin-x64": "16.2.4",
|
||||
"@next/swc-linux-arm64-gnu": "16.2.4",
|
||||
"@next/swc-linux-arm64-musl": "16.2.4",
|
||||
"@next/swc-linux-x64-gnu": "16.2.4",
|
||||
"@next/swc-linux-x64-musl": "16.2.4",
|
||||
"@next/swc-win32-arm64-msvc": "16.2.4",
|
||||
"@next/swc-win32-x64-msvc": "16.2.4",
|
||||
"sharp": "^0.34.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0",
|
||||
@@ -6834,10 +6968,11 @@
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
|
||||
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8.6"
|
||||
},
|
||||
@@ -6855,9 +6990,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.6",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
|
||||
"integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
|
||||
"version": "8.5.12",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.12.tgz",
|
||||
"integrity": "sha512-W62t/Se6rA0Az3DfCL0AqJwXuKwBeYg6nOaIgzP+xZ7N5BFCI7DYi1qs6ygUYT6rvfi6t9k65UMLJC+PHZpDAA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -6873,6 +7008,7 @@
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
@@ -7003,6 +7139,7 @@
|
||||
"version": "1.25.4",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.25.4.tgz",
|
||||
"integrity": "sha512-PIM7E43PBxKce8OQeezAs9j4TP+5yDpZVbuurd1h5phUxEKIu+G2a+EUZzIC5nS1mJktDJWzbqS23n1tsAf5QA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"orderedmap": "^2.0.0"
|
||||
}
|
||||
@@ -7029,6 +7166,7 @@
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-state/-/prosemirror-state-1.4.4.tgz",
|
||||
"integrity": "sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"prosemirror-model": "^1.0.0",
|
||||
"prosemirror-transform": "^1.0.0",
|
||||
@@ -7073,6 +7211,7 @@
|
||||
"version": "1.41.4",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.41.4.tgz",
|
||||
"integrity": "sha512-WkKgnyjNncri03Gjaz3IFWvCAE94XoiEgvtr0/r2Xw7R8/IjK3sKLSiDoCHWcsXSAinVaKlGRZDvMCsF1kbzjA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"prosemirror-model": "^1.20.0",
|
||||
"prosemirror-state": "^1.0.0",
|
||||
@@ -7120,6 +7259,7 @@
|
||||
"version": "19.2.1",
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.1.tgz",
|
||||
"integrity": "sha512-DGrYcCWK7tvYMnWh79yrPHt+vdx9tY+1gPZa7nJQtO/p8bLTDaHp4dzwEhQB7pZ4Xe3ok4XKuEPrVuc+wlpkmw==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -7128,6 +7268,7 @@
|
||||
"version": "19.2.1",
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.1.tgz",
|
||||
"integrity": "sha512-ibrK8llX2a4eOskq1mXKu/TGZj9qzomO+sNfO98M6d9zIPOEhlBkMkBUBLd1vgS0gQsLDBzA+8jJBVXDnfHmJg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"scheduler": "^0.27.0"
|
||||
},
|
||||
@@ -7603,6 +7744,18 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ssf": {
|
||||
"version": "0.11.2",
|
||||
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
|
||||
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"frac": "~1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/stable-hash": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.5.tgz",
|
||||
@@ -7858,10 +8011,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/tinyglobby/node_modules/picomatch": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
|
||||
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
@@ -8022,6 +8177,7 @@
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -8309,6 +8465,24 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/wmf": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
|
||||
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/word": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
|
||||
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/word-wrap": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
|
||||
@@ -8318,6 +8492,27 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xlsx": {
|
||||
"version": "0.18.5",
|
||||
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
|
||||
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"adler-32": "~1.3.0",
|
||||
"cfb": "~1.2.1",
|
||||
"codepage": "~1.15.0",
|
||||
"crc-32": "~1.2.1",
|
||||
"ssf": "~0.11.2",
|
||||
"wmf": "~1.0.1",
|
||||
"word": "~0.3.0"
|
||||
},
|
||||
"bin": {
|
||||
"xlsx": "bin/xlsx.njs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||
@@ -8341,6 +8536,7 @@
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.1.12.tgz",
|
||||
"integrity": "sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
|
||||
12
package.json
12
package.json
@@ -9,6 +9,10 @@
|
||||
"lint": "eslint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@kri/common": "^0.12.0",
|
||||
"@radix-ui/react-checkbox": "^1.3.3",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||
@@ -35,11 +39,9 @@
|
||||
"@tiptap/extension-underline": "^3.13.0",
|
||||
"@tiptap/react": "^3.12.0",
|
||||
"@tiptap/starter-kit": "^3.12.0",
|
||||
"@types/lodash": "^4.17.21",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"cmdk": "^1.1.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dompurify": "^3.4.10",
|
||||
"jotai": "^2.15.1",
|
||||
"lucide-react": "^0.553.0",
|
||||
"next": "^16.0.7",
|
||||
@@ -47,12 +49,10 @@
|
||||
"react": "^19.2.1",
|
||||
"react-dom": "^19.2.1",
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^3.4.0"
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4",
|
||||
"@tanstack/react-query-devtools": "^5.91.3",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
||||
|
Before Width: | Height: | Size: 391 B |
@@ -1 +0,0 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1 +0,0 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
||||
|
Before Width: | Height: | Size: 128 B |
@@ -1 +0,0 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
||||
|
Before Width: | Height: | Size: 385 B |
@@ -8,24 +8,22 @@ import { ChevronLeft, ChevronRight } from 'lucide-react'
|
||||
import { KriSingleSelect } from '@/components/common/KriAutoComplete'
|
||||
import { ProjectInfo } from "@/types/project";
|
||||
import { PROJECT_SEARCH_COUNT } from "@/const/projectConst";
|
||||
import { useDebouncedValue } from "@/hooks/useDebouncedValue";
|
||||
import { useMounted } from "@/hooks/useMounted";
|
||||
import { useDebouncedValue, useMounted } from "@kri/common/hooks";
|
||||
import { UserInfo } from "@/types/user";
|
||||
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
||||
import { KriSelect, KriSelectItem } from "@/components/common/KriSelect";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { CONTACT_USER_ROLE, FW_USER_ROLE } from "@/const/userConst";
|
||||
import {CONTACT_USER_ROLE, DEFAULT_COMPANY_NAME, FW_USER_ROLE} from "@/const/userConst";
|
||||
|
||||
import {
|
||||
useFieldworkUsersQuery,
|
||||
useFieldworkUsersQuery, useOutsourceUsersQuery,
|
||||
useRoleListQuery,
|
||||
useUserCompaniesQuery,
|
||||
} from "@/query/user";
|
||||
|
||||
import {
|
||||
useAssignedFieldworkIdsQuery,
|
||||
useSaveAssignedFieldworkMutation,
|
||||
useProjectTopQuery,
|
||||
useProjectTopQuery, useAssignedOutsourceIdsQuery,
|
||||
} from "@/query/project";
|
||||
|
||||
const ProjectAssignPage = () => {
|
||||
@@ -36,18 +34,27 @@ const ProjectAssignPage = () => {
|
||||
const prjctIdx = selectedProject?.prjctIdx ?? 0;
|
||||
const enabled = mounted && prjctIdx > 0;
|
||||
|
||||
const companyQuery = useOutsourceUsersQuery(enabled);
|
||||
const fwUsersQuery = useFieldworkUsersQuery(enabled);
|
||||
const assignedCompanyQuery = useAssignedOutsourceIdsQuery(prjctIdx, enabled);
|
||||
const assignedIdsQuery = useAssignedFieldworkIdsQuery(prjctIdx, enabled);
|
||||
const saveAssignMutation = useSaveAssignedFieldworkMutation(prjctIdx);
|
||||
|
||||
const companyQuery = useUserCompaniesQuery();
|
||||
const roleQuery = useRoleListQuery();
|
||||
|
||||
const [searchKeyword, setSearchKeyword] = useState("");
|
||||
const debouncedKeyword = useDebouncedValue(searchKeyword, 500);
|
||||
const projectTopQuery = useProjectTopQuery(PROJECT_SEARCH_COUNT, debouncedKeyword, mounted);
|
||||
const projectArray = projectTopQuery.data ?? [];
|
||||
const companyArray = companyQuery.data ?? [];
|
||||
const companyArray = useMemo(() => {
|
||||
const companies = companyQuery.data ?? [];
|
||||
const assigned = assignedCompanyQuery.data ?? [];
|
||||
const assignedCompanies = companies
|
||||
.filter(c => !assigned.includes(c.userCmpn))
|
||||
.map(c => c.userCmpn);
|
||||
|
||||
return [DEFAULT_COMPANY_NAME, ...assignedCompanies];
|
||||
}, [companyQuery.data, assignedCompanyQuery.data]);
|
||||
|
||||
const roleArray: KriSelectItem[] = useMemo(() => {
|
||||
const roles = roleQuery.data ?? [];
|
||||
@@ -252,12 +259,12 @@ const ProjectAssignPage = () => {
|
||||
if (!mounted || !selectedProject) return null;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 p-1">
|
||||
<div className="bg-gray-50 p-1">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
<div className="mb-6 rounded-lg border border-gray-200 bg-white p-4 shadow-sm">
|
||||
<div className="mb-6 rounded-lg border border-gray-200 bg-white p-2 shadow-sm">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-end">
|
||||
<div className="w-full sm:w-auto flex items-center gap-3">
|
||||
<div className="w-14 content-text-lg font-medium text-gray-700 whitespace-nowrap text-right">회사</div>
|
||||
<div className="w-14 text-lg font-medium text-gray-700 whitespace-nowrap text-right">회사</div>
|
||||
<KriSelect
|
||||
items={companyArray}
|
||||
value={companyFilter}
|
||||
@@ -269,7 +276,7 @@ const ProjectAssignPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="w-full sm:w-auto flex items-center gap-3">
|
||||
<div className="w-14 content-text-lg font-medium text-gray-700 whitespace-nowrap text-right">대상</div>
|
||||
<div className="w-14 text-lg font-medium text-gray-700 whitespace-nowrap text-right">대상</div>
|
||||
<KriSelect
|
||||
items={roleArray}
|
||||
value={roleFilter?.value || ""}
|
||||
@@ -286,11 +293,11 @@ const ProjectAssignPage = () => {
|
||||
|
||||
<div className="grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] gap-6 mb-6">
|
||||
<div className="min-w-0">
|
||||
<div className="p-3 bg-black text-white rounded-lg content-text-lg mb-2 h-15 flex items-center">
|
||||
<div className="p-2 bg-black text-white rounded-lg text-lg mb-2 h-13 flex items-center">
|
||||
<span className="truncate w-full">{assignInfoString}</span>
|
||||
</div>
|
||||
<div className="border border-gray-200 rounded-lg overflow-hidden bg-white shadow-sm">
|
||||
<div className="bg-gray-50 p-3 border-b border-gray-200">
|
||||
<div className="bg-gray-50 p-2 border-b border-gray-200">
|
||||
<Input
|
||||
placeholder="면접원 ID Or 면접원 이름"
|
||||
value={searchAssign}
|
||||
@@ -299,18 +306,18 @@ const ProjectAssignPage = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="h-[600px] overflow-y-auto">
|
||||
<div className="h-[550px] overflow-y-auto">
|
||||
<table className="w-full">
|
||||
<thead className="bg-black text-white sticky top-0">
|
||||
<tr>
|
||||
<th className="p-3 text-left w-12">
|
||||
<th className="p-2 text-left w-12">
|
||||
<Checkbox
|
||||
checked={selectedAssignUser.length === assignView.length && assignView.length > 0}
|
||||
onCheckedChange={handleSelectAllLeft}
|
||||
className="border-white"
|
||||
/>
|
||||
</th>
|
||||
<th className="p-3 text-left content-text-base font-medium">
|
||||
<th className="p-2 text-left text-base font-medium">
|
||||
배정된 {roleFilter?.label} ( {assignBase.length}명 )
|
||||
</th>
|
||||
</tr>
|
||||
@@ -324,14 +331,14 @@ const ProjectAssignPage = () => {
|
||||
}`}
|
||||
onClick={() => handleToggleUnassign(userInfo.userId)}
|
||||
>
|
||||
<td className="p-3">
|
||||
<td className="p-2">
|
||||
<Checkbox
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
checked={selectedAssignUser.includes(userInfo.userId)}
|
||||
onCheckedChange={() => handleToggleUnassign(userInfo.userId)}
|
||||
/>
|
||||
</td>
|
||||
<td className="p-3 content-text-base">
|
||||
<td className="p-2 text-base">
|
||||
{userInfo.userName} ({userInfo.userId})
|
||||
</td>
|
||||
</tr>
|
||||
@@ -346,7 +353,7 @@ const ProjectAssignPage = () => {
|
||||
<Button
|
||||
onClick={handleAssign}
|
||||
disabled={selectedAbleUser.length === 0}
|
||||
className="bg-black hover:bg-gray-800 w-36 h-12 flex items-center justify-center content-text-base disabled:bg-gray-300"
|
||||
className="bg-black hover:bg-gray-800 w-36 h-12 flex items-center justify-center text-base disabled:bg-gray-300"
|
||||
>
|
||||
<ChevronLeft className="w-5 h-5" />
|
||||
<span className="ml-2">배정 {selectedAbleUser.length}명</span>
|
||||
@@ -354,7 +361,7 @@ const ProjectAssignPage = () => {
|
||||
<Button
|
||||
onClick={handleRemove}
|
||||
disabled={selectedAssignUser.length === 0}
|
||||
className="bg-red-600 hover:bg-red-700 w-36 h-12 flex items-center justify-center content-text-base disabled:bg-gray-300"
|
||||
className="bg-red-600 hover:bg-red-700 w-36 h-12 flex items-center justify-center text-base disabled:bg-gray-300"
|
||||
>
|
||||
<ChevronRight className="w-5 h-5" />
|
||||
<span className="ml-2">제외 {selectedAssignUser.length}명</span>
|
||||
@@ -362,7 +369,7 @@ const ProjectAssignPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="min-w-0">
|
||||
<div className="p-3 bg-black text-white rounded-lg content-text-lg mb-2 h-15">
|
||||
<div className="p-2 bg-black text-white rounded-lg text-lg mb-2 h-13">
|
||||
<KriSingleSelect<ProjectInfo>
|
||||
items={projectArray}
|
||||
value={String(sourceProject?.prjctIdx ?? "")}
|
||||
@@ -383,7 +390,7 @@ const ProjectAssignPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="border border-gray-200 rounded-lg overflow-hidden bg-white shadow-sm">
|
||||
<div className="bg-gray-50 p-3 border-b border-gray-200">
|
||||
<div className="bg-gray-50 p-2 border-b border-gray-200">
|
||||
<Input
|
||||
placeholder="면접원 ID Or 면접원 이름"
|
||||
value={searchAble}
|
||||
@@ -392,18 +399,18 @@ const ProjectAssignPage = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="h-[600px] overflow-y-auto">
|
||||
<div className="h-[550px] overflow-y-auto">
|
||||
<table className="w-full">
|
||||
<thead className="bg-black text-white sticky top-0">
|
||||
<tr>
|
||||
<th className="p-3 text-left w-12">
|
||||
<th className="p-2 text-left w-12">
|
||||
<Checkbox
|
||||
checked={selectedAbleUser.length === ableView.length && ableView.length > 0}
|
||||
onCheckedChange={handleSelectAllRight}
|
||||
className="border-white"
|
||||
/>
|
||||
</th>
|
||||
<th className="p-3 text-left content-text-base font-medium">
|
||||
<th className="p-2 text-left text-base font-medium">
|
||||
배정 가능 {roleFilter?.label} ({ableBase.length}명 )
|
||||
</th>
|
||||
</tr>
|
||||
@@ -417,14 +424,14 @@ const ProjectAssignPage = () => {
|
||||
}`}
|
||||
onClick={() => handleToggleAssign(user.userId)}
|
||||
>
|
||||
<td className="p-3">
|
||||
<td className="p-2">
|
||||
<Checkbox
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
checked={selectedAbleUser.includes(user.userId)}
|
||||
onCheckedChange={() => handleToggleAssign(user.userId)}
|
||||
/>
|
||||
</td>
|
||||
<td className="p-3 content-text-base">
|
||||
<td className="p-2 text-base">
|
||||
{user.userName} ({user.userId})
|
||||
</td>
|
||||
</tr>
|
||||
@@ -439,7 +446,7 @@ const ProjectAssignPage = () => {
|
||||
<div className="flex justify-center">
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
className="bg-black hover:bg-gray-800 px-12 h-11 content-text-base font-medium"
|
||||
className="bg-black hover:bg-gray-800 px-12 h-9 text-base font-medium"
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
@@ -449,4 +456,4 @@ const ProjectAssignPage = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export default ProjectAssignPage;
|
||||
export default ProjectAssignPage;
|
||||
|
||||
@@ -5,10 +5,10 @@ import {CookieKeys} from "@/store/cookie/cookie-keys";
|
||||
import {FONT_SIZE} from "@/const/commonConst";
|
||||
|
||||
function parseFontSize(raw: string | undefined | null) {
|
||||
if (!raw) return FONT_SIZE.MIN;
|
||||
if (!raw) return FONT_SIZE.DEFAULT;
|
||||
|
||||
const parsed = parseInt(raw, 10);
|
||||
if (Number.isNaN(parsed)) return FONT_SIZE.MIN;
|
||||
if (Number.isNaN(parsed)) return FONT_SIZE.DEFAULT;
|
||||
|
||||
return Math.min(
|
||||
FONT_SIZE.MAX,
|
||||
@@ -23,7 +23,7 @@ export default async function MainLayoutWrapper({
|
||||
}) {
|
||||
const cookieStore = await cookies();
|
||||
const fontSize = cookieStore.get(CookieKeys.FontSize);
|
||||
const accessToken = cookieStore.get("access_token")?.value;
|
||||
const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value;
|
||||
const initialFontSize = parseFontSize(fontSize?.value);
|
||||
|
||||
if (!accessToken) {
|
||||
@@ -35,4 +35,4 @@ export default async function MainLayoutWrapper({
|
||||
{children}
|
||||
</MainLayout>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'use client'
|
||||
'use client'
|
||||
|
||||
import { useMemo, useState } from 'react'
|
||||
import { PaginationState, SortingState } from '@tanstack/react-table'
|
||||
@@ -18,34 +18,57 @@ import { DataTable } from '@/components/data-table/DataTable'
|
||||
import type { DataTableColumn } from '@/components/data-table/DataTable.type'
|
||||
import { KriMultiSelect } from '@/components/common/KriAutoComplete'
|
||||
import { LoadingOverlay } from '@/components/common/LoadingOverlay'
|
||||
import { useMounted } from '@/hooks/useMounted'
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
import { useAuth } from '@/hooks/useAuth'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import { useSelectedProject } from '@/hooks/useSelectedProject'
|
||||
import { useListHeaderQuery, useListSearchQuery } from '@/query/list'
|
||||
import {
|
||||
useDownloadListEventHistoryMutation,
|
||||
useDownloadListExcelTemplateMutation,
|
||||
useDownloadListItemFileMutation,
|
||||
useDownloadListMutation,
|
||||
useDownloadListUpdateHistoryMutation,
|
||||
useDownloadUploadHistoryFileMutation,
|
||||
useListHeaderQuery,
|
||||
useListSearchQuery,
|
||||
useListUploadHistoryQuery,
|
||||
useResetListMutation,
|
||||
useUpdateListHeaderMutation,
|
||||
useUpdateListMutation,
|
||||
useUploadListExcelMutation,
|
||||
} from '@/query/list'
|
||||
import { useResultCodesQuery } from '@/query/project'
|
||||
import { getListColumns, ListTableRow } from '@/components/table-column/ListTableColumn'
|
||||
import { ListSearchRequest } from '@/types/list'
|
||||
import {
|
||||
createEmptyListFilter,
|
||||
FilterRow,
|
||||
ListEventHistoryBase,
|
||||
ListDownloadMode,
|
||||
ListDownloadPayload,
|
||||
listHeader,
|
||||
ListFilterMatchType,
|
||||
ListFilterOperator,
|
||||
ListFilterTarget,
|
||||
ListOtherItemFilterCondition,
|
||||
ListResetMode,
|
||||
ListResetScope,
|
||||
ListSearchRequest,
|
||||
ListUploadRequest,
|
||||
} from '@/types/list'
|
||||
import { ResultCode, ResultCodeType } from '@/types/project'
|
||||
import { ListHeaderAssignConst } from '@/const/listConst'
|
||||
import ListResetDialog, { ListResetScope, ListResetTarget } from '@/components/dialog/ListResetDialog'
|
||||
import ListUploadDialog, { ListUploadHistory, ValidationOption } from '@/components/dialog/ListUploadDialog'
|
||||
import ListHeaderManageDialog, { ListHeaderManageRow } from '@/components/dialog/ListHeaderManageDialog'
|
||||
import ListResetDialog from '@/components/dialog/ListResetDialog'
|
||||
import ListUploadDialog from '@/components/dialog/ListUploadDialog'
|
||||
import ListHeaderManageDialog from '@/components/dialog/ListHeaderManageDialog'
|
||||
import ListBatchEditDialog, { BatchEditRow } from '@/components/dialog/ListBatchEditDialog'
|
||||
import ListFilterDialog, { FilterRow } from '@/components/dialog/ListFilterDialog'
|
||||
import ListDownloadDialog, { ListDownloadMode } from '@/components/dialog/ListDownloadDialog'
|
||||
import ListFilterDialog from '@/components/dialog/ListFilterDialog'
|
||||
import ListDownloadDialog from '@/components/dialog/ListDownloadDialog'
|
||||
import MessageSendDialog, {
|
||||
MessageSendMode,
|
||||
MessageSendPayload,
|
||||
MessageTemplateOption,
|
||||
} from '@/components/dialog/MessageSendDialog'
|
||||
import MessageHistoryDialog, { MessageHistoryRow } from '@/components/dialog/MessageHistoryDialog'
|
||||
|
||||
const uploadHistoryMock: ListUploadHistory[] = [
|
||||
{ round: 1, fileName: 'a.xlsx', userId: 'admin', uploadCount: 3500, uploadAt: '2025-10-30T11:00:00Z' },
|
||||
{ round: 2, fileName: '1.xlsx', userId: 'admin', uploadCount: 100, uploadAt: '2025-10-30T12:00:00Z' },
|
||||
{ round: 3, fileName: '2.xlsx', userId: 'admin', uploadCount: 2000, uploadAt: '2025-10-30T13:00:00Z' },
|
||||
]
|
||||
import { downloadBase64File, downloadFile, XLSX_MIME_TYPE } from '@kri/common/browser'
|
||||
|
||||
const messageTemplateMock: MessageTemplateOption[] = [
|
||||
{
|
||||
@@ -84,7 +107,7 @@ const messageHistoryMock: MessageHistoryRow[] = [
|
||||
{
|
||||
id: 2,
|
||||
type: 'email',
|
||||
title: 'Please answer this survey',
|
||||
title: 'Survey Answer Request',
|
||||
templateName: 'EMAIL Template A',
|
||||
sendInfo: 'info@kric.com',
|
||||
targetHeader: 'Email',
|
||||
@@ -101,6 +124,39 @@ const messageHistoryMock: MessageHistoryRow[] = [
|
||||
},
|
||||
]
|
||||
|
||||
const toSidSet = (value: string) =>
|
||||
value
|
||||
.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => item.length > 0)
|
||||
|
||||
const toFilterCondition = (row: FilterRow, usesListValue: boolean): Omit<ListOtherItemFilterCondition, 'listHderId'> => {
|
||||
const values = usesListValue ? row.multiValues : [row.textValue.trim()]
|
||||
|
||||
if (row.operator === 'eq') {
|
||||
return { operator: ListFilterOperator.POSITIVE, matchType: ListFilterMatchType.EXACT, values }
|
||||
}
|
||||
if (row.operator === 'neq') {
|
||||
return { operator: ListFilterOperator.NEGATIVE, matchType: ListFilterMatchType.EXACT, values }
|
||||
}
|
||||
if (row.operator === 'contains') {
|
||||
return { operator: ListFilterOperator.POSITIVE, matchType: ListFilterMatchType.CONTAINS, values }
|
||||
}
|
||||
return { operator: ListFilterOperator.NEGATIVE, matchType: ListFilterMatchType.CONTAINS, values }
|
||||
}
|
||||
|
||||
const toDateTimeRange = (from?: string, to?: string) => {
|
||||
if (!from || !to) return undefined
|
||||
return {
|
||||
startDate: `${from}T00:00:00`,
|
||||
endDate: `${to}T23:59:59`,
|
||||
}
|
||||
}
|
||||
|
||||
const downloadArrayBuffer = (buffer: ArrayBuffer, filename: string, type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') => {
|
||||
downloadFile(new Blob([buffer], { type }), filename)
|
||||
}
|
||||
|
||||
const ListManagePage = () => {
|
||||
const mounted = useMounted()
|
||||
const { auth } = useAuth()
|
||||
@@ -118,30 +174,49 @@ const ListManagePage = () => {
|
||||
const [messageSendMode, setMessageSendMode] = useState<MessageSendMode>('email')
|
||||
const [filterRows, setFilterRows] = useState<FilterRow[]>([])
|
||||
const [batchRows, setBatchRows] = useState<BatchEditRow[]>([])
|
||||
const [selectedRows, setSelectedRows] = useState<ListTableRow[]>([])
|
||||
|
||||
const userRole = auth?.user?.userRole ?? 9000
|
||||
const prjctName = selectedProject?.prjctName ?? '';
|
||||
const prjctIdx = selectedProject?.prjctIdx ?? 0
|
||||
const enabled = mounted && prjctIdx > 0
|
||||
|
||||
const resultCodesQuery = useResultCodesQuery(prjctIdx, enabled)
|
||||
const listHeaderQuery = useListHeaderQuery(prjctIdx, enabled)
|
||||
const uploadHistoryQuery = useListUploadHistoryQuery(prjctIdx, enabled)
|
||||
const downloadListExcelTemplateMutation = useDownloadListExcelTemplateMutation()
|
||||
const uploadListExcelMutation = useUploadListExcelMutation(prjctIdx)
|
||||
const updateListHeaderMutation = useUpdateListHeaderMutation(prjctIdx)
|
||||
const resetListMutation = useResetListMutation(prjctIdx)
|
||||
const updateListMutation = useUpdateListMutation(prjctIdx)
|
||||
const downloadListMutation = useDownloadListMutation(prjctIdx)
|
||||
const downloadListUpdateHistoryMutation = useDownloadListUpdateHistoryMutation(prjctIdx)
|
||||
const downloadListEventHistoryMutation = useDownloadListEventHistoryMutation(prjctIdx)
|
||||
const downloadListItemFileMutation = useDownloadListItemFileMutation(prjctIdx)
|
||||
const downloadUploadHistoryFileMutation = useDownloadUploadHistoryFileMutation(prjctIdx)
|
||||
|
||||
const resultCodeArray = useMemo<ResultCode[]>(() => resultCodesQuery.data ?? [], [resultCodesQuery.data])
|
||||
|
||||
const listSearchRequest = useMemo<ListSearchRequest>(() => {
|
||||
const sort = sorting?.[0] ?? { id: 'sid', desc: true as const }
|
||||
const sort = sorting?.[0] ?? { id: 'sid', desc: false as const }
|
||||
const listFilter = createEmptyListFilter()
|
||||
listFilter.sidSet = toSidSet(searchText)
|
||||
listFilter.memoConditions = []
|
||||
listFilter.otherItemConditions = filterRows
|
||||
.map((row) => {
|
||||
const usesListValue = (listHeaderQuery.data ?? []).some(
|
||||
(header) => header.listHderId === row.headerId && (header.filterContents?.length ?? 0) > 0,
|
||||
)
|
||||
|
||||
return {
|
||||
listHderId: row.headerId,
|
||||
...toFilterCondition(row, usesListValue),
|
||||
}
|
||||
})
|
||||
.filter((item) => item.values.some((value) => value.trim().length > 0))
|
||||
|
||||
return {
|
||||
listFilter: {
|
||||
sidSet: [],
|
||||
listUseSet: [],
|
||||
assignUserMap: {
|
||||
[ListHeaderAssignConst.OUTSOURCE]: [],
|
||||
[ListHeaderAssignConst.CONTACT_INTERVIEWER]: [],
|
||||
[ListHeaderAssignConst.FIELD_INTERVIEWER]: [],
|
||||
},
|
||||
memo: '',
|
||||
otherItems: {},
|
||||
},
|
||||
listFilter,
|
||||
pageRequest: {
|
||||
pageIndex: pagination.pageIndex,
|
||||
pageSize: pagination.pageSize,
|
||||
@@ -149,7 +224,7 @@ const ListManagePage = () => {
|
||||
sortDir: sort.desc ? 'desc' : 'asc',
|
||||
},
|
||||
}
|
||||
}, [pagination, sorting])
|
||||
}, [filterRows, listHeaderQuery.data, pagination.pageIndex, pagination.pageSize, searchText, sorting])
|
||||
|
||||
const listSearchQuery = useListSearchQuery(prjctIdx, listSearchRequest, enabled)
|
||||
|
||||
@@ -163,6 +238,26 @@ const ListManagePage = () => {
|
||||
[listSearchQuery.data],
|
||||
)
|
||||
|
||||
const selectedSidSet = useMemo(
|
||||
() =>
|
||||
selectedRows
|
||||
.map((row) => row.sid)
|
||||
.filter((sid): sid is string | number => typeof sid === 'string' || typeof sid === 'number')
|
||||
.map(String),
|
||||
[selectedRows],
|
||||
)
|
||||
|
||||
const buildTargetFilter = (target: ListFilterTarget) => {
|
||||
if (target === 'all') return createEmptyListFilter()
|
||||
if (target === 'selected') {
|
||||
return {
|
||||
...createEmptyListFilter(),
|
||||
sidSet: selectedSidSet,
|
||||
}
|
||||
}
|
||||
return listSearchRequest.listFilter
|
||||
}
|
||||
|
||||
const totalCount = listSearchQuery.data?.totalElements ?? 0
|
||||
const pageCount = listSearchQuery.data?.totalPages ?? 0
|
||||
|
||||
@@ -175,20 +270,18 @@ const ListManagePage = () => {
|
||||
[listHeaderQuery.data],
|
||||
)
|
||||
|
||||
const headerManageRows = useMemo<ListHeaderManageRow[]>(
|
||||
() =>
|
||||
(listHeaderQuery.data ?? []).map((header) => ({
|
||||
id: header.listHderId,
|
||||
name: header.listHderNm,
|
||||
visible: header.useColView,
|
||||
locked: header.listHderGrad === 0,
|
||||
})),
|
||||
[listHeaderQuery.data],
|
||||
)
|
||||
const headerManageRows = useMemo<listHeader[]>(() => listHeaderQuery.data ?? [], [listHeaderQuery.data])
|
||||
|
||||
const filterHeaderOptions = useMemo(
|
||||
() => headerOptions.map((item) => ({ ...item, values: ['A', 'B', 'C'] })),
|
||||
[headerOptions],
|
||||
() =>
|
||||
(listHeaderQuery.data ?? [])
|
||||
.filter((header) => header.useFilter)
|
||||
.map((header) => ({
|
||||
id: header.listHderId,
|
||||
label: header.listHderNm,
|
||||
values: header.filterContents ?? [],
|
||||
})),
|
||||
[listHeaderQuery.data],
|
||||
)
|
||||
|
||||
const messageTargetHeaders = useMemo(() => {
|
||||
@@ -210,39 +303,85 @@ const ListManagePage = () => {
|
||||
showDialog('messageSendDialog')
|
||||
}
|
||||
|
||||
const handleResetConfirm = async (payload: { target: ListResetTarget; scope: ListResetScope }) => {
|
||||
void payload
|
||||
alert('List reset action callback placeholder.')
|
||||
const handleResetConfirm = async (payload: { target: ListFilterTarget; scope: ListResetScope }) => {
|
||||
const listFilter = buildTargetFilter(payload.target)
|
||||
await resetListMutation.mutateAsync({
|
||||
resetMode: payload.scope === 'result-and-history' ? ListResetMode.HIST : ListResetMode.ALL,
|
||||
listFilter,
|
||||
})
|
||||
await listSearchQuery.refetch()
|
||||
}
|
||||
|
||||
const handleUploadConfirm = async (file: File, validation: ValidationOption) => {
|
||||
void file
|
||||
void validation
|
||||
alert('List upload action callback placeholder.')
|
||||
const handleUploadConfirm = async (file: File, request: ListUploadRequest) => {
|
||||
const res = await uploadListExcelMutation.mutateAsync({ file, request })
|
||||
|
||||
if (res.hasErrorFile && res.errorFileBase64) {
|
||||
alert("업로드 중 오류가 발생하여 오류 파일을 다운로드합니다.");
|
||||
downloadBase64File(res.errorFileBase64, res.errorFileName ?? "error.xlsx", XLSX_MIME_TYPE);
|
||||
}
|
||||
else{
|
||||
alert(`${res.successCount}개의 리스트를 업로드했습니다.`);
|
||||
}
|
||||
|
||||
await listSearchQuery.refetch()
|
||||
}
|
||||
|
||||
const handleDownloadTemplate = async () => {
|
||||
alert('Template download callback placeholder.')
|
||||
if (!prjctIdx) {
|
||||
alert("프로젝트를 선택해주세요.")
|
||||
return
|
||||
}
|
||||
|
||||
const buffer = await downloadListExcelTemplateMutation.mutateAsync(prjctIdx)
|
||||
downloadArrayBuffer(buffer, `${prjctName} list-upload-template.xlsx`)
|
||||
}
|
||||
|
||||
const handleHeaderManageConfirm = async (rows: ListHeaderManageRow[]) => {
|
||||
void rows
|
||||
alert('Header manage action callback placeholder.')
|
||||
const handleHeaderManageConfirm = async (rows: listHeader[]) => {
|
||||
await updateListHeaderMutation.mutateAsync(rows)
|
||||
}
|
||||
|
||||
const handleFilterConfirm = async (rows: FilterRow[]) => {
|
||||
setFilterRows(rows)
|
||||
alert('Filter action callback placeholder.')
|
||||
}
|
||||
|
||||
const handleBatchConfirm = async (rows: BatchEditRow[]) => {
|
||||
setBatchRows(rows)
|
||||
alert('Batch edit action callback placeholder.')
|
||||
const updateContents = Object.fromEntries(rows.map((row) => [String(row.headerId), row.value]))
|
||||
await updateListMutation.mutateAsync({
|
||||
updateContents,
|
||||
listFilter: buildTargetFilter('filtered'),
|
||||
})
|
||||
await listSearchQuery.refetch()
|
||||
}
|
||||
|
||||
const handleDownloadConfirm = async (payload: { mode: ListDownloadMode; onlyFiltered: boolean }) => {
|
||||
void payload
|
||||
alert('Download action callback placeholder.')
|
||||
const handleDownloadConfirm = async (payload: ListDownloadPayload) => {
|
||||
const listFilter = buildTargetFilter(payload.target)
|
||||
|
||||
if (payload.mode === 'list') {
|
||||
const buffer = await downloadListMutation.mutateAsync(listFilter)
|
||||
downloadArrayBuffer(buffer, `${prjctName} list.xlsx`)
|
||||
return
|
||||
}
|
||||
|
||||
if (payload.mode === 'list-change-history') {
|
||||
const buffer = await downloadListUpdateHistoryMutation.mutateAsync(listFilter)
|
||||
downloadArrayBuffer(buffer, `${prjctName} update-history.xlsx`)
|
||||
return
|
||||
}
|
||||
|
||||
if (payload.mode === 'upload-file') {
|
||||
const buffer = await downloadListItemFileMutation.mutateAsync(listFilter)
|
||||
downloadArrayBuffer(buffer, `${prjctName} upload-files.zip`, 'application/zip')
|
||||
return
|
||||
}
|
||||
|
||||
const buffer = await downloadListEventHistoryMutation.mutateAsync({
|
||||
listFilter,
|
||||
resultCodeTypes: [ResultCodeType.CONTACT, ResultCodeType.INTERVIEW, ResultCodeType.SURVEY],
|
||||
searchBase: payload.contactHistoryType === 'latest' ? ListEventHistoryBase.LATEST : ListEventHistoryBase.ALL,
|
||||
dateRange: toDateTimeRange(payload.contactHistoryDateFrom, payload.contactHistoryDateTo),
|
||||
})
|
||||
downloadArrayBuffer(buffer, `${prjctName} contact-history.xlsx`)
|
||||
}
|
||||
|
||||
const handleMessageSendConfirm = async (payload: MessageSendPayload) => {
|
||||
@@ -253,55 +392,55 @@ const ListManagePage = () => {
|
||||
if (!mounted) return <LoadingOverlay force />
|
||||
|
||||
return (
|
||||
<div className="space-y-6 content-text-sm">
|
||||
<div className="space-y-6 text-sm">
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex flex-1 items-center gap-2 flex-wrap">
|
||||
<Button variant="destructive" className="content-text-base gap-2" onClick={() => showDialog('listResetDialog')}>
|
||||
<Button variant="destructive" className="text-base gap-2" onClick={() => showDialog('listResetDialog')}>
|
||||
<RotateCcw className="w-4 h-4" />
|
||||
리스트 초기화
|
||||
</Button>
|
||||
<Button className="content-text-base" onClick={() => showDialog('listHeaderManageDialog')}>
|
||||
<Button className="text-base" onClick={() => showDialog('listHeaderManageDialog')}>
|
||||
헤더 관리
|
||||
</Button>
|
||||
<Button className="content-text-base gap-2" onClick={() => showDialog('listUploadDialog')}>
|
||||
<Button className="text-base gap-2" onClick={() => showDialog('listUploadDialog')}>
|
||||
<Upload className="w-4 h-4" />
|
||||
리스트 업로드
|
||||
</Button>
|
||||
<Button className="content-text-base bg-excel gap-2" onClick={() => openDownloadDialog('list')}>
|
||||
<Button className="text-base bg-excel gap-2" onClick={() => openDownloadDialog('list')}>
|
||||
<Download className="w-4 h-4" />
|
||||
리스트
|
||||
</Button>
|
||||
<Button className="content-text-base bg-excel gap-2" onClick={() => openDownloadDialog('contact-history')}>
|
||||
<Button className="text-base bg-excel gap-2" onClick={() => openDownloadDialog('contact-history')}>
|
||||
<Download className="w-4 h-4" />
|
||||
컨택 이력
|
||||
</Button>
|
||||
<Button className="content-text-base bg-excel gap-2" onClick={() => openDownloadDialog('list-change-history')}>
|
||||
<Button className="text-base bg-excel gap-2" onClick={() => openDownloadDialog('list-change-history')}>
|
||||
<Download className="w-4 h-4" />
|
||||
리스트 변경 이력
|
||||
</Button>
|
||||
<Button className="content-text-base gap-2" onClick={() => openDownloadDialog('upload-file')}>
|
||||
<Button className="text-base gap-2" onClick={() => openDownloadDialog('upload-file')}>
|
||||
<Download className="w-4 h-4" />
|
||||
업로드 파일(.zip)
|
||||
</Button>
|
||||
</div>
|
||||
<Button className="content-text-base bg-blue gap-2" onClick={() => openMessageDialog('email')}>
|
||||
<Button className="text-base bg-blue gap-2" onClick={() => openMessageDialog('email')}>
|
||||
<Mail className="w-4 h-4" />
|
||||
이메일 발송
|
||||
</Button>
|
||||
<Button className="content-text-base bg-blue gap-2" onClick={() => openMessageDialog('sms')}>
|
||||
<Button className="text-base bg-blue gap-2" onClick={() => openMessageDialog('sms')}>
|
||||
<MessageSquareMore className="w-4 h-4" />
|
||||
문자 발송
|
||||
</Button>
|
||||
<Button className="content-text-base gap-2" onClick={() => showDialog('messageHistoryDialog')}>
|
||||
<Button className="text-base gap-2" onClick={() => showDialog('messageHistoryDialog')}>
|
||||
<FileClock className="w-4 h-4" />
|
||||
발송 이력
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex flex-1 items-center gap-2 flex-wrap">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<Input
|
||||
placeholder="SID ',' '~' 사용 가능"
|
||||
placeholder="Search SID"
|
||||
className="w-100 h-9 bg-white"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
@@ -336,9 +475,12 @@ const ListManagePage = () => {
|
||||
widthClassName="w-70"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
<Button className="content-text-lg" onClick={handleSearchClick}>
|
||||
<Button className="text-lg" onClick={handleSearchClick}>
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<Button type="button" variant="outline" className="gap-2" onClick={() => showDialog('listFilterDialog')}>
|
||||
<Funnel className="w-4 h-4" />
|
||||
필터
|
||||
@@ -354,18 +496,29 @@ const ListManagePage = () => {
|
||||
<DataTable<ListTableRow>
|
||||
columns={columns}
|
||||
data={viewList}
|
||||
getRowId={(row) => String(row.sid)}
|
||||
isClient={false}
|
||||
pageCount={pageCount}
|
||||
totalCount={totalCount}
|
||||
onPaginationChange={setPagination}
|
||||
onSortingChange={setSorting}
|
||||
selectMode="click-event"
|
||||
selectMode="multi"
|
||||
onRowSelectionChange={setSelectedRows}
|
||||
pageSizeOptions={[10, 20, 30, 50]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<ListResetDialog onConfirm={handleResetConfirm} />
|
||||
<ListUploadDialog onUpload={handleUploadConfirm} onDownloadTemplate={handleDownloadTemplate} uploadHistory={uploadHistoryMock} />
|
||||
<ListUploadDialog
|
||||
onUpload={handleUploadConfirm}
|
||||
onDownloadTemplate={handleDownloadTemplate}
|
||||
uploadHistory={uploadHistoryQuery.data ?? []}
|
||||
onDownloadHistory={async (item) => {
|
||||
const buffer = await downloadUploadHistoryFileMutation.mutateAsync(item.listUploadLogId)
|
||||
downloadArrayBuffer(buffer, item.fileName)
|
||||
}}
|
||||
headerRows={headerManageRows}
|
||||
/>
|
||||
<ListHeaderManageDialog rows={headerManageRows} onConfirm={handleHeaderManageConfirm} />
|
||||
<ListFilterDialog headerOptions={filterHeaderOptions} initialRows={filterRows} onConfirm={handleFilterConfirm} />
|
||||
<ListBatchEditDialog
|
||||
@@ -380,7 +533,7 @@ const ListManagePage = () => {
|
||||
templateOptions={messageTemplateMock}
|
||||
targetHeaderOptions={messageTargetHeaders}
|
||||
defaultSenderEmail="info@kric.com"
|
||||
defaultSenderName="Korea Research"
|
||||
defaultSenderName="코리아리서치"
|
||||
defaultSenderNumber="02-0000-0000"
|
||||
onConfirm={handleMessageSendConfirm}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'use client'
|
||||
'use client'
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import {Button} from "@/components/ui/button";
|
||||
@@ -10,11 +10,11 @@ import UserUpsertDialog from "@/components/dialog/UserUpsertDialog";
|
||||
import {UserInfoSaveRequest} from "@/types/user";
|
||||
import UserUploadDialog from "@/components/dialog/UserUploadDialog";
|
||||
import {useDialog} from "@/hooks/useDialog";
|
||||
import {downloadBase64File, downloadFile} from "@/lib/utils";
|
||||
import { downloadBase64File, downloadFile, XLSX_MIME_TYPE } from "@kri/common/browser";
|
||||
import {KriMultiSelect} from "@/components/common/KriAutoComplete";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import {MultiSelectOption} from "@/components/ui/multi-select";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
import {DEFAULT_COMPANY_NAME, EXTERNAL_USER_ROLE} from "@/const/userConst";
|
||||
import {Upload} from "lucide-react";
|
||||
@@ -101,9 +101,9 @@ const UserManagePage = () => {
|
||||
await upsertMutation.mutateAsync({ mode: dialogMode, data });
|
||||
|
||||
if (dialogMode === "create") {
|
||||
alert("등록 됐습니다.");
|
||||
alert("등록되었습니다.");
|
||||
} else {
|
||||
alert("수정 됐습니다.");
|
||||
alert("수정되었습니다.");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -117,17 +117,18 @@ const UserManagePage = () => {
|
||||
if (!confirm("정말 삭제하시겠습니까?")) return;
|
||||
|
||||
await deleteMutation.mutateAsync(userId);
|
||||
alert("삭제 됐습니다.");
|
||||
alert("삭제되었습니다.");
|
||||
};
|
||||
|
||||
const uploadFile = async (file: File) => {
|
||||
const res = await uploadMutation.mutateAsync(file);
|
||||
|
||||
if (res.hasErrorFile && res.errorFileBase64) {
|
||||
downloadBase64File(res.errorFileBase64, res.errorFileName ?? "error.xlsx");
|
||||
alert("업로드 중 오류가 발생하여 오류 파일을 다운로드합니다.");
|
||||
downloadBase64File(res.errorFileBase64, res.errorFileName ?? "error.xlsx", XLSX_MIME_TYPE);
|
||||
}
|
||||
else{
|
||||
alert(`${res.successCount}개의 계정을 생성했습니다.`);
|
||||
alert(`${res.successCount}개의 계정이 생성되었습니다.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -138,8 +139,8 @@ const UserManagePage = () => {
|
||||
const blob = new Blob([buffer], {
|
||||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
});
|
||||
downloadFile(blob, "사용자 업로드 양식.xlsx");
|
||||
alert("다운로드 됐습니다.");
|
||||
downloadFile(blob, "사용자_업로드_양식.xlsx");
|
||||
alert("다운로드되었습니다.");
|
||||
} else {
|
||||
console.log("빈 파일입니다.");
|
||||
}
|
||||
@@ -163,13 +164,13 @@ const UserManagePage = () => {
|
||||
if (!mounted) return <LoadingOverlay force />;
|
||||
|
||||
return (
|
||||
<div className="space-y-6 content-text-sm">
|
||||
<BodyTitle titleText={"계정 관리"}/>
|
||||
<div className="space-y-6 text-sm">
|
||||
<BodyTitle titleText={"User management"}/>
|
||||
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex flex-1 items-center gap-2">
|
||||
<Input
|
||||
placeholder="면접원 ID Or 면접원 이름"
|
||||
placeholder="면접원 ID 또는 면접원 이름"
|
||||
className="w-70 h-9 bg-white"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
@@ -197,14 +198,14 @@ const UserManagePage = () => {
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
className="content-text-lg"
|
||||
className="text-lg"
|
||||
onClick={handleCreateClick}
|
||||
>
|
||||
면접원 등록
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => showDialog('userUploadDialog')}
|
||||
className="gap-2 bg-excel content-text-lg"
|
||||
className="gap-2 bg-excel text-lg"
|
||||
>
|
||||
<Upload className="w-4 h-4" />
|
||||
면접원 일괄 등록
|
||||
|
||||
@@ -15,7 +15,7 @@ const EmailTemplatePage = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6 content-text-sm">
|
||||
<div className="space-y-6 text-sm">
|
||||
<MessageTemplate pageTitle={"이메일 템플릿 관리"} defaultTemplate={defaultEmailTemplate}/>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ const SmsTemplatePage = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6 content-text-sm">
|
||||
<div className="space-y-6 text-sm">
|
||||
<MessageTemplate pageTitle="문자 템플릿 관리" defaultTemplate={defaultSmsTemplate}/>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import {useDialog} from "@/hooks/useDialog";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import {useSelectedProject} from "@/hooks/useSelectedProject";
|
||||
import {SelectedProject} from "@/store/jotai/project";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
import {FW_USER_ROLE} from "@/const/userConst";
|
||||
import {useItrntUserList} from "@/hooks/useItrntUserList";
|
||||
@@ -144,7 +144,7 @@ const MainPage = () => {
|
||||
if (!mounted || isLoading) return <LoadingOverlay force />;
|
||||
|
||||
return (
|
||||
<div className="space-y-6 content-text-sm">
|
||||
<div className="space-y-6 text-sm">
|
||||
<BodyTitle titleText={"프로젝트"}/>
|
||||
|
||||
<div className="flex gap-2 items-center">
|
||||
@@ -192,14 +192,14 @@ const MainPage = () => {
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
<Button
|
||||
className="content-text-lg"
|
||||
className="text-lg"
|
||||
onClick={handleSearchClick}
|
||||
>
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
<Button
|
||||
className="content-text-lg"
|
||||
className="text-lg"
|
||||
onClick={handleCreateClick}
|
||||
>
|
||||
프로젝트 등록
|
||||
@@ -231,4 +231,4 @@ const MainPage = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export default MainPage;
|
||||
export default MainPage;
|
||||
|
||||
@@ -11,7 +11,7 @@ import {Tabs, TabsContent, TabsList, TabsTrigger} from '@/components/ui/tabs'
|
||||
import {KriMultiSelect, KriSingleSelect} from '@/components/common/KriAutoComplete'
|
||||
import {useDialog} from '@/hooks/useDialog'
|
||||
import ResultCodeDialog from '@/components/dialog/ResultCodeDialog'
|
||||
import {useMounted} from '@/hooks/useMounted'
|
||||
import { useDebouncedValue, useMounted } from "@kri/common/hooks";
|
||||
import {LoadingOverlay} from '@/components/common/LoadingOverlay'
|
||||
import {
|
||||
ProjectInfo, ProjectUpdateRequest, ResultCode,
|
||||
@@ -27,7 +27,6 @@ import {MultiSelectOption} from "@/components/ui/multi-select";
|
||||
import {FW_TEAM} from "@/const/userConst";
|
||||
import {useItrntUserList} from "@/hooks/useItrntUserList";
|
||||
import {useSelectedProject} from "@/hooks/useSelectedProject";
|
||||
import {useDebouncedValue} from "@/hooks/useDebouncedValue";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import {KriEditor} from "@/components/kri-editor";
|
||||
import {useRouter} from "next/navigation";
|
||||
@@ -257,16 +256,16 @@ const ProjectInfoPage = () => {
|
||||
|
||||
{/* 1. 기본 정보 */}
|
||||
<div className="border rounded-lg p-6 space-y-5 bg-white mt-6">
|
||||
<h3 className="content-text-xl font-semibold">프로젝트 기본 정보</h3>
|
||||
<h3 className="text-xl font-semibold">프로젝트 기본 정보</h3>
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">프로젝트 코드</Label>
|
||||
<Label className="text-base">프로젝트 코드</Label>
|
||||
<Input value={projectInfo.prjctCd || ''} disabled className="bg-gray-100 h-9" />
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-[1fr_auto] gap-3 items-end">
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">진행 상태</Label>
|
||||
<Label className="text-base">진행 상태</Label>
|
||||
<RadioGroup
|
||||
value={String(projectInfo.prjctStatus ?? ProjectStatus.WAITING)}
|
||||
onValueChange={(v) => handleChange('prjctStatus', Number(v) as ProjectStatus)}
|
||||
@@ -277,7 +276,7 @@ const ProjectInfoPage = () => {
|
||||
return (
|
||||
<div key={s} className="flex items-center space-x-2">
|
||||
<RadioGroupItem value={String(s)} id={id} />
|
||||
<Label htmlFor={id} className="font-normal cursor-pointer content-text-base">
|
||||
<Label htmlFor={id} className="font-normal cursor-pointer text-base">
|
||||
{PROJECT_STATUS_LABEL[s]}
|
||||
</Label>
|
||||
</div>
|
||||
@@ -286,13 +285,13 @@ const ProjectInfoPage = () => {
|
||||
</RadioGroup>
|
||||
</div>
|
||||
|
||||
<Button onClick={handleResultCodeClick} className="h-9 content-text-base whitespace-nowrap">
|
||||
<Button onClick={handleResultCodeClick} className="h-9 text-base whitespace-nowrap">
|
||||
결과 코드 설정
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">
|
||||
<Label className="text-base">
|
||||
프로젝트 명<span className="text-red-500 ml-1">*</span>
|
||||
</Label>
|
||||
<Input
|
||||
@@ -305,7 +304,7 @@ const ProjectInfoPage = () => {
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">담당 그룹</Label>
|
||||
<Label className="text-base">담당 그룹</Label>
|
||||
<KriSingleSelect
|
||||
items={deptArray}
|
||||
value={projectInfo.ownerDept || ''}
|
||||
@@ -317,7 +316,7 @@ const ProjectInfoPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">담당 실사</Label>
|
||||
<Label className="text-base">담당 실사</Label>
|
||||
<KriSingleSelect
|
||||
items={fwArray}
|
||||
value={projectInfo.ownerFw || ''}
|
||||
@@ -334,7 +333,7 @@ const ProjectInfoPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="border rounded-lg p-6 space-y-4 bg-white mt-3">
|
||||
<h3 className="content-text-xl font-semibold">외주사</h3>
|
||||
<h3 className="text-xl font-semibold">외주사</h3>
|
||||
<KriMultiSelect
|
||||
items={outsourceOptionArray}
|
||||
value={outsourceUserArray}
|
||||
@@ -349,7 +348,7 @@ const ProjectInfoPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="border rounded-lg p-6 space-y-4 bg-white mt-3">
|
||||
<h3 className="content-text-xl font-semibold">설문 연동</h3>
|
||||
<h3 className="text-xl font-semibold">설문 연동</h3>
|
||||
|
||||
<RadioGroup
|
||||
value={String(projectInfo.surveyTy ?? SurveyType.NONE)}
|
||||
@@ -361,7 +360,7 @@ const ProjectInfoPage = () => {
|
||||
return (
|
||||
<div key={t} className="flex items-center space-x-2">
|
||||
<RadioGroupItem value={String(t)} id={id} />
|
||||
<Label htmlFor={id} className="font-normal cursor-pointer content-text-base">
|
||||
<Label htmlFor={id} className="font-normal cursor-pointer text-base">
|
||||
{SURVEY_TYPE_LABEL[t]}
|
||||
</Label>
|
||||
</div>
|
||||
@@ -371,7 +370,7 @@ const ProjectInfoPage = () => {
|
||||
|
||||
{(projectInfo.surveyTy === SurveyType.KON || projectInfo.surveyTy === SurveyType.KIWI) && (
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">{SURVEY_TYPE_LABEL[projectInfo.surveyTy]} 프로젝트</Label>
|
||||
<Label className="text-base">{SURVEY_TYPE_LABEL[projectInfo.surveyTy]} 프로젝트</Label>
|
||||
<KriSingleSelect
|
||||
items={surveyProjectArray}
|
||||
value={projectInfo.surveyPrjctCd || ''}
|
||||
@@ -388,7 +387,7 @@ const ProjectInfoPage = () => {
|
||||
)}
|
||||
{projectInfo.surveyTy !== SurveyType.NONE && (
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">설문 URL</Label>
|
||||
<Label className="text-base">설문 URL</Label>
|
||||
<Input
|
||||
value={projectInfo.surveyUrl || ''}
|
||||
onChange={(e) => handleChange('surveyUrl', e.target.value)}
|
||||
@@ -412,19 +411,19 @@ const ProjectInfoPage = () => {
|
||||
|
||||
<div className="grid gap-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">시작:</Label>
|
||||
<Label className="w-24 text-base">시작:</Label>
|
||||
<Input value={externalUrls.redirect.start} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">완료:</Label>
|
||||
<Label className="w-24 text-base">완료:</Label>
|
||||
<Input value={externalUrls.redirect.complete} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">스크린 아웃:</Label>
|
||||
<Label className="w-24 text-base">스크린 아웃:</Label>
|
||||
<Input value={externalUrls.redirect.screen} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">쿼터 풀:</Label>
|
||||
<Label className="w-24 text-base">쿼터 풀:</Label>
|
||||
<Input value={externalUrls.redirect.quota} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -437,19 +436,19 @@ const ProjectInfoPage = () => {
|
||||
|
||||
<div className="grid gap-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">시작 API:</Label>
|
||||
<Label className="w-24 text-base">시작 API:</Label>
|
||||
<Input value={externalUrls.api.start} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">완료 API:</Label>
|
||||
<Label className="w-24 text-base">완료 API:</Label>
|
||||
<Input value={externalUrls.api.complete} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">스크린 API:</Label>
|
||||
<Label className="w-24 text-base">스크린 API:</Label>
|
||||
<Input value={externalUrls.api.screen} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">쿼터 API:</Label>
|
||||
<Label className="w-24 text-base">쿼터 API:</Label>
|
||||
<Input value={externalUrls.api.quota} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -463,7 +462,7 @@ const ProjectInfoPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="border rounded-lg p-6 space-y-4 bg-white mt-3">
|
||||
<h3 className="content-text-xl font-semibold">기타 옵션</h3>
|
||||
<h3 className="text-xl font-semibold">기타 옵션</h3>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
@@ -472,7 +471,7 @@ const ProjectInfoPage = () => {
|
||||
checked={projectInfo.ff || false}
|
||||
onCheckedChange={(checked) => handleChange('ff', checked === true)}
|
||||
/>
|
||||
<Label htmlFor="ff" className="font-normal cursor-pointer content-text-base">
|
||||
<Label htmlFor="ff" className="font-normal cursor-pointer text-base">
|
||||
현장 면접 진행
|
||||
</Label>
|
||||
</div>
|
||||
@@ -483,7 +482,7 @@ const ProjectInfoPage = () => {
|
||||
checked={projectInfo.useContactSenario || false}
|
||||
onCheckedChange={(checked) => handleChange('useContactSenario', checked === true)}
|
||||
/>
|
||||
<Label htmlFor="useContactSenario" className="font-normal cursor-pointer content-text-base">
|
||||
<Label htmlFor="useContactSenario" className="font-normal cursor-pointer text-base">
|
||||
컨택 시나리오
|
||||
</Label>
|
||||
</div>
|
||||
@@ -512,12 +511,12 @@ const ProjectInfoPage = () => {
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button
|
||||
variant="destructive"
|
||||
className="w-32 h-10 content-text-base"
|
||||
className="w-32 h-10 text-base"
|
||||
onClick={handleDeleteClick}
|
||||
>
|
||||
삭제
|
||||
</Button>
|
||||
<Button onClick={handleSubmit} className="w-32 h-10 content-text-base">
|
||||
<Button onClick={handleSubmit} className="w-32 h-10 text-base">
|
||||
저장
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
"use client";
|
||||
"use client";
|
||||
|
||||
import Image from "next/image";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Card, CardContent, CardHeader} from "@/components/ui/card";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import React, {useEffect, useRef, useState} from "react";
|
||||
import React, { Suspense, useEffect, useRef, useState } from "react";
|
||||
import {useRouter, useSearchParams} from "next/navigation";
|
||||
import { useStorage } from "@/hooks/useStorage"
|
||||
import { StorageKeys } from "@/store/storage/storage-keys";
|
||||
import {apiError} from "@/lib/http-util";
|
||||
import {NONE_HTTP_ERROR} from "@/const/commonConst";
|
||||
import {apiError} from "@kri/common/http";
|
||||
import {NONE_HTTP_ERROR} from "@kri/common/http";
|
||||
import {useLoginMutation} from "@/query/auth";
|
||||
import {useInternalInfoQuery} from "@/query/internal";
|
||||
|
||||
const LoginPage = () => {
|
||||
const LoginPageContent = () => {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const typeParam = searchParams.get("type") ?? "";
|
||||
|
||||
const loginMutation = useLoginMutation();
|
||||
const internalInfoQuery = useInternalInfoQuery();
|
||||
// TODO: 받은 데이터 확인
|
||||
console.log(internalInfoQuery.data);
|
||||
|
||||
const { get: getSeatNumberStorage } = useStorage(StorageKeys.SeatNumber);
|
||||
|
||||
@@ -32,15 +36,17 @@ const LoginPage = () => {
|
||||
const seatNumberInputRef = useRef<HTMLInputElement | null>(null);
|
||||
|
||||
const tryLogin = async () => {
|
||||
if (!userId) return alert("아이디를 입력해 주세요");
|
||||
if (!userPw) return alert("PW를 입력해 주세요");
|
||||
if (loginType === "call" && !seatNum) return alert("자리번호를 입력해 주세요");
|
||||
if (!userId) return alert("Please enter ID.");
|
||||
if (!userPw) return alert("Please enter password.");
|
||||
if (loginType === "call" && !seatNum) return alert("Please enter seat number.");
|
||||
|
||||
setError(null);
|
||||
try {
|
||||
await loginMutation.mutateAsync({ userId, userPw, seatNum, loginType });
|
||||
} catch (e) {
|
||||
const err = apiError(e);
|
||||
const err = apiError(e, {
|
||||
fallbackMessage: "Login failed.",
|
||||
});
|
||||
if (err.status === 401 || err.status === 403) setError("아이디 또는 비밀번호를 다시 확인해주세요.");
|
||||
else if (err.code === NONE_HTTP_ERROR) setError("알 수 없는 오류가 발생했습니다. 잠시 후 다시 시도해주세요.");
|
||||
else setError(`로그인에 실패했습니다. (${err.message})`);
|
||||
@@ -101,7 +107,7 @@ const LoginPage = () => {
|
||||
<Image
|
||||
src="/kri_logo.png" // public/kri_logo.png
|
||||
alt="KRI 로고"
|
||||
width={500} // 원하는 크기로 줄이기
|
||||
width={500}
|
||||
height={500}
|
||||
className="object-contain ml-10"
|
||||
priority
|
||||
@@ -118,7 +124,7 @@ const LoginPage = () => {
|
||||
name="id"
|
||||
type="text"
|
||||
required
|
||||
placeholder="아이디를 입력하세요"
|
||||
placeholder="Enter ID"
|
||||
value={userId}
|
||||
onChange={(e) => setUserId(e.currentTarget.value)}
|
||||
onKeyDown={handleIdKeyDown}
|
||||
@@ -133,7 +139,7 @@ const LoginPage = () => {
|
||||
type="password"
|
||||
autoComplete="current-password"
|
||||
required
|
||||
placeholder="PW를 입력하세요"
|
||||
placeholder="Enter password"
|
||||
value={userPw}
|
||||
onChange={(e) => setUserPw(e.currentTarget.value)}
|
||||
onKeyDown={handlePwKeyDown}
|
||||
@@ -148,7 +154,7 @@ const LoginPage = () => {
|
||||
id="seatNum"
|
||||
name="seatNum"
|
||||
type="text"
|
||||
placeholder="자리번호를 입력하세요"
|
||||
placeholder="Enter seat number"
|
||||
value={seatNum}
|
||||
onChange={(e) => setSeatNum(e.currentTarget.value)}
|
||||
onKeyDown={handleSeatNumberKeyDown}
|
||||
@@ -183,4 +189,10 @@ const LoginPage = () => {
|
||||
);
|
||||
}
|
||||
|
||||
const LoginPage = () => (
|
||||
<Suspense fallback={null}>
|
||||
<LoginPageContent />
|
||||
</Suspense>
|
||||
);
|
||||
|
||||
export default LoginPage;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {createContactApi} from "@/lib/server-api";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createContactApi} from "@/lib/http-server";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
@@ -48,4 +48,4 @@ export const PUT = async (req: NextRequest, context: RouteContext) => {
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
117
src/app/api/external/[[...slug]]/route.ts
vendored
117
src/app/api/external/[[...slug]]/route.ts
vendored
@@ -1,41 +1,94 @@
|
||||
//외부 설문에 뎐동 되는 API
|
||||
// External survey event API.
|
||||
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {createContactApi} from "@/lib/server-api";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {getClientIp} from "@/lib/utils";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { RouteContext } from "@/types/common";
|
||||
import { errorToResponse } from "@kri/common/http";
|
||||
import { getClientIp } from "@kri/common/server";
|
||||
import {
|
||||
EXTERNAL_ACTION_CODE_BY_SLUG,
|
||||
ExternalAction,
|
||||
ExternalEntryType,
|
||||
ExternalEventBody,
|
||||
} from "@/types/external";
|
||||
import {createContactApi} from "@/lib/http-server";
|
||||
|
||||
export const POST = async (req: NextRequest, context: RouteContext) => {
|
||||
const getHeader = (headers: Headers, name: string): string | null => {
|
||||
const value = headers.get(name);
|
||||
return value && value.trim().length > 0 ? value : null;
|
||||
};
|
||||
|
||||
const getEntryType = (headers: Headers): ExternalEntryType => {
|
||||
return getHeader(headers, "x-entry-type") === "redirect" ? "redirect" : "api";
|
||||
};
|
||||
|
||||
const toExternalAction = (value: string): ExternalAction | null => {
|
||||
return value in EXTERNAL_ACTION_CODE_BY_SLUG ? (value as ExternalAction) : null;
|
||||
};
|
||||
|
||||
const toRequiredNumber = (value: string): number | null => {
|
||||
const parsed = Number(value);
|
||||
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
|
||||
};
|
||||
|
||||
const buildExternalEventBody = (
|
||||
req: NextRequest,
|
||||
action: ExternalAction,
|
||||
prjctIdx: number,
|
||||
sid: number,
|
||||
): ExternalEventBody => {
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const h = req.headers;
|
||||
const actionCode = EXTERNAL_ACTION_CODE_BY_SLUG[action];
|
||||
|
||||
return {
|
||||
actionCode,
|
||||
prjctIdx,
|
||||
sid,
|
||||
meta: {
|
||||
entryType: getEntryType(h),
|
||||
action,
|
||||
actionCode,
|
||||
pid: String(prjctIdx),
|
||||
sid: String(sid),
|
||||
remoteAddr: getHeader(h, "x-orig-ip") || getClientIp(req),
|
||||
uri: getHeader(h, "x-orig-uri") || pathname,
|
||||
url: getHeader(h, "x-orig-url") || req.url,
|
||||
userAgent: getHeader(h, "x-orig-user-agent") || getHeader(h, "user-agent"),
|
||||
referer: getHeader(h, "x-orig-referer") || getHeader(h, "referer"),
|
||||
origin: getHeader(h, "x-orig-origin") || getHeader(h, "origin"),
|
||||
xForwardedFor: getHeader(h, "x-orig-x-forwarded-for") || getHeader(h, "x-forwarded-for"),
|
||||
forwarded: getHeader(h, "x-orig-forwarded") || getHeader(h, "forwarded"),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const handleExternalEvent = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
const { searchParams } = new URL(req.url);
|
||||
const {slug = []} = await context.params;
|
||||
const [action] = slug;
|
||||
const { searchParams } = req.nextUrl;
|
||||
const { slug = [] } = await context.params;
|
||||
const action = toExternalAction((slug[0] ?? "").toLowerCase());
|
||||
|
||||
const sid = (searchParams.get("sid") ?? "").trim();
|
||||
const allowAction = ["start", "complete", "screen", "quota"]
|
||||
if(slug.length === 1 && allowAction.includes(action.toLowerCase()) && sid.length > 0){
|
||||
const contactApi = await createContactApi();
|
||||
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const h = req.headers;
|
||||
const log = {
|
||||
remoteAddr: h.get("x-orig-ip") || getClientIp(req),
|
||||
uri: h.get("x-orig-uri") || pathname,
|
||||
url: h.get("x-orig-url") || req.url,
|
||||
userAgent: h.get("x-orig-user-agent") || h.get("user-agent"),
|
||||
referer: h.get("x-orig-referer") || h.get("referer"),
|
||||
origin: h.get("x-orig-origin") || h.get("origin"),
|
||||
xForwardedFor: h.get("x-forwarded-for"),
|
||||
forwarded: h.get("forwarded"),
|
||||
};
|
||||
|
||||
//Todo 수정 필요
|
||||
return new NextResponse(null, { status: 204 });
|
||||
if (slug.length !== 1 || !action) {
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
const prjctIdx = toRequiredNumber((searchParams.get("pid") ?? "").trim());
|
||||
const sid = toRequiredNumber((searchParams.get("sid") ?? "").trim());
|
||||
|
||||
if (!prjctIdx || !sid) {
|
||||
return NextResponse.json({ message: "pid와 sid는 필수입니다." }, { status: 400 });
|
||||
}
|
||||
|
||||
const body = buildExternalEventBody(req, action, prjctIdx, sid);
|
||||
const contactApi = await createContactApi();
|
||||
|
||||
await contactApi.post(`/list-hist/survey`, body);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const GET = handleExternalEvent;
|
||||
export const POST = handleExternalEvent;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {createContactApi, createIntranetApi} from "@/lib/server-api";
|
||||
import {IntranetProjectSearchResponse, ProjectInfo, ProjectOwnerResponse} from "@/types/project";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createIntranetApi} from "@/lib/http-server";
|
||||
import {IntranetProjectSearchResponse} from "@/types/project";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
import {ItrntUserInfo} from "@/types/user";
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
@@ -32,4 +32,4 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {createKartApi} from "@/lib/server-api";
|
||||
import {createKartApi} from "@/lib/http-server";
|
||||
import {KonKiwiProjectInfo} from "@/types/project";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
@@ -25,4 +25,4 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {PageResponse, RouteContext} from "@/types/common";
|
||||
import {createContactApi} from "@/lib/server-api";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import type {PageResponse} from "@kri/common";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {createContactApi} from "@/lib/http-server";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
import {listHeader, ListSearchRequest, ListSearchWithFullResult} from "@/types/list";
|
||||
|
||||
const excelHeaders = {
|
||||
"Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
};
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
@@ -17,6 +22,11 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "upload-history") {
|
||||
const result = await contactApi.get(`/list/excel/upload-history/${slug[1]}`);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
@@ -45,8 +55,109 @@ export const POST = async (req: NextRequest, context: RouteContext) => {
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "excel-template") {
|
||||
const prjctIdx = slug[1];
|
||||
if (!prjctIdx) {
|
||||
return NextResponse.json({ message: "prjctIdx 파라미터가 없습니다." }, { status: 400 });
|
||||
}
|
||||
|
||||
const result = await contactApi.post<ArrayBuffer>(
|
||||
`/list/excel/template/${prjctIdx}`,
|
||||
undefined,
|
||||
{ expectBinary: true }
|
||||
);
|
||||
|
||||
return new NextResponse(result, {
|
||||
status: 200,
|
||||
headers: {
|
||||
...excelHeaders,
|
||||
"Content-Disposition": 'attachment; filename="list_upload_template.xlsx"',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (action === "excel-upload") {
|
||||
const form = await req.formData();
|
||||
const result = await contactApi.postForm(`/list/excel/upload/${slug[1]}`, form);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "excel-download") {
|
||||
const body = await req.json().catch(() => null);
|
||||
const result = await contactApi.post<ArrayBuffer>(`/list/excel/download/${slug[1]}`, body, { expectBinary: true });
|
||||
return new NextResponse(result, { status: 200, headers: excelHeaders });
|
||||
}
|
||||
|
||||
if (action === "excel-download-update") {
|
||||
const body = await req.json().catch(() => null);
|
||||
const result = await contactApi.post<ArrayBuffer>(`/list/excel/download/update/${slug[1]}`, body, {
|
||||
expectBinary: true,
|
||||
});
|
||||
return new NextResponse(result, { status: 200, headers: excelHeaders });
|
||||
}
|
||||
|
||||
if (action === "event-history-download") {
|
||||
const body = await req.json().catch(() => null);
|
||||
const result = await contactApi.post<ArrayBuffer>(`/list-hist/excel/download/event/${slug[1]}`, body, {
|
||||
expectBinary: true,
|
||||
});
|
||||
return new NextResponse(result, { status: 200, headers: excelHeaders });
|
||||
}
|
||||
|
||||
if (action === "item-file-download") {
|
||||
const body = await req.json().catch(() => null);
|
||||
const result = await contactApi.post<ArrayBuffer>(`/list/item-file/download/${slug[1]}`, body, {
|
||||
expectBinary: true,
|
||||
});
|
||||
return new NextResponse(result, { status: 200, headers: { "Content-Type": "application/zip" } });
|
||||
}
|
||||
|
||||
if (action === "upload-history-file") {
|
||||
const result = await contactApi.post<ArrayBuffer>(
|
||||
`/list/excel/upload-history/file/${slug[1]}/${slug[2]}`,
|
||||
undefined,
|
||||
{ expectBinary: true },
|
||||
);
|
||||
return new NextResponse(result, { status: 200, headers: excelHeaders });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const PATCH = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
const [action] = slug;
|
||||
const body = await req.json().catch(() => null);
|
||||
const contactApi = await createContactApi();
|
||||
|
||||
if (action === "header") {
|
||||
await contactApi.patch(`/list-header/${slug[1]}`, body);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
}
|
||||
|
||||
if (action === "update") {
|
||||
const result = await contactApi.patch<number>(`/list/update/${slug[1]}`, body);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const DELETE = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
const body = await req.json().catch(() => null);
|
||||
const contactApi = await createContactApi();
|
||||
const result = await contactApi.del<number>(`/list/${slug[0]}`, { json: body });
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import {LoginRequest, LoginUser} from "@/types/auth";
|
||||
import {serverEnv} from "@/lib/env.server";
|
||||
import {createContactApi} from "@/lib/server-api";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createContactApi} from "@/lib/http-server";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
import {CookieKeys} from "@/store/cookie/cookie-keys";
|
||||
|
||||
//실제 Backend
|
||||
//?ㅼ젣 Backend
|
||||
type LoginResponse = {
|
||||
accessToken: string;
|
||||
user: LoginUser;
|
||||
@@ -18,16 +19,16 @@ export const POST = async (req: NextRequest) => {
|
||||
const result = await contactApi.post<LoginResponse>("/auth/login", body);
|
||||
|
||||
const res = NextResponse.json(result.user, { status: 200 });
|
||||
res.cookies.set("access_token", result.accessToken, {
|
||||
res.cookies.set(CookieKeys.AuthToken, result.accessToken, {
|
||||
httpOnly: true,
|
||||
secure: serverEnv.ENV === "prod",
|
||||
sameSite: "lax",
|
||||
path: "/",
|
||||
maxAge: 24 * 60 * 60, // 24시간
|
||||
maxAge: 24 * 60 * 60, // 24?쒓컙
|
||||
});
|
||||
|
||||
return res;
|
||||
} catch (error : unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import {serverEnv} from "@/lib/env.server";
|
||||
import {createContactApi} from "@/lib/server-api";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createContactApi} from "@/lib/http-server";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {CookieKeys} from "@/store/cookie/cookie-keys";
|
||||
|
||||
export async function POST(
|
||||
req: NextRequest,
|
||||
@@ -21,7 +22,7 @@ export async function POST(
|
||||
await contactApi.post<boolean>(url);
|
||||
const res = NextResponse.json({ ok: true });
|
||||
|
||||
res.cookies.set("access_token", "", {
|
||||
res.cookies.set(CookieKeys.AuthToken, "", {
|
||||
httpOnly: true,
|
||||
secure: serverEnv.ENV === "prod",
|
||||
sameSite: "lax",
|
||||
@@ -33,4 +34,4 @@ export async function POST(
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {createNotihubApi} from "@/lib/server-api";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createNotihubApi} from "@/lib/http-server";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
import {Template, TemplateSummary} from "@/types/messageTemplate";
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
@@ -102,4 +102,4 @@ export const PATCH = async (req: NextRequest, context: RouteContext) => {
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {createContactApi, createIntranetApi} from "@/lib/server-api";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {PageResponse, RouteContext} from "@/types/common";
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {createContactApi, createIntranetApi} from "@/lib/http-server";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
import type {PageResponse} from "@kri/common";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {ProjectInfo, ProjectListRequest, ProjectOwnerResponse} from "@/types/project";
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
@@ -186,4 +187,4 @@ export const DELETE = async (req: NextRequest, context: RouteContext) => {
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {createContactApi} from "@/lib/server-api";
|
||||
import {createContactApi} from "@/lib/http-server";
|
||||
import {ProjectInfo, ProjectOwnerResponse, ResultCode} from "@/types/project";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
@@ -20,4 +20,4 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {createContactApi} from "@/lib/server-api";
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {createContactApi} from "@/lib/http-server";
|
||||
import {RoleInfo} from "@/types/role";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
import {RouteContext} from "@/types/common";
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
@@ -19,4 +19,4 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { createContactApi } from "@/lib/server-api";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { createContactApi } from "@/lib/http-server";
|
||||
import {ExcelUploadResult, UserInfo} from "@/types/user";
|
||||
import {DataVerification, RouteContext} from "@/types/common";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
|
||||
@@ -4,113 +4,127 @@
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-ring: var(--ring);
|
||||
--color-input: var(--input);
|
||||
--color-border: var(--border);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-card: var(--card);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
/* --content-font-size 배율 기반 font-size 스케일 (기본 text-* 유틸을 그대로 대체) */
|
||||
--font-size-xs: calc(var(--content-font-size) * 0.75);
|
||||
--font-size-sm: calc(var(--content-font-size) * 0.875);
|
||||
--font-size-base: var(--content-font-size);
|
||||
--font-size-lg: calc(var(--content-font-size) * 1.125);
|
||||
--font-size-xl: calc(var(--content-font-size) * 1.25);
|
||||
--font-size-2xl: calc(var(--content-font-size) * 1.5);
|
||||
--font-size-3xl: calc(var(--content-font-size) * 1.875);
|
||||
--font-size-4xl: calc(var(--content-font-size) * 2.25);
|
||||
--font-size-5xl: calc(var(--content-font-size) * 3);
|
||||
--font-size-6xl: calc(var(--content-font-size) * 3.75);
|
||||
--font-size-7xl: calc(var(--content-font-size) * 4.5);
|
||||
--font-size-8xl: calc(var(--content-font-size) * 6);
|
||||
--font-size-9xl: calc(var(--content-font-size) * 8);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-ring: var(--ring);
|
||||
--color-input: var(--input);
|
||||
--color-border: var(--border);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-card: var(--card);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
}
|
||||
|
||||
:root {
|
||||
--radius: 0.625rem;
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
--content-font-size: 14px;
|
||||
--radius: 0.625rem;
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
--content-font-size: 14px;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
}
|
||||
|
||||
.bg-excel {
|
||||
@@ -127,80 +141,21 @@
|
||||
background-color: var(--color-blue-700);
|
||||
}
|
||||
|
||||
/* 배율별 유틸 클래스 */
|
||||
.content-text-xs {
|
||||
font-size: calc(var(--content-font-size) * 0.75);
|
||||
}
|
||||
|
||||
.content-text-sm {
|
||||
font-size: calc(var(--content-font-size) * 0.875);
|
||||
}
|
||||
|
||||
.content-text-base {
|
||||
font-size: var(--content-font-size);
|
||||
}
|
||||
|
||||
.content-text-lg {
|
||||
font-size: calc(var(--content-font-size) * 1.125);
|
||||
}
|
||||
|
||||
.content-text-xl {
|
||||
font-size: calc(var(--content-font-size) * 1.25);
|
||||
}
|
||||
|
||||
.content-text-2xl {
|
||||
font-size: calc(var(--content-font-size) * 1.5);
|
||||
}
|
||||
|
||||
.content-text-3xl {
|
||||
font-size: calc(var(--content-font-size) * 1.875);
|
||||
}
|
||||
|
||||
.content-text-4xl {
|
||||
font-size: calc(var(--content-font-size) * 2.25);
|
||||
}
|
||||
|
||||
@layer utilities {
|
||||
.placeholder-content-text-xs::placeholder {
|
||||
font-size: calc(var(--content-font-size) * 0.75);
|
||||
}
|
||||
|
||||
.placeholder-content-text-sm::placeholder {
|
||||
font-size: calc(var(--content-font-size) * 0.875);
|
||||
}
|
||||
|
||||
.placeholder-content-text-base::placeholder {
|
||||
font-size: var(--content-font-size);
|
||||
}
|
||||
|
||||
.placeholder-content-text-lg::placeholder {
|
||||
font-size: calc(var(--content-font-size) * 1.125);
|
||||
}
|
||||
|
||||
.placeholder-content-text-xl::placeholder {
|
||||
font-size: calc(var(--content-font-size) * 1.25);
|
||||
}
|
||||
|
||||
.placeholder-content-text-2xl::placeholder {
|
||||
font-size: calc(var(--content-font-size) * 1.5);
|
||||
}
|
||||
|
||||
.placeholder-content-text-3xl::placeholder {
|
||||
font-size: calc(var(--content-font-size) * 1.875);
|
||||
}
|
||||
|
||||
.placeholder-content-text-4xl::placeholder {
|
||||
font-size: calc(var(--content-font-size) * 2.25);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* [제거됨] .content-text-* / .placeholder-content-text-*
|
||||
* --font-size-* 를 @theme inline 에 등록했기 때문에
|
||||
* 기본 text-xs ~ text-4xl 유틸이 이미 --content-font-size 배율을 반영합니다.
|
||||
* placeholder 스타일도 Tailwind 기본 placeholder: variant로 대체 가능합니다.
|
||||
* 예) placeholder-content-text-sm -> placeholder:text-sm
|
||||
*/
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************TipTap 이미지 Resize Node*******************************/
|
||||
@@ -266,4 +221,4 @@
|
||||
/* 리사이즈 중인 상태를 잡고 싶으면 */
|
||||
.ProseMirror [data-resize-container][data-resize-state="resizing"] {
|
||||
outline: 1px dashed #0ea5e9;
|
||||
}
|
||||
}
|
||||
@@ -50,8 +50,8 @@ export function KriMultiSelect<T = unknown>({
|
||||
placeholder = 'Select options',
|
||||
widthClassName,
|
||||
heightClassName,
|
||||
spanClassName = "content-text-lg",
|
||||
badgeClassName = "content-text-lg",
|
||||
spanClassName = "text-lg",
|
||||
badgeClassName = "text-lg",
|
||||
className,
|
||||
getValue,
|
||||
getLabel,
|
||||
@@ -89,7 +89,7 @@ export function KriMultiSelect<T = unknown>({
|
||||
onInfoChange={onItemsChange}
|
||||
maxSelected={maxSelected}
|
||||
placeholder={placeholder}
|
||||
className={cn("bg-white content-text-lg", className)}
|
||||
className={cn("bg-white text-lg", className)}
|
||||
spanClassName={spanClassName}
|
||||
badgeClassName={badgeClassName}
|
||||
searchable={searchable}
|
||||
@@ -133,8 +133,8 @@ export function KriSingleSelect<T = unknown>({
|
||||
placeholder = 'Select an option',
|
||||
heightClassName,
|
||||
widthClassName,
|
||||
spanClassName = "content-text-lg",
|
||||
badgeClassName = "content-text-lg",
|
||||
spanClassName = "text-lg",
|
||||
badgeClassName = "text-lg",
|
||||
className,
|
||||
getValue,
|
||||
getLabel,
|
||||
@@ -216,7 +216,7 @@ export function KriSingleSelect<T = unknown>({
|
||||
maxCount={1}
|
||||
maxSelected={1}
|
||||
placeholder={placeholder}
|
||||
className={cn("bg-white content-text-lg", className)}
|
||||
className={cn("bg-white text-lg", className)}
|
||||
spanClassName={spanClassName}
|
||||
badgeClassName={badgeClassName}
|
||||
searchable={searchable}
|
||||
|
||||
120
src/components/common/KriDateRangePicker.tsx
Normal file
120
src/components/common/KriDateRangePicker.tsx
Normal file
@@ -0,0 +1,120 @@
|
||||
'use client'
|
||||
|
||||
import { useRef } from 'react'
|
||||
import { CalendarDays, X } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
export type KriDateRange = {
|
||||
from: string
|
||||
to: string
|
||||
}
|
||||
|
||||
type KriDateRangePickerProps = {
|
||||
value: KriDateRange
|
||||
onChange: (value: KriDateRange) => void
|
||||
placeholder?: string
|
||||
className?: string
|
||||
triggerClassName?: string
|
||||
contentClassName?: string
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
export function KriDateRangePicker({
|
||||
value,
|
||||
onChange,
|
||||
placeholder = '조회 기간 선택',
|
||||
className,
|
||||
triggerClassName,
|
||||
contentClassName,
|
||||
disabled = false,
|
||||
}: KriDateRangePickerProps) {
|
||||
const toInputRef = useRef<HTMLInputElement | null>(null)
|
||||
|
||||
const displayText = value.from && value.to
|
||||
? `${value.from} ~ ${value.to}`
|
||||
: value.from
|
||||
? `${value.from} ~`
|
||||
: value.to
|
||||
? `~ ${value.to}`
|
||||
: placeholder
|
||||
|
||||
const hasValue = value.from.length > 0 || value.to.length > 0
|
||||
const invalidRange = value.from.length > 0 && value.to.length > 0 && value.from > value.to
|
||||
|
||||
const focusAndOpenToDate = () => {
|
||||
const input = toInputRef.current
|
||||
if (!input) return
|
||||
|
||||
input.focus()
|
||||
const inputWithPicker = input as HTMLInputElement & { showPicker?: () => void }
|
||||
inputWithPicker.showPicker?.()
|
||||
if (!inputWithPicker.showPicker) {
|
||||
input.click()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={cn('flex items-center gap-2', className)}>
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
disabled={disabled}
|
||||
className={cn('justify-start min-w-[260px] font-normal', triggerClassName)}
|
||||
>
|
||||
<CalendarDays className="w-4 h-4" />
|
||||
<span className="truncate">{displayText}</span>
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="start" className={cn('w-[360px] space-y-3', contentClassName)}>
|
||||
<Label className="font-semibold">조회 기간</Label>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<Input
|
||||
type="date"
|
||||
value={value.from}
|
||||
onChange={(e) => {
|
||||
const nextFrom = e.target.value
|
||||
onChange({ ...value, from: nextFrom })
|
||||
if (nextFrom) {
|
||||
requestAnimationFrame(() => {
|
||||
focusAndOpenToDate()
|
||||
})
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<span className="text-sm text-muted-foreground">~</span>
|
||||
<Input
|
||||
ref={toInputRef}
|
||||
type="date"
|
||||
value={value.to}
|
||||
onChange={(e) => onChange({ ...value, to: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{invalidRange && (
|
||||
<p className="text-xs text-red-600">조회 시작일은 종료일보다 이후일 수 없습니다.</p>
|
||||
)}
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={() => onChange({ from: '', to: '' })}
|
||||
disabled={disabled || !hasValue}
|
||||
aria-label="조회 기간 초기화"
|
||||
>
|
||||
<X className="w-4 h-4" />
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default KriDateRangePicker
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import type { CSSProperties } from 'react'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
@@ -9,78 +10,86 @@ export type KriSelectItem = {
|
||||
}
|
||||
|
||||
type KriSelectProps<T> = {
|
||||
/** options 배열: string[] 혹은 T[] */
|
||||
items: T[]
|
||||
/** 현재 선택 값 */
|
||||
value: string
|
||||
/** 값 변경 시 호출 */
|
||||
onChange?: (value: string) => void
|
||||
/** 옵션 변경시 호출 */
|
||||
onChangeOption?: (option: T) => void
|
||||
/** placeholder 텍스트 */
|
||||
placeholder?: string
|
||||
/** 기타 클래스 (예: 'w-40') */
|
||||
className?: string
|
||||
/** value를 어떻게 뽑을지 (없으면 String(item)) */
|
||||
heightClassName?: string
|
||||
triggerTextClassName?: string
|
||||
contentClassName?: string
|
||||
itemClassName?: string
|
||||
getValue?: (item: T) => string
|
||||
/** label을 어떻게 뽑을지 (없으면 String(item)) */
|
||||
getLabel?: (item: T) => string
|
||||
/** 전체 사용 여부 */
|
||||
useAll?: boolean
|
||||
}
|
||||
|
||||
const HEIGHT_CLASS_VALUE: Record<string, CSSProperties['height']> = {
|
||||
'h-6': '1.5rem',
|
||||
'h-7': '1.75rem',
|
||||
'h-8': '2rem',
|
||||
'h-9': '2.25rem',
|
||||
'h-10': '2.5rem',
|
||||
}
|
||||
|
||||
export function KriSelect<T>({
|
||||
items,
|
||||
value,
|
||||
onChange,
|
||||
onChangeOption,
|
||||
placeholder,
|
||||
className,
|
||||
getValue,
|
||||
getLabel,
|
||||
useAll = true,
|
||||
}: KriSelectProps<T>) {
|
||||
|
||||
const extractValue = (item: T) =>
|
||||
getValue ? getValue(item) : String(item);
|
||||
|
||||
const extractLabel = (item: T) =>
|
||||
getLabel ? getLabel(item) : String(item);
|
||||
items,
|
||||
value,
|
||||
onChange,
|
||||
onChangeOption,
|
||||
placeholder,
|
||||
className,
|
||||
heightClassName,
|
||||
triggerTextClassName = 'text-lg',
|
||||
contentClassName,
|
||||
itemClassName,
|
||||
getValue,
|
||||
getLabel,
|
||||
useAll = true,
|
||||
}: KriSelectProps<T>) {
|
||||
const extractValue = (item: T) => (getValue ? getValue(item) : String(item))
|
||||
const extractLabel = (item: T) => (getLabel ? getLabel(item) : String(item))
|
||||
const triggerStyle: CSSProperties | undefined = heightClassName
|
||||
? { height: HEIGHT_CLASS_VALUE[heightClassName] ?? undefined }
|
||||
: undefined
|
||||
|
||||
return (
|
||||
<Select
|
||||
value={value}
|
||||
onValueChange={(v) => {
|
||||
onChange?.(v);
|
||||
<Select
|
||||
value={value}
|
||||
onValueChange={(v) => {
|
||||
onChange?.(v)
|
||||
|
||||
const selected = items.find((item) => extractValue(item) === v);
|
||||
if(selected) {
|
||||
onChangeOption?.(selected);
|
||||
}
|
||||
}}
|
||||
const selected = items.find((item) => extractValue(item) === v)
|
||||
if (selected) {
|
||||
onChangeOption?.(selected)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<SelectTrigger
|
||||
className={cn('w-fit whitespace-nowrap bg-white', triggerTextClassName, heightClassName, className)}
|
||||
style={triggerStyle}
|
||||
aria-label={placeholder ?? 'select'}
|
||||
>
|
||||
<SelectTrigger
|
||||
className={cn(
|
||||
'w-fit whitespace-nowrap bg-white content-text-lg', // 폰트 사이즈
|
||||
className
|
||||
)}
|
||||
aria-label={placeholder ?? 'select'}
|
||||
>
|
||||
<SelectValue placeholder={placeholder} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{ useAll? <SelectItem key="ALL" value="ALL">전체</SelectItem> :null }
|
||||
{items.map((item, idx) => {
|
||||
const v = extractValue(item);
|
||||
const label = extractLabel(item);
|
||||
<SelectValue placeholder={placeholder} />
|
||||
</SelectTrigger>
|
||||
<SelectContent className={contentClassName}>
|
||||
{useAll ? (
|
||||
<SelectItem key="ALL" value="ALL" className={itemClassName}>
|
||||
전체
|
||||
</SelectItem>
|
||||
) : null}
|
||||
{items.map((item, idx) => {
|
||||
const v = extractValue(item)
|
||||
const label = extractLabel(item)
|
||||
|
||||
return (
|
||||
<SelectItem key={v ?? idx} value={v}>
|
||||
{label}
|
||||
</SelectItem>
|
||||
)
|
||||
})}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
return (
|
||||
<SelectItem key={v ?? idx} value={v} className={itemClassName}>
|
||||
{label}
|
||||
</SelectItem>
|
||||
)
|
||||
})}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ export function DataTable<TData>({
|
||||
defaultPageSize = 10,
|
||||
pageSizeOptions = [5, 10, 25, 50],
|
||||
paginationItemsToDisplay = 5
|
||||
}: DataTableProps<TData>) {
|
||||
}: Readonly<DataTableProps<TData>>) {
|
||||
// Pagination state
|
||||
const [pagination, setPagination] = useState<PaginationState>({
|
||||
pageIndex: 0,
|
||||
@@ -199,7 +199,7 @@ export function DataTable<TData>({
|
||||
<TableHead
|
||||
key={header.id}
|
||||
className={cn(
|
||||
'content-text-lg font-semibold text-gray-900',
|
||||
'text-lg font-semibold text-gray-900',
|
||||
column.id === 'actions' && 'w-[140px] text-center'
|
||||
)}
|
||||
style={{ width: header.getSize() !== 150 ? header.getSize() : undefined }}
|
||||
@@ -208,7 +208,7 @@ export function DataTable<TData>({
|
||||
<Button
|
||||
type='button'
|
||||
variant='ghost'
|
||||
className='px-0 font-semibold content-text-lg flex items-center gap-1'
|
||||
className='px-0 font-semibold text-lg flex items-center gap-1'
|
||||
onClick={column.getToggleSortingHandler()}
|
||||
>
|
||||
<span>{headerContent}</span>
|
||||
@@ -239,7 +239,7 @@ export function DataTable<TData>({
|
||||
onPointerCancel={drag.onPointerCancel}
|
||||
onClick={drag.wrapClick(() => handleRowClick(row))}
|
||||
className={cn(
|
||||
'content-text-base',
|
||||
'text-base',
|
||||
'[&>td]:py-0 [&>td]:px-2',
|
||||
selectMode !== 'none' && 'cursor-pointer',
|
||||
'data-[state=selected]:bg-slate-100 data-[state=selected]:font-semibold',
|
||||
|
||||
@@ -124,7 +124,7 @@ const ListBatchEditDialog = ({
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-[900px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="content-text-2xl font-bold">일괄 수정</DialogTitle>
|
||||
<DialogTitle className="text-2xl font-bold">일괄 수정</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-4">
|
||||
|
||||
39
src/components/dialog/ListDialogOption/ApplyFilterOption.tsx
Normal file
39
src/components/dialog/ListDialogOption/ApplyFilterOption.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
'use client'
|
||||
|
||||
|
||||
import {Label} from "@/components/ui/label";
|
||||
import {RadioGroup, RadioGroupItem} from "@/components/ui/radio-group";
|
||||
import type { ListFilterTarget } from "@/types/list";
|
||||
|
||||
export type ApplyFilterOptionValue = ListFilterTarget
|
||||
|
||||
type ApplyFilterGroupProps = {
|
||||
value: ApplyFilterOptionValue
|
||||
onValueChange: (value: ApplyFilterOptionValue) => void
|
||||
idPrefix: string
|
||||
}
|
||||
|
||||
const ApplyFilterOption = ({ value, onValueChange, idPrefix }: ApplyFilterGroupProps) => {
|
||||
return (
|
||||
<RadioGroup
|
||||
value={value}
|
||||
onValueChange={(next) => onValueChange(next as ApplyFilterOptionValue)}
|
||||
className="flex items-center gap-6 flex-wrap"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="selected" id={`${idPrefix}-selected`} />
|
||||
<Label htmlFor={`${idPrefix}-selected`}>선택 항목만</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="filtered" id={`${idPrefix}-filtered`} />
|
||||
<Label htmlFor={`${idPrefix}-filtered`}>필터 적용 대상만</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="all" id={`${idPrefix}-all`} />
|
||||
<Label htmlFor={`${idPrefix}-all`}>전체 대상</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
)
|
||||
}
|
||||
|
||||
export default ApplyFilterOption
|
||||
@@ -8,15 +8,16 @@ import { Label } from '@/components/ui/label'
|
||||
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import type { DialogId } from '@/store/jotai/dialog'
|
||||
|
||||
export type ListDownloadMode = 'list' | 'contact-history' | 'list-change-history' | 'upload-file'
|
||||
import ApplyFilterOption from './ListDialogOption/ApplyFilterOption'
|
||||
import KriDateRangePicker from '@/components/common/KriDateRangePicker'
|
||||
import type { ContactHistoryDownloadType, ListDownloadMode, ListDownloadPayload, ListFilterTarget } from '@/types/list'
|
||||
|
||||
export type ListDownloadDialogProps = {
|
||||
dialogId?: DialogId
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
mode: ListDownloadMode
|
||||
onDownload: (payload: { mode: ListDownloadMode; onlyFiltered: boolean }) => void | Promise<void>
|
||||
onDownload: (payload: ListDownloadPayload) => void | Promise<void>
|
||||
}
|
||||
|
||||
const titleMap: Record<ListDownloadMode, string> = {
|
||||
@@ -34,7 +35,10 @@ const ListDownloadDialog = ({
|
||||
onDownload,
|
||||
}: ListDownloadDialogProps) => {
|
||||
const { isDialogOpen, showDialog, hideDialog } = useDialog()
|
||||
const [scope, setScope] = useState<'filtered' | 'all'>('filtered')
|
||||
const [target, setTarget] = useState<ListFilterTarget>('filtered')
|
||||
const [contactHistoryDateFrom, setContactHistoryDateFrom] = useState('')
|
||||
const [contactHistoryDateTo, setContactHistoryDateTo] = useState('')
|
||||
const [contactHistoryType, setContactHistoryType] = useState<ContactHistoryDownloadType>('all')
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
|
||||
const resolvedOpen = open ?? isDialogOpen(dialogId)
|
||||
@@ -49,9 +53,29 @@ const ListDownloadDialog = ({
|
||||
}
|
||||
|
||||
const handleDownload = async () => {
|
||||
if (mode === 'contact-history') {
|
||||
const hasFrom = contactHistoryDateFrom.length > 0
|
||||
const hasTo = contactHistoryDateTo.length > 0
|
||||
if (hasFrom !== hasTo) {
|
||||
alert('조회 기간은 시작일과 종료일을 모두 입력해 주세요.')
|
||||
return
|
||||
}
|
||||
if (hasFrom && hasTo && contactHistoryDateFrom > contactHistoryDateTo) {
|
||||
alert('조회 시작일은 종료일보다 이후일 수 없습니다.')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
setSubmitting(true)
|
||||
try {
|
||||
await onDownload({ mode, onlyFiltered: scope === 'filtered' })
|
||||
await onDownload({
|
||||
mode,
|
||||
target,
|
||||
onlyFiltered: target === 'filtered',
|
||||
contactHistoryDateFrom: mode === 'contact-history' ? contactHistoryDateFrom || undefined : undefined,
|
||||
contactHistoryDateTo: mode === 'contact-history' ? contactHistoryDateTo || undefined : undefined,
|
||||
contactHistoryType: mode === 'contact-history' ? contactHistoryType : undefined,
|
||||
})
|
||||
handleOpenChange(false)
|
||||
} finally {
|
||||
setSubmitting(false)
|
||||
@@ -62,23 +86,47 @@ const ListDownloadDialog = ({
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-[560px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="content-text-2xl font-bold">{titleMap[mode]}</DialogTitle>
|
||||
<DialogTitle className="text-2xl font-bold">{titleMap[mode]}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
<p className="content-text-lg font-semibold">다운로드 범위</p>
|
||||
<RadioGroup value={scope} onValueChange={(v) => setScope(v as 'filtered' | 'all')} className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="filtered" id="download-scope-filtered" />
|
||||
<Label htmlFor="download-scope-filtered">필터 적용 대상만</Label>
|
||||
<div className="space-y-4">
|
||||
{mode === 'contact-history' ? (
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
<p className="text-lg font-semibold">조회 기간</p>
|
||||
<KriDateRangePicker
|
||||
value={{ from: contactHistoryDateFrom, to: contactHistoryDateTo }}
|
||||
onChange={(range) => {
|
||||
setContactHistoryDateFrom(range.from)
|
||||
setContactHistoryDateTo(range.to)
|
||||
}}
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">비워두면 전체 기간으로 다운로드됩니다.</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="all" id="download-scope-all" />
|
||||
<Label htmlFor="download-scope-all">전체 대상</Label>
|
||||
) : null}
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
<p className="text-lg font-semibold">다운로드 범위</p>
|
||||
<ApplyFilterOption value={target} onValueChange={setTarget} idPrefix="download-scope-target" />
|
||||
</div>
|
||||
{mode === 'contact-history' ? (
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
<p className="text-lg font-semibold">이력 기준</p>
|
||||
<RadioGroup
|
||||
value={contactHistoryType}
|
||||
onValueChange={(v) => setContactHistoryType(v as ContactHistoryDownloadType)}
|
||||
className="flex items-center gap-6 flex-wrap"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="all" id="download-contact-history-all" />
|
||||
<Label htmlFor="download-contact-history-all">전체 이력</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="latest" id="download-contact-history-latest" />
|
||||
<Label htmlFor="download-contact-history-latest">마지막 이력만</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" variant="outline" onClick={() => handleOpenChange(false)} disabled={submitting}>
|
||||
취소
|
||||
|
||||
@@ -5,7 +5,6 @@ import { Plus, X } from 'lucide-react'
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
@@ -13,24 +12,10 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select'
|
||||
import { KriMultiSelect } from '@/components/common/KriAutoComplete'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import type { DialogId } from '@/store/jotai/dialog'
|
||||
|
||||
export type FilterOperator = 'eq' | 'neq' | 'contains' | 'notContains'
|
||||
|
||||
export type FilterHeaderOption = {
|
||||
id: number
|
||||
label: string
|
||||
values?: string[]
|
||||
}
|
||||
|
||||
export type FilterRow = {
|
||||
id: string
|
||||
headerId: number
|
||||
operator: FilterOperator
|
||||
textValue: string
|
||||
multiValues: string[]
|
||||
}
|
||||
import type { FilterHeaderOption, FilterOperator, FilterRow } from '@/types/list'
|
||||
|
||||
export type ListFilterDialogProps = {
|
||||
dialogId?: DialogId
|
||||
@@ -112,13 +97,12 @@ const ListFilterDialog = ({
|
||||
() =>
|
||||
rows
|
||||
.map((row) => {
|
||||
if (row.operator === 'contains' || row.operator === 'notContains') {
|
||||
return row.textValue.trim().length > 0 ? row : null
|
||||
}
|
||||
return row.multiValues.length > 0 ? row : null
|
||||
const hasValueOptions = getValueOptions(row.headerId).length > 0
|
||||
if (hasValueOptions) return row.multiValues.length > 0 ? row : null
|
||||
return row.textValue.trim().length > 0 ? row : null
|
||||
})
|
||||
.filter((row): row is FilterRow => row !== null),
|
||||
[rows],
|
||||
[rows, headerOptions],
|
||||
)
|
||||
|
||||
const handleConfirm = async () => {
|
||||
@@ -140,11 +124,11 @@ const ListFilterDialog = ({
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-[940px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="content-text-2xl font-bold">필터</DialogTitle>
|
||||
<DialogTitle className="text-2xl font-bold">필터</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="rounded-md border overflow-hidden">
|
||||
<div className="h-11 px-4 border-b bg-muted/40 grid grid-cols-[1fr_140px_1.4fr_64px] items-center text-sm font-semibold">
|
||||
<div className="overflow-hidden rounded-md border">
|
||||
<div className="grid h-11 grid-cols-[1fr_140px_1.4fr_64px] items-center border-b bg-muted/40 px-4 text-sm font-semibold">
|
||||
<span>헤더</span>
|
||||
<span>비교 연산자</span>
|
||||
<span>값</span>
|
||||
@@ -154,12 +138,12 @@ const ListFilterDialog = ({
|
||||
<div className="max-h-80 overflow-auto">
|
||||
{rows.map((row) => {
|
||||
const valueOptions = getValueOptions(row.headerId)
|
||||
const textMode = row.operator === 'contains' || row.operator === 'notContains'
|
||||
const listMode = valueOptions.length > 0
|
||||
|
||||
return (
|
||||
<div
|
||||
key={row.id}
|
||||
className="min-h-12 px-4 py-2 border-b last:border-b-0 grid grid-cols-[1fr_140px_1.4fr_64px] items-center gap-2"
|
||||
className="grid min-h-12 grid-cols-[1fr_140px_1.4fr_64px] items-center gap-2 border-b px-4 py-2 last:border-b-0"
|
||||
>
|
||||
<Select
|
||||
value={String(row.headerId)}
|
||||
@@ -207,39 +191,37 @@ const ListFilterDialog = ({
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
{textMode ? (
|
||||
{listMode ? (
|
||||
<KriMultiSelect
|
||||
items={valueOptions}
|
||||
value={row.multiValues}
|
||||
onChange={(values) =>
|
||||
handleChangeRow(row.id, (current) => ({
|
||||
...current,
|
||||
multiValues: values,
|
||||
}))
|
||||
}
|
||||
getValue={(item) => item}
|
||||
getLabel={(item) => item}
|
||||
placeholder="값 선택"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
className="w-full"
|
||||
spanClassName="text-sm"
|
||||
badgeClassName="text-xs"
|
||||
maxCount={2}
|
||||
/>
|
||||
) : (
|
||||
<Input
|
||||
placeholder="검색할 텍스트"
|
||||
value={row.textValue}
|
||||
onChange={(e) =>
|
||||
onChange={(event) =>
|
||||
handleChangeRow(row.id, (current) => ({
|
||||
...current,
|
||||
textValue: e.target.value,
|
||||
textValue: event.target.value,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<div className="space-y-1">
|
||||
<select
|
||||
multiple
|
||||
className="w-full min-h-20 rounded-md border px-2 py-1 text-sm"
|
||||
value={row.multiValues}
|
||||
onChange={(e) => {
|
||||
const values = Array.from(e.target.selectedOptions).map((option) => option.value)
|
||||
handleChangeRow(row.id, (current) => ({
|
||||
...current,
|
||||
multiValues: values,
|
||||
}))
|
||||
}}
|
||||
>
|
||||
{valueOptions.map((value) => (
|
||||
<option key={value} value={value}>
|
||||
{value}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<Label className="text-xs text-muted-foreground">Ctrl/Cmd + 클릭으로 다중 선택</Label>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex justify-center">
|
||||
@@ -248,9 +230,9 @@ const ListFilterDialog = ({
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={() => handleRemoveRow(row.id)}
|
||||
aria-label="행 제거"
|
||||
aria-label="조건 제거"
|
||||
>
|
||||
<X className="w-4 h-4" />
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -260,7 +242,7 @@ const ListFilterDialog = ({
|
||||
</div>
|
||||
|
||||
<Button type="button" variant="outline" onClick={handleAddRow} className="gap-2">
|
||||
<Plus className="w-4 h-4" />
|
||||
<Plus className="h-4 w-4" />
|
||||
조건 추가
|
||||
</Button>
|
||||
|
||||
|
||||
@@ -1,28 +1,172 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
import { GripVertical, Trash2 } from 'lucide-react'
|
||||
import { CSSProperties, useEffect, useState } from 'react'
|
||||
import {
|
||||
closestCenter,
|
||||
DndContext,
|
||||
DragEndEvent,
|
||||
DragStartEvent,
|
||||
KeyboardSensor,
|
||||
PointerSensor,
|
||||
useSensor,
|
||||
useSensors,
|
||||
} from '@dnd-kit/core'
|
||||
import {
|
||||
arrayMove,
|
||||
SortableContext,
|
||||
sortableKeyboardCoordinates,
|
||||
useSortable,
|
||||
verticalListSortingStrategy,
|
||||
} from '@dnd-kit/sortable'
|
||||
import { CSS } from '@dnd-kit/utilities'
|
||||
import { GripVertical, Plus, Trash2 } from 'lucide-react'
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import type { DialogId } from '@/store/jotai/dialog'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
export type ListHeaderManageRow = {
|
||||
id: number
|
||||
name: string
|
||||
visible: boolean
|
||||
locked?: boolean
|
||||
}
|
||||
import { listHeader, ListHeaderGrade, ListHeaderType } from '@/types/list'
|
||||
import { LIST_HEADER_TYPE_LABEL, LIST_HEADER_TYPE_OPTIONS } from '@/const/listConst'
|
||||
|
||||
export type ListHeaderManageDialogProps = {
|
||||
dialogId?: DialogId
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
rows: ListHeaderManageRow[]
|
||||
onConfirm: (rows: ListHeaderManageRow[]) => void | Promise<void>
|
||||
rows: listHeader[]
|
||||
onConfirm: (rows: listHeader[]) => void | Promise<void>
|
||||
}
|
||||
|
||||
type ListHeaderRowProps = {
|
||||
row: listHeader
|
||||
activeId: number | null
|
||||
onHeaderNameChange: (id: number, listHderNm: string) => void
|
||||
onHeaderTypeChange: (id: number, listHderTy: ListHeaderType) => void
|
||||
onFlagChange: (id: number, field: 'useColView' | 'useFilter' | 'useIntrvwerView' | 'useIntrvwerEdit', checked: boolean) => void
|
||||
onDelete: (id: number) => void
|
||||
}
|
||||
|
||||
const isCommonGrade = (grade: ListHeaderGrade) => grade === ListHeaderGrade.COMMON
|
||||
const isImmutableGrade = (grade: ListHeaderGrade) => grade === ListHeaderGrade.IMMUTABLE
|
||||
|
||||
const ListHeaderRow = ({ row, activeId, onHeaderNameChange, onHeaderTypeChange, onFlagChange, onDelete }: ListHeaderRowProps) => {
|
||||
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: row.listHderId })
|
||||
const canEditName = isCommonGrade(row.listHderGrad)
|
||||
const canEditType = isCommonGrade(row.listHderGrad)
|
||||
const canDelete = isCommonGrade(row.listHderGrad)
|
||||
const canEditFlags = !isImmutableGrade(row.listHderGrad)
|
||||
const canSort = isCommonGrade(row.listHderGrad)
|
||||
|
||||
const style: CSSProperties = {
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
}
|
||||
const typeValue = String(row.listHderTy)
|
||||
const hasTypeOption = LIST_HEADER_TYPE_OPTIONS.some((option) => String(option.value) === typeValue)
|
||||
const fallbackLabel = (LIST_HEADER_TYPE_LABEL as Record<number, string>)[Number(row.listHderTy)] ?? typeValue
|
||||
const mergedTypeOptions = hasTypeOption
|
||||
? LIST_HEADER_TYPE_OPTIONS
|
||||
: [...LIST_HEADER_TYPE_OPTIONS, { value: Number(row.listHderTy), label: fallbackLabel }]
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={setNodeRef}
|
||||
style={style}
|
||||
className={cn(
|
||||
'h-12 px-4 border-b last:border-b-0 grid grid-cols-[56px_1fr_150px_96px_96px_110px_110px_88px] items-center gap-2',
|
||||
(activeId === row.listHderId || isDragging) && 'bg-muted/40',
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<button
|
||||
type="button"
|
||||
className={cn(
|
||||
'inline-flex items-center justify-center size-8 rounded-sm',
|
||||
canSort ? 'cursor-grab active:cursor-grabbing' : 'cursor-not-allowed opacity-40',
|
||||
)}
|
||||
aria-label={canSort ? `${row.listHderNm} 헤더 순서 변경` : `${row.listHderNm} 헤더 순서 변경 불가`}
|
||||
disabled={!canSort}
|
||||
{...(canSort ? attributes : {})}
|
||||
{...(canSort ? listeners : {})}
|
||||
>
|
||||
<GripVertical className="w-4 h-4 text-muted-foreground" />
|
||||
</button>
|
||||
</div>
|
||||
{canEditName ? (
|
||||
<Input
|
||||
value={row.listHderNm}
|
||||
onChange={(event) => onHeaderNameChange(row.listHderId, event.target.value)}
|
||||
className="h-9"
|
||||
aria-label={`${row.listHderNm} 헤더명`}
|
||||
/>
|
||||
) : (
|
||||
<span>{row.listHderNm}</span>
|
||||
)}
|
||||
<Select
|
||||
value={typeValue}
|
||||
onValueChange={(value) => onHeaderTypeChange(row.listHderId, Number(value) as ListHeaderType)}
|
||||
disabled={!canEditType}
|
||||
>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{mergedTypeOptions.map((option) => (
|
||||
<SelectItem key={option.value} value={String(option.value)}>
|
||||
{option.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="flex items-center gap-2 justify-center">
|
||||
<Checkbox
|
||||
id={`header-visible-${row.listHderId}`}
|
||||
checked={row.useColView}
|
||||
onCheckedChange={(checked) => onFlagChange(row.listHderId, 'useColView', checked === true)}
|
||||
disabled={!canEditFlags}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 justify-center">
|
||||
<Checkbox
|
||||
id={`header-filter-${row.listHderId}`}
|
||||
checked={row.useFilter}
|
||||
onCheckedChange={(checked) => onFlagChange(row.listHderId, 'useFilter', checked === true)}
|
||||
disabled={!canEditFlags}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 justify-center">
|
||||
<Checkbox
|
||||
id={`header-intrvwer-view-${row.listHderId}`}
|
||||
checked={row.useIntrvwerView}
|
||||
onCheckedChange={(checked) => onFlagChange(row.listHderId, 'useIntrvwerView', checked === true)}
|
||||
disabled={!canEditFlags}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 justify-center">
|
||||
<Checkbox
|
||||
id={`header-intrvwer-edit-${row.listHderId}`}
|
||||
checked={row.useIntrvwerEdit}
|
||||
onCheckedChange={(checked) => onFlagChange(row.listHderId, 'useIntrvwerEdit', checked === true)}
|
||||
disabled={!canEditFlags}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex justify-center">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={() => onDelete(row.listHderId)}
|
||||
className={!canDelete ? 'invisible pointer-events-none' : undefined}
|
||||
disabled={!canDelete}
|
||||
aria-label="헤더 삭제"
|
||||
>
|
||||
<Trash2 className="w-4 h-4 text-red-600" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const ListHeaderManageDialog = ({
|
||||
@@ -33,11 +177,15 @@ const ListHeaderManageDialog = ({
|
||||
onConfirm,
|
||||
}: ListHeaderManageDialogProps) => {
|
||||
const { isDialogOpen, showDialog, hideDialog } = useDialog()
|
||||
const [localRows, setLocalRows] = useState<ListHeaderManageRow[]>([])
|
||||
const [draggingId, setDraggingId] = useState<number | null>(null)
|
||||
const [localRows, setLocalRows] = useState<listHeader[]>([])
|
||||
const [activeId, setActiveId] = useState<number | null>(null)
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
|
||||
const resolvedOpen = open ?? isDialogOpen(dialogId)
|
||||
const sensors = useSensors(
|
||||
useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
|
||||
useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (!resolvedOpen) return
|
||||
@@ -53,37 +201,103 @@ const ListHeaderManageDialog = ({
|
||||
hideDialog(dialogId)
|
||||
}
|
||||
|
||||
const handleDrop = (targetId: number) => {
|
||||
if (draggingId === null || draggingId === targetId) return
|
||||
const moveRow = (sourceId: number, targetId: number) => {
|
||||
if (sourceId === targetId) return
|
||||
setLocalRows((prev) => {
|
||||
const sourceIndex = prev.findIndex((row) => row.id === draggingId)
|
||||
const targetIndex = prev.findIndex((row) => row.id === targetId)
|
||||
const sourceIndex = prev.findIndex((row) => row.listHderId === sourceId)
|
||||
const targetIndex = prev.findIndex((row) => row.listHderId === targetId)
|
||||
if (sourceIndex < 0 || targetIndex < 0) return prev
|
||||
|
||||
const next = [...prev]
|
||||
const [moved] = next.splice(sourceIndex, 1)
|
||||
next.splice(targetIndex, 0, moved)
|
||||
return next
|
||||
const sourceRow = prev[sourceIndex]
|
||||
const targetRow = prev[targetIndex]
|
||||
if (!sourceRow || !targetRow) return prev
|
||||
if (!isCommonGrade(sourceRow.listHderGrad) || !isCommonGrade(targetRow.listHderGrad)) return prev
|
||||
|
||||
return arrayMove(prev, sourceIndex, targetIndex)
|
||||
})
|
||||
}
|
||||
|
||||
const handleVisibleChange = (id: number, checked: boolean) => {
|
||||
const handleDragStart = (event: DragStartEvent) => {
|
||||
setActiveId(Number(event.active.id))
|
||||
}
|
||||
|
||||
const handleDragEnd = (event: DragEndEvent) => {
|
||||
const sourceId = Number(event.active.id)
|
||||
const targetId = Number(event.over?.id)
|
||||
if (!Number.isNaN(sourceId) && !Number.isNaN(targetId)) {
|
||||
moveRow(sourceId, targetId)
|
||||
}
|
||||
setActiveId(null)
|
||||
}
|
||||
|
||||
const handleHeaderTypeChange = (id: number, listHderTy: ListHeaderType) => {
|
||||
setLocalRows((prev) =>
|
||||
prev.map((row) => {
|
||||
if (row.id !== id || row.locked) return row
|
||||
return { ...row, visible: checked }
|
||||
if (row.listHderId !== id) return row
|
||||
if (!isCommonGrade(row.listHderGrad)) return row
|
||||
return { ...row, listHderTy }
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
const handleHeaderNameChange = (id: number, listHderNm: string) => {
|
||||
setLocalRows((prev) =>
|
||||
prev.map((row) => {
|
||||
if (row.listHderId !== id) return row
|
||||
if (!isCommonGrade(row.listHderGrad)) return row
|
||||
return { ...row, listHderNm }
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
const handleFlagChange = (
|
||||
id: number,
|
||||
field: 'useColView' | 'useFilter' | 'useIntrvwerView' | 'useIntrvwerEdit',
|
||||
checked: boolean,
|
||||
) => {
|
||||
setLocalRows((prev) =>
|
||||
prev.map((row) => {
|
||||
if (row.listHderId !== id) return row
|
||||
if (isImmutableGrade(row.listHderGrad)) return row
|
||||
return { ...row, [field]: checked }
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
const handleDelete = (id: number) => {
|
||||
setLocalRows((prev) => prev.filter((row) => row.id !== id || row.locked))
|
||||
setLocalRows((prev) => prev.filter((row) => row.listHderId !== id || !isCommonGrade(row.listHderGrad)))
|
||||
}
|
||||
|
||||
const handleAddHeader = () => {
|
||||
setLocalRows((prev) => {
|
||||
const minId = prev.reduce((acc, row) => Math.min(acc, row.listHderId), 0)
|
||||
const nextId = minId <= 0 ? minId - 1 : -1
|
||||
const newIndex = prev.filter((row) => row.listHderNm.startsWith('신규 헤더')).length + 1
|
||||
|
||||
const nextRow: listHeader = {
|
||||
listHderId: nextId,
|
||||
listHderOrder: prev.length + 1,
|
||||
listHderGrad: ListHeaderGrade.COMMON,
|
||||
listHderNm: `신규 헤더 ${newIndex}`,
|
||||
listHderTy: LIST_HEADER_TYPE_OPTIONS[0].value,
|
||||
useFilter: false,
|
||||
useColView: true,
|
||||
useIntrvwerView: false,
|
||||
useIntrvwerEdit: false,
|
||||
}
|
||||
|
||||
return [...prev, nextRow]
|
||||
})
|
||||
}
|
||||
|
||||
const handleConfirm = async () => {
|
||||
setSubmitting(true)
|
||||
try {
|
||||
await onConfirm(localRows)
|
||||
const orderedRows = localRows.map((row, index) => ({
|
||||
...row,
|
||||
listHderOrder: index + 1,
|
||||
}))
|
||||
await onConfirm(orderedRows)
|
||||
handleOpenChange(false)
|
||||
} finally {
|
||||
setSubmitting(false)
|
||||
@@ -92,63 +306,53 @@ const ListHeaderManageDialog = ({
|
||||
|
||||
return (
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-[820px]">
|
||||
<DialogContent className="sm:max-w-[1200px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="content-text-2xl font-bold">리스트 헤더 관리</DialogTitle>
|
||||
<DialogTitle className="text-2xl font-bold">리스트 헤더 관리</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="flex justify-end">
|
||||
<Button type="button" className="gap-2 bg-blue" onClick={handleAddHeader} disabled={submitting}>
|
||||
<Plus className="w-4 h-4" />
|
||||
헤더 추가
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="rounded-md border overflow-hidden">
|
||||
<div className="h-11 px-4 border-b bg-muted/40 grid grid-cols-[56px_1fr_120px_88px] items-center text-sm font-semibold">
|
||||
<div className="h-11 px-4 border-b bg-muted/40 grid grid-cols-[56px_1fr_150px_96px_96px_110px_110px_88px] items-center gap-2 text-sm font-semibold">
|
||||
<span>순서</span>
|
||||
<span>헤더명</span>
|
||||
<span>노출</span>
|
||||
<span>헤더 타입</span>
|
||||
<span>헤더 노출</span>
|
||||
<span>필터 사용</span>
|
||||
<span>면접원 노출</span>
|
||||
<span>면접원 수정</span>
|
||||
<span className="text-center">삭제</span>
|
||||
</div>
|
||||
|
||||
<div className="max-h-[420px] overflow-auto">
|
||||
{localRows.map((row) => (
|
||||
<div
|
||||
key={row.id}
|
||||
className={cn(
|
||||
'h-11 px-4 border-b last:border-b-0 grid grid-cols-[56px_1fr_120px_88px] items-center',
|
||||
draggingId === row.id && 'bg-muted/40',
|
||||
)}
|
||||
draggable={!row.locked}
|
||||
onDragStart={() => setDraggingId(row.id)}
|
||||
onDragEnd={() => setDraggingId(null)}
|
||||
onDragOver={(e) => e.preventDefault()}
|
||||
onDrop={() => handleDrop(row.id)}
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<GripVertical className="w-4 h-4 text-muted-foreground" />
|
||||
</div>
|
||||
<span>{row.name}</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
id={`header-visible-${row.id}`}
|
||||
checked={row.visible}
|
||||
onCheckedChange={(checked) => handleVisibleChange(row.id, checked === true)}
|
||||
disabled={row.locked}
|
||||
<DndContext
|
||||
sensors={sensors}
|
||||
collisionDetection={closestCenter}
|
||||
onDragStart={handleDragStart}
|
||||
onDragEnd={handleDragEnd}
|
||||
onDragCancel={() => setActiveId(null)}
|
||||
>
|
||||
<SortableContext items={localRows.map((row) => row.listHderId)} strategy={verticalListSortingStrategy}>
|
||||
<div className="max-h-[420px] overflow-auto">
|
||||
{localRows.map((row) => (
|
||||
<ListHeaderRow
|
||||
key={row.listHderId}
|
||||
row={row}
|
||||
activeId={activeId}
|
||||
onHeaderNameChange={handleHeaderNameChange}
|
||||
onHeaderTypeChange={handleHeaderTypeChange}
|
||||
onFlagChange={handleFlagChange}
|
||||
onDelete={handleDelete}
|
||||
/>
|
||||
<Label htmlFor={`header-visible-${row.id}`} className="cursor-pointer">
|
||||
사용
|
||||
</Label>
|
||||
</div>
|
||||
<div className="flex justify-center">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={() => handleDelete(row.id)}
|
||||
disabled={row.locked}
|
||||
aria-label="헤더 삭제"
|
||||
>
|
||||
<Trash2 className="w-4 h-4 text-red-600" />
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</SortableContext>
|
||||
</DndContext>
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
|
||||
@@ -7,15 +7,14 @@ import { Label } from '@/components/ui/label'
|
||||
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import type { DialogId } from '@/store/jotai/dialog'
|
||||
|
||||
export type ListResetTarget = 'selected' | 'filtered' | 'all'
|
||||
export type ListResetScope = 'result-and-history' | 'list-only'
|
||||
import ApplyFilterOption from './ListDialogOption/ApplyFilterOption'
|
||||
import type { ListFilterTarget, ListResetScope } from '@/types/list'
|
||||
|
||||
export type ListResetDialogProps = {
|
||||
dialogId?: DialogId
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
onConfirm: (payload: { target: ListResetTarget; scope: ListResetScope }) => void | Promise<void>
|
||||
onConfirm: (payload: { target: ListFilterTarget; scope: ListResetScope }) => void | Promise<void>
|
||||
}
|
||||
|
||||
const ListResetDialog = ({
|
||||
@@ -25,7 +24,7 @@ const ListResetDialog = ({
|
||||
onConfirm,
|
||||
}: ListResetDialogProps) => {
|
||||
const { isDialogOpen, showDialog, hideDialog } = useDialog()
|
||||
const [target, setTarget] = useState<ListResetTarget>('selected')
|
||||
const [target, setTarget] = useState<ListFilterTarget>('selected')
|
||||
const [scope, setScope] = useState<ListResetScope>('result-and-history')
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
|
||||
@@ -54,38 +53,29 @@ const ListResetDialog = ({
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-[700px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="content-text-2xl font-bold">리스트 초기화</DialogTitle>
|
||||
<DialogTitle className="text-2xl font-bold">리스트 초기화</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-6 py-2">
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
<p className="content-text-lg font-semibold text-red-600">초기화 대상</p>
|
||||
<RadioGroup value={target} onValueChange={(v) => setTarget(v as ListResetTarget)} className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="selected" id="list-reset-target-selected" />
|
||||
<Label htmlFor="list-reset-target-selected">선택 항목만</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="filtered" id="list-reset-target-filtered" />
|
||||
<Label htmlFor="list-reset-target-filtered">필터 적용 항목만</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="all" id="list-reset-target-all" />
|
||||
<Label htmlFor="list-reset-target-all">리스트 전체</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
<p className="text-lg font-semibold text-red-600">초기화 대상</p>
|
||||
<ApplyFilterOption
|
||||
value={target}
|
||||
onValueChange={(v) => setTarget(v)}
|
||||
idPrefix="list-reset-target"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
<p className="content-text-lg font-semibold text-red-600">초기화 범위</p>
|
||||
<p className="text-lg font-semibold text-red-600">초기화 범위</p>
|
||||
<RadioGroup value={scope} onValueChange={(v) => setScope(v as ListResetScope)} className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="result-and-history" id="list-reset-scope-result-history" />
|
||||
<Label htmlFor="list-reset-scope-result-history">최종 결과 + 컨택 이력 삭제</Label>
|
||||
<Label htmlFor="list-reset-scope-result-history">결과 + 이력 삭제</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="list-only" id="list-reset-scope-list-only" />
|
||||
<Label htmlFor="list-reset-scope-list-only">리스트만 삭제</Label>
|
||||
<Label htmlFor="list-reset-scope-list-only">결과 + 이력 + 리스트 삭제</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
|
||||
@@ -2,41 +2,33 @@
|
||||
|
||||
import { useMemo, useRef, useState } from 'react'
|
||||
import { ChevronDown, ChevronUp, Download, Upload, X } from 'lucide-react'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog'
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
||||
import { KriSelect, KriSelectItem } from '@/components/common/KriSelect'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import { useLoading } from '@/hooks/useLoading'
|
||||
import type { DialogId } from '@/store/jotai/dialog'
|
||||
import { formatKst } from '@/lib/utils'
|
||||
import { formatKst } from '@kri/common'
|
||||
import { listHeader, ListHeaderGrade, ListHeaderType, ListUploadHistory, ListUploadMode, ListUploadRequest } from '@/types/list'
|
||||
import { LIST_HEADER_TYPE_LABEL, LIST_HEADER_TYPE_ORDER, ListHeaderConst } from '@/const/listConst'
|
||||
|
||||
export type ValidationOption = {
|
||||
checkEmailDuplicate: boolean
|
||||
checkPhoneDuplicate: boolean
|
||||
}
|
||||
|
||||
export type ListUploadHistory = {
|
||||
round: number
|
||||
fileName: string
|
||||
userId: string
|
||||
uploadCount: number
|
||||
uploadAt: string
|
||||
}
|
||||
|
||||
export type ListUploadDialogProps = {
|
||||
dialogId?: DialogId
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
onUpload: (file: File, validation: ValidationOption) => void | Promise<void>
|
||||
onUpload: (file: File, request: ListUploadRequest) => void | Promise<void>
|
||||
onDownloadTemplate?: () => void | Promise<void>
|
||||
uploadHistory?: ListUploadHistory[]
|
||||
onDownloadHistory?: (item: ListUploadHistory) => void | Promise<void>
|
||||
headerRows?: listHeader[]
|
||||
}
|
||||
|
||||
const ACCEPT_EXTENSIONS = ['.xlsx', '.xls', '.csv']
|
||||
@@ -49,13 +41,18 @@ const ListUploadDialog = ({
|
||||
onDownloadTemplate,
|
||||
uploadHistory = [],
|
||||
onDownloadHistory,
|
||||
headerRows = [],
|
||||
}: ListUploadDialogProps) => {
|
||||
const { isDialogOpen, showDialog, hideDialog } = useDialog()
|
||||
const { withLoadingAsync } = useLoading()
|
||||
const fileInputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
const [selectedFile, setSelectedFile] = useState<File | null>(null)
|
||||
const [excelHeaders, setExcelHeaders] = useState<string[]>([])
|
||||
const [otherHeaderTypeMap, setOtherHeaderTypeMap] = useState<Record<number, ListHeaderType>>({})
|
||||
const [uploadMode, setUploadMode] = useState<ListUploadMode>(ListUploadMode.CHANGE)
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
const [historyExpanded, setHistoryExpanded] = useState(true)
|
||||
const [historyExpanded, setHistoryExpanded] = useState(false)
|
||||
const [validation, setValidation] = useState<ValidationOption>({
|
||||
checkEmailDuplicate: false,
|
||||
checkPhoneDuplicate: false,
|
||||
@@ -65,24 +62,43 @@ const ListUploadDialog = ({
|
||||
|
||||
const normalizedHistory = useMemo(
|
||||
() =>
|
||||
uploadHistory.map((item) => ({
|
||||
...item,
|
||||
uploadAtLabel: formatKst(item.uploadAt, 'dateTime'),
|
||||
})),
|
||||
[...uploadHistory]
|
||||
.sort((a, b) => b.wave - a.wave)
|
||||
.map((item) => ({
|
||||
...item,
|
||||
uploadAtLabel: formatKst(item.regDt, 'dateTime'),
|
||||
})),
|
||||
[uploadHistory],
|
||||
)
|
||||
|
||||
const orderedHeaderRows = useMemo(() => [...headerRows].sort((a, b) => a.listHderOrder - b.listHderOrder), [headerRows])
|
||||
const hasCommonHeader = useMemo(
|
||||
() => orderedHeaderRows.some((row) => row.listHderGrad === ListHeaderGrade.COMMON),
|
||||
[orderedHeaderRows],
|
||||
)
|
||||
const baseHeaderRows = useMemo(
|
||||
() => orderedHeaderRows.filter((row) => row.listHderGrad !== ListHeaderGrade.COMMON),
|
||||
[orderedHeaderRows],
|
||||
)
|
||||
|
||||
const selectableHeaderTypeOptions = useMemo<KriSelectItem[]>(
|
||||
() =>
|
||||
LIST_HEADER_TYPE_ORDER.map((value) => ({ value: String(value), label: LIST_HEADER_TYPE_LABEL[value] })),
|
||||
[],
|
||||
)
|
||||
|
||||
const resetState = () => {
|
||||
setSelectedFile(null)
|
||||
setExcelHeaders([])
|
||||
setOtherHeaderTypeMap({})
|
||||
setUploadMode(ListUploadMode.ADD)
|
||||
setSubmitting(false)
|
||||
setHistoryExpanded(true)
|
||||
setHistoryExpanded(false)
|
||||
setValidation({
|
||||
checkEmailDuplicate: false,
|
||||
checkPhoneDuplicate: false,
|
||||
})
|
||||
if (fileInputRef.current) {
|
||||
fileInputRef.current.value = ''
|
||||
}
|
||||
if (fileInputRef.current) fileInputRef.current.value = ''
|
||||
}
|
||||
|
||||
const handleOpenChange = (nextOpen: boolean) => {
|
||||
@@ -95,15 +111,25 @@ const ListUploadDialog = ({
|
||||
}
|
||||
|
||||
const handleDialogOpenChange = (nextOpen: boolean) => {
|
||||
if (!nextOpen && !submitting) {
|
||||
resetState()
|
||||
}
|
||||
if (!nextOpen && !submitting) resetState()
|
||||
handleOpenChange(nextOpen)
|
||||
}
|
||||
|
||||
const handleSelectFileClick = () => {
|
||||
if (submitting) return
|
||||
fileInputRef.current?.click()
|
||||
const extractHeaders = async (file: File) => {
|
||||
const lower = file.name.toLowerCase()
|
||||
if (lower.endsWith('.csv')) {
|
||||
const text = await file.text()
|
||||
const firstLine = text.split(/\r?\n/)[0] ?? ''
|
||||
return firstLine.split(',').map((s) => s.trim()).filter((s) => s.length > 0)
|
||||
}
|
||||
|
||||
const { read, utils } = await import('xlsx')
|
||||
const buffer = await file.arrayBuffer()
|
||||
const workbook = read(buffer, { type: 'array' })
|
||||
const firstSheet = workbook.SheetNames[0]
|
||||
if (!firstSheet) return []
|
||||
const rows = utils.sheet_to_json<(string | number | null)[]>(workbook.Sheets[firstSheet], { header: 1, raw: false })
|
||||
return (rows[0] ?? []).map((cell) => String(cell ?? '').trim()).filter((s) => s.length > 0)
|
||||
}
|
||||
|
||||
const handleSelectFile = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
@@ -116,14 +142,17 @@ const ListUploadDialog = ({
|
||||
alert('엑셀 또는 CSV 파일만 업로드 가능합니다. (.xlsx, .xls, .csv)')
|
||||
return
|
||||
}
|
||||
setSelectedFile(file)
|
||||
}
|
||||
|
||||
const handleRemoveFile = () => {
|
||||
setSelectedFile(null)
|
||||
if (fileInputRef.current) {
|
||||
fileInputRef.current.value = ''
|
||||
}
|
||||
setSelectedFile(file)
|
||||
void withLoadingAsync(async () => {
|
||||
try {
|
||||
const headers = await extractHeaders(file)
|
||||
setExcelHeaders(headers)
|
||||
} catch {
|
||||
setExcelHeaders([])
|
||||
alert('업로드 파일의 첫 행 헤더를 읽는 중 오류가 발생했습니다.')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
@@ -134,7 +163,18 @@ const ListUploadDialog = ({
|
||||
|
||||
setSubmitting(true)
|
||||
try {
|
||||
await onUpload(selectedFile, validation)
|
||||
const specificHeader = Object.fromEntries(
|
||||
Object.entries(otherHeaderTypeMap)
|
||||
.map(([index, value]) => [String(Number(index) + 1), value])
|
||||
.filter(([, value]) => value !== ListHeaderConst.TEXT),
|
||||
)
|
||||
|
||||
await onUpload(selectedFile, {
|
||||
uploadMode,
|
||||
checkDuplicateEmail: validation.checkEmailDuplicate,
|
||||
checkDuplicatePhone: validation.checkPhoneDuplicate,
|
||||
...(Object.keys(specificHeader).length > 0 ? { specificHeader } : {}),
|
||||
})
|
||||
resetState()
|
||||
handleOpenChange(false)
|
||||
} catch {
|
||||
@@ -144,64 +184,143 @@ const ListUploadDialog = ({
|
||||
}
|
||||
}
|
||||
|
||||
const compareRows = hasCommonHeader ? orderedHeaderRows : baseHeaderRows
|
||||
const headerCompareList = useMemo(
|
||||
() =>
|
||||
excelHeaders.map((header, index) => {
|
||||
const serverHeader = compareRows[index]
|
||||
const isMatched = !!serverHeader && serverHeader.listHderNm === header && serverHeader.listHderOrder === index + 1
|
||||
const isSettingRequired = !hasCommonHeader && index >= baseHeaderRows.length
|
||||
return {
|
||||
header,
|
||||
index,
|
||||
isMatched,
|
||||
isSettingRequired,
|
||||
serverHeader,
|
||||
}
|
||||
}),
|
||||
[baseHeaderRows.length, compareRows, excelHeaders, hasCommonHeader],
|
||||
)
|
||||
const hasHeaderMismatch = headerCompareList.some(({ serverHeader, isMatched }) => !!serverHeader && !isMatched)
|
||||
|
||||
const renderHeaderTypeCell = (
|
||||
serverHeader: listHeader | undefined,
|
||||
isMatched: boolean,
|
||||
isSettingRequired: boolean,
|
||||
index: number,
|
||||
) => {
|
||||
if (serverHeader && !isMatched) {
|
||||
return <span className="text-xs text-red-600">이름 또는 순서 불일치</span>
|
||||
}
|
||||
|
||||
if (isSettingRequired) {
|
||||
return (
|
||||
<KriSelect
|
||||
items={selectableHeaderTypeOptions}
|
||||
value={String(otherHeaderTypeMap[index] ?? ListHeaderConst.TEXT)}
|
||||
getValue={(item) => item.value}
|
||||
getLabel={(item) => item.label}
|
||||
onChange={(value) => setOtherHeaderTypeMap((prev) => ({ ...prev, [index]: Number(value) as ListHeaderType }))}
|
||||
useAll={false}
|
||||
className="w-full min-w-0 overflow-hidden [&>span]:truncate"
|
||||
heightClassName="h-8"
|
||||
triggerTextClassName="text-xs"
|
||||
contentClassName="text-xs"
|
||||
itemClassName="text-xs"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return <span className="text-sm">{serverHeader ? LIST_HEADER_TYPE_LABEL[serverHeader.listHderTy] : '-'}</span>
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleDialogOpenChange}>
|
||||
<DialogContent className="sm:max-w-[860px]">
|
||||
<DialogContent className="overflow-hidden" style={{ width: 'min(960px, 95vw)', maxWidth: '95vw' }}>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="content-text-2xl font-bold">리스트 업로드</DialogTitle>
|
||||
<DialogTitle className="text-2xl font-bold">리스트 업로드</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-6 py-2">
|
||||
<div className="min-w-0 space-y-6 py-2">
|
||||
{
|
||||
/*
|
||||
<div className="space-y-3">
|
||||
<Label className="content-text-lg font-semibold">업로드 파일</Label>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button type="button" className="bg-excel content-text-lg" onClick={onDownloadTemplate}>
|
||||
<Label className="text-lg font-semibold">업로드 방식</Label>
|
||||
<RadioGroup
|
||||
value={String(uploadMode)}
|
||||
onValueChange={(value) => setUploadMode(Number(value) as ListUploadMode)}
|
||||
className="flex flex-wrap items-center gap-6"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value={String(ListUploadMode.CHANGE)} id="list-upload-mode-change" />
|
||||
<Label htmlFor="list-upload-mode-change" className="cursor-pointer">
|
||||
전체 교체
|
||||
</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value={String(ListUploadMode.ADD)} id="list-upload-mode-add" />
|
||||
<Label htmlFor="list-upload-mode-add" className="cursor-pointer">
|
||||
추가
|
||||
</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
*/
|
||||
}
|
||||
<div className="space-y-3">
|
||||
<Label className="text-lg font-semibold">업로드 파일</Label>
|
||||
<div className="min-w-0 flex items-center gap-2">
|
||||
<Button type="button" className="shrink-0 bg-excel text-base" onClick={onDownloadTemplate}>
|
||||
<Download className="w-4 h-4" />
|
||||
양식 다운로드
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="flex-1 justify-start content-text-lg"
|
||||
onClick={handleSelectFileClick}
|
||||
className="min-w-0 flex-1 justify-start text-lg"
|
||||
disabled={submitting}
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
>
|
||||
<Upload className="w-4 h-4" />
|
||||
{selectedFile ? selectedFile.name : '업로드 파일을 선택해 주세요'}
|
||||
<Upload className="w-4 h-4 shrink-0" />
|
||||
<span className="min-w-0 truncate">{selectedFile ? selectedFile.name : '업로드 파일을 선택해 주세요.'}</span>
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={handleRemoveFile}
|
||||
disabled={!selectedFile || submitting}
|
||||
aria-label="선택 파일 제거"
|
||||
>
|
||||
<Button type="button" variant="ghost" size="icon-sm" disabled={!selectedFile || submitting} onClick={resetState} aria-label="선택 파일 제거">
|
||||
<X className="w-4 h-4" />
|
||||
</Button>
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept={ACCEPT_EXTENSIONS.join(',')}
|
||||
className="hidden"
|
||||
onChange={handleSelectFile}
|
||||
/>
|
||||
<input ref={fileInputRef} type="file" accept={ACCEPT_EXTENSIONS.join(',')} className="hidden" onChange={handleSelectFile} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{selectedFile && excelHeaders.length > 0 && compareRows.length > 0 && (
|
||||
<div className="min-w-0 space-y-3">
|
||||
<Label className="text-lg font-semibold">헤더 비교</Label>
|
||||
<div className="block w-full max-w-full overflow-x-scroll rounded-md border pb-1">
|
||||
<div className="w-max whitespace-nowrap">
|
||||
{headerCompareList.map(({ header, index, isMatched, isSettingRequired, serverHeader }) => {
|
||||
return (
|
||||
<div key={`${header}-${index}`} className="inline-block w-[125px] align-top border-r last:border-r-0">
|
||||
<div className="flex h-8 items-center truncate bg-slate-700 px-2.5 text-sm font-medium text-slate-50">
|
||||
{header || `컬럼${index + 1}`}
|
||||
</div>
|
||||
<div className="flex h-9 items-center border-t px-2">
|
||||
{renderHeaderTypeCell(serverHeader, isMatched, isSettingRequired, index)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-3">
|
||||
<Label className="content-text-lg font-semibold">중복 검증</Label>
|
||||
<Label className="text-lg font-semibold">중복 검증</Label>
|
||||
<div className="flex items-center gap-6">
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
id="list-upload-email-dup"
|
||||
checked={validation.checkEmailDuplicate}
|
||||
onCheckedChange={(checked) =>
|
||||
setValidation((prev) => ({
|
||||
...prev,
|
||||
checkEmailDuplicate: checked === true,
|
||||
}))
|
||||
}
|
||||
onCheckedChange={(checked) => setValidation((prev) => ({ ...prev, checkEmailDuplicate: checked === true }))}
|
||||
/>
|
||||
<Label htmlFor="list-upload-email-dup" className="cursor-pointer">
|
||||
이메일 중복검증
|
||||
@@ -211,12 +330,7 @@ const ListUploadDialog = ({
|
||||
<Checkbox
|
||||
id="list-upload-phone-dup"
|
||||
checked={validation.checkPhoneDuplicate}
|
||||
onCheckedChange={(checked) =>
|
||||
setValidation((prev) => ({
|
||||
...prev,
|
||||
checkPhoneDuplicate: checked === true,
|
||||
}))
|
||||
}
|
||||
onCheckedChange={(checked) => setValidation((prev) => ({ ...prev, checkPhoneDuplicate: checked === true }))}
|
||||
/>
|
||||
<Label htmlFor="list-upload-phone-dup" className="cursor-pointer">
|
||||
전화번호 중복검증
|
||||
@@ -226,51 +340,41 @@ const ListUploadDialog = ({
|
||||
</div>
|
||||
|
||||
<div className="rounded-md border">
|
||||
<button
|
||||
type="button"
|
||||
className="w-full px-4 h-11 flex items-center justify-between border-b text-left"
|
||||
onClick={() => setHistoryExpanded((prev) => !prev)}
|
||||
>
|
||||
<span className="content-text-lg font-semibold">업로드 이력</span>
|
||||
{historyExpanded ? <ChevronUp className="w-4 h-4" /> : <ChevronDown className="w-4 h-4" />}
|
||||
<button type="button" className="flex h-11 w-full items-center justify-between border-b px-4 text-left" onClick={() => setHistoryExpanded((prev) => !prev)}>
|
||||
<span className="text-lg font-semibold">업로드 이력({normalizedHistory.length} 회)</span>
|
||||
{historyExpanded ? <ChevronUp className="h-4 w-4" /> : <ChevronDown className="h-4 w-4" />}
|
||||
</button>
|
||||
|
||||
{historyExpanded && (
|
||||
<div className="max-h-56 overflow-auto">
|
||||
<table className="w-full text-sm">
|
||||
<thead className="sticky top-0 bg-white border-b">
|
||||
<div className="h-[160px] overflow-y-auto">
|
||||
<table className="w-full text-base">
|
||||
<thead className="sticky top-0 border-b bg-white">
|
||||
<tr>
|
||||
<th className="px-3 h-9 text-left">회차</th>
|
||||
<th className="px-3 h-9 text-left">파일명</th>
|
||||
<th className="px-3 h-9 text-left">사용자 ID</th>
|
||||
<th className="px-3 h-9 text-right">업로드 건수</th>
|
||||
<th className="px-3 h-9 text-left">업로드 일시</th>
|
||||
<th className="px-3 h-9 text-center">다운로드</th>
|
||||
<th className="h-9 px-3 text-center">회차</th>
|
||||
<th className="h-9 px-3 text-center">파일명</th>
|
||||
<th className="h-9 px-3 text-center">사용자 ID</th>
|
||||
<th className="h-9 px-3 text-center">업로드 건수</th>
|
||||
<th className="h-9 px-3 text-center">업로드 일시</th>
|
||||
<th className="h-9 px-3 text-center">다운로드</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{normalizedHistory.length === 0 && (
|
||||
<tr>
|
||||
<td className="px-3 h-12 text-center text-muted-foreground" colSpan={6}>
|
||||
<td className="h-12 px-3 text-center text-muted-foreground" colSpan={6}>
|
||||
업로드 이력이 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{normalizedHistory.map((item) => (
|
||||
<tr key={`${item.round}-${item.fileName}`} className="border-b last:border-b-0">
|
||||
<td className="px-3 h-10">{item.round}</td>
|
||||
<td className="px-3 h-10">{item.fileName}</td>
|
||||
<td className="px-3 h-10">{item.userId}</td>
|
||||
<td className="px-3 h-10 text-right">{item.uploadCount.toLocaleString()}</td>
|
||||
<td className="px-3 h-10">{item.uploadAtLabel}</td>
|
||||
<td className="px-3 h-10 text-center">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => onDownloadHistory?.(item)}
|
||||
disabled={!onDownloadHistory}
|
||||
>
|
||||
<tr key={item.listUploadLogId} className="border-b last:border-b-0">
|
||||
<td className="h-10 px-3 text-center">{item.wave}</td>
|
||||
<td className="h-10 px-3 text-center">{item.fileName}</td>
|
||||
<td className="h-10 px-3 text-center">{item.regUser}</td>
|
||||
<td className="h-10 px-3 text-center">{item.listCount.toLocaleString()}</td>
|
||||
<td className="h-10 px-3 text-center">{item.uploadAtLabel}</td>
|
||||
<td className="h-10 px-3 text-center">
|
||||
<Button type="button" size="sm" className="bg-excel" onClick={() => onDownloadHistory?.(item)}>
|
||||
<Download className="h-4 w-4" />
|
||||
다운로드
|
||||
</Button>
|
||||
</td>
|
||||
@@ -287,7 +391,7 @@ const ListUploadDialog = ({
|
||||
<Button type="button" variant="outline" onClick={() => handleDialogOpenChange(false)} disabled={submitting}>
|
||||
취소
|
||||
</Button>
|
||||
<Button type="button" onClick={handleSubmit} disabled={!selectedFile || submitting}>
|
||||
<Button type="button" onClick={handleSubmit} disabled={!selectedFile || submitting || hasHeaderMismatch}>
|
||||
{submitting ? '업로드 중...' : '업로드'}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
|
||||
@@ -91,7 +91,7 @@ const MessageHistoryDialog = ({
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-[1200px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="content-text-2xl font-bold">발송 이력</DialogTitle>
|
||||
<DialogTitle className="text-2xl font-bold">발송 이력</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="flex gap-2">
|
||||
@@ -165,7 +165,7 @@ const MessageHistoryDialog = ({
|
||||
</div>
|
||||
|
||||
<div className="rounded-md border p-4 space-y-3 min-h-80">
|
||||
<p className="content-text-lg font-semibold">
|
||||
<p className="text-lg font-semibold">
|
||||
{detailType === null && '상세 이력'}
|
||||
{detailType === 'template' && '미리보기'}
|
||||
{detailType === 'target' && '수신 대상'}
|
||||
|
||||
@@ -170,13 +170,13 @@ const MessageSendDialog = ({
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-[980px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="content-text-2xl font-bold">{titleMap[mode]}</DialogTitle>
|
||||
<DialogTitle className="text-2xl font-bold">{titleMap[mode]}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-lg font-semibold">템플릿</Label>
|
||||
<Label className="text-lg font-semibold">템플릿</Label>
|
||||
<Select value={templateId} onValueChange={handleTemplateChange}>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="템플릿을 선택해 주세요" />
|
||||
@@ -262,7 +262,7 @@ const MessageSendDialog = ({
|
||||
</div>
|
||||
|
||||
<div className="rounded-md border p-4 space-y-2">
|
||||
<p className="content-text-lg font-semibold">미리보기</p>
|
||||
<p className="text-lg font-semibold">미리보기</p>
|
||||
{!selectedTemplate && <p className="text-sm text-muted-foreground">선택된 템플릿이 없습니다.</p>}
|
||||
{selectedTemplate && (
|
||||
<>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'use client'
|
||||
'use client'
|
||||
|
||||
import {useState, useEffect, useMemo} from 'react'
|
||||
import {
|
||||
@@ -15,11 +15,10 @@ import {Button} from "@/components/ui/button";
|
||||
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
|
||||
import {useDialog} from "@/hooks/useDialog";
|
||||
import type {DialogId} from "@/store/jotai/dialog";
|
||||
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@/const/commonConst";
|
||||
import {apiError} from "@/lib/http-util";
|
||||
import {IntranetProjectSearchResponse, ProjectCreateRequest} from "@/types/project";
|
||||
import {useDebouncedValue} from "@/hooks/useDebouncedValue";
|
||||
import {nextApi} from "@/lib/http-client";
|
||||
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@kri/common/http";
|
||||
import {apiError} from "@kri/common/http";
|
||||
import {ProjectCreateRequest} from "@/types/project";
|
||||
import { useDebouncedValue } from "@kri/common/hooks";
|
||||
import {PROJECT_NAME_REGEX} from "@/const/projectConst";
|
||||
import {FW_TEAM, USER_NAME_REGEX} from "@/const/userConst";
|
||||
import {MultiSelectOption} from "@/components/ui/multi-select";
|
||||
@@ -27,10 +26,10 @@ import {ItrntUserInfo} from "@/types/user";
|
||||
import {useIntranetProjectListQuery} from "@/query/intranet";
|
||||
|
||||
export type ProjectCreateDialogProps = {
|
||||
/** Jotai로 관리할 다이얼로그 ID (기본값: 'userUpsertDialog') */
|
||||
/** Jotai로 관리할 다이얼로그 ID */
|
||||
dialogId?: DialogId
|
||||
|
||||
/** 필요하면 여전히 외부에서 open 제어도 가능하게 */
|
||||
/** 필요한 경우 부모에서 직접 open 제어 */
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
users:ItrntUserInfo[]
|
||||
@@ -58,7 +57,7 @@ const ProjectCreateDialog = ({
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [formData, setFormData] = useState<ProjectCreateRequest>(defaultProjectInfo);
|
||||
|
||||
// 실제로 Dialog에 넘길 open 값 (외부 open 있으면 우선)
|
||||
// 실제 Dialog에 전달할 open 값
|
||||
const resolvedOpen = open ?? isDialogOpen(dialogId);
|
||||
|
||||
const [itrntKeyword, setItrntKeyword] = useState('');
|
||||
@@ -67,12 +66,10 @@ const ProjectCreateDialog = ({
|
||||
const itrntPrjctListQuery = useIntranetProjectListQuery(debouncedKeyword, resolvedOpen);
|
||||
const itrntPrjctArray = useMemo(() => itrntPrjctListQuery.data ?? [] ,[itrntPrjctListQuery.data]);
|
||||
|
||||
// 실제 onOpenChange 핸들러 (외부 콜백 + jotai 둘 다 처리)
|
||||
// 부모 콜백과 jotai 상태를 함께 처리
|
||||
const handleOpenChange = (nextOpen: boolean) => {
|
||||
// 1) 외부에서 넘겨준 onOpenChange 먼저 호출
|
||||
onOpenChange?.(nextOpen);
|
||||
|
||||
// 2) jotai 전역 상태도 함께 업데이트
|
||||
if (nextOpen) {
|
||||
showDialog(dialogId);
|
||||
setItrntKeyword("");
|
||||
@@ -99,31 +96,31 @@ const ProjectCreateDialog = ({
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if(!formData.itrntPrjctCd.trim()){
|
||||
alert("인트라넷 프로젝트를 선택해 주세요");
|
||||
alert("Please select an intranet project.");
|
||||
return;
|
||||
}
|
||||
if (!formData.prjctName.trim()) {
|
||||
alert('프로젝트 명을 입력해 주세요');
|
||||
alert("Please enter project name.");
|
||||
return;
|
||||
}
|
||||
if (!PROJECT_NAME_REGEX.test(formData.prjctName)) {
|
||||
alert("프로젝트명에 허용되지 않는 문자가 포함되어 있습니다");
|
||||
alert("프로젝트명에 허용되지 않는 문자가 포함되어 있습니다.");
|
||||
return;
|
||||
}
|
||||
if(!formData.ownerDept.trim()){
|
||||
alert('담당 그룹을 입력해 주세요');
|
||||
alert("Please enter owner department.");
|
||||
return;
|
||||
}
|
||||
if(!USER_NAME_REGEX.test(formData.ownerDept)){
|
||||
alert('담당 그룹이 올바르지 않습니다.');
|
||||
alert("해당 그룹이 올바르지 않습니다.");
|
||||
return;
|
||||
}
|
||||
if(!formData.ownerFw.trim()){
|
||||
alert('담당 SV를 입력해 주세요');
|
||||
alert("Please enter owner department.");
|
||||
return;
|
||||
}
|
||||
if(!USER_NAME_REGEX.test(formData.ownerDept)){
|
||||
alert('담당 SV가 올바르지 않습니다.');
|
||||
alert("해당 SV가 올바르지 않습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -132,12 +129,14 @@ const ProjectCreateDialog = ({
|
||||
await onSubmit(formData as ProjectCreateRequest);
|
||||
handleOpenChange(false);
|
||||
} catch (e) {
|
||||
const err = apiError(e);
|
||||
const err = apiError(e, {
|
||||
fallbackMessage: "Save failed.",
|
||||
});
|
||||
if(err.code !== NONE_HTTP_ERROR && err.code !== UNKNOWN_HTTP_ERROR){
|
||||
alert(err.message);
|
||||
}
|
||||
else{
|
||||
alert('저장에 실패했습니다.');
|
||||
alert("저장에 실패했습니다.");
|
||||
}
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
@@ -167,12 +166,12 @@ const ProjectCreateDialog = ({
|
||||
|
||||
return (
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-[500px] content-text-sm">
|
||||
<DialogContent className="sm:max-w-[500px] text-sm">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="content-text-sxl">
|
||||
<DialogTitle className="text-xl">
|
||||
프로젝트 생성
|
||||
</DialogTitle>
|
||||
<DialogDescription>프로젝트 생성에 필요한 기본정보를 입력해주세요.</DialogDescription>
|
||||
<DialogDescription>프로젝트 생성에 필요한 기본 정보를 입력해주세요.</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="grid gap-6 py-4">
|
||||
<div className="grid gap-2">
|
||||
@@ -194,11 +193,11 @@ const ProjectCreateDialog = ({
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="prjctName">
|
||||
프로젝트 명<span className="text-red-500 ml-1">*</span>
|
||||
Project name<span className="text-red-500 ml-1">*</span>
|
||||
</Label>
|
||||
<Input
|
||||
id="prjctName"
|
||||
placeholder="프로젝트명을 입력하세요"
|
||||
placeholder="Enter project name"
|
||||
value={formData.prjctName}
|
||||
onChange={(e) => handleInputChange('prjctName', e.target.value)}
|
||||
/>
|
||||
@@ -211,7 +210,7 @@ const ProjectCreateDialog = ({
|
||||
items={deptArray}
|
||||
value={formData.ownerDept || ''}
|
||||
onChange={(value) => handleInputChange('ownerDept', value)}
|
||||
placeholder="담당 그룹을 선택하세요"
|
||||
placeholder="Select owner department"
|
||||
heightClassName="h-9"
|
||||
widthClassName="w-full"
|
||||
/>
|
||||
@@ -226,7 +225,7 @@ const ProjectCreateDialog = ({
|
||||
onChange={(value) => handleInputChange('ownerFw', value)}
|
||||
getValue={(item) => item.value}
|
||||
getLabel={(item) => item.label}
|
||||
placeholder="담당 실사를 선택하세요"
|
||||
placeholder="Select owner department"
|
||||
heightClassName="h-9"
|
||||
widthClassName="w-full"
|
||||
/>
|
||||
@@ -253,4 +252,4 @@ const ProjectCreateDialog = ({
|
||||
);
|
||||
}
|
||||
|
||||
export default ProjectCreateDialog
|
||||
export default ProjectCreateDialog
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Input } from '@/components/ui/input'
|
||||
import {Trash2, Plus, Download} from 'lucide-react'
|
||||
import {ProjectInfo, ResultCode, ResultCodeType} from "@/types/project";
|
||||
import {PROJECT_SEARCH_COUNT, RESULT_CODE_TYPE_OPTIONS} from "@/const/projectConst";
|
||||
import {useDebouncedValue} from "@/hooks/useDebouncedValue";
|
||||
import { useDebouncedValue } from "@kri/common/hooks";
|
||||
import {SelectedProject} from "@/store/jotai/project";
|
||||
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
|
||||
import {useSelectedProject} from "@/hooks/useSelectedProject";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'use client'
|
||||
'use client'
|
||||
|
||||
import {
|
||||
Dialog,
|
||||
@@ -12,13 +12,13 @@ import { useState, useRef } from 'react'
|
||||
import {Download, Upload, X} from 'lucide-react'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import type { DialogId } from '@/store/jotai/dialog'
|
||||
import {apiError} from "@/lib/http-util";
|
||||
import {apiError} from "@kri/common/http";
|
||||
|
||||
export type UserUploadDialogProps = {
|
||||
/** jotai로 관리할 dialog id (기본값: 'userUploadDialog') */
|
||||
/** jotai로 관리할 dialog id */
|
||||
dialogId?: DialogId
|
||||
|
||||
/** 필요하면 부모에서 직접 제어도 가능 */
|
||||
/** 필요한 경우 부모에서 직접 제어 */
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
|
||||
@@ -39,15 +39,13 @@ const UserUploadDialog = ({
|
||||
const [selectedFile, setSelectedFile] = useState<File | null>(null);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
//실제 Dialog에 넘길 open값 (props 우선, 없으면 jotai 사용)
|
||||
// 실제 Dialog에 전달할 open 값
|
||||
const resolvedOpen = open ?? isDialogOpen(dialogId);
|
||||
|
||||
// open change 공통 처리 (부모 콜백 + jotai 동시 반영)
|
||||
// 부모 콜백과 jotai 상태를 함께 처리
|
||||
const handleOpenChange = (nextOpen: boolean) => {
|
||||
// 1) 부모 콜백 먼저
|
||||
onOpenChange?.(nextOpen)
|
||||
|
||||
// 2) jotai 상태 업데이트
|
||||
if (nextOpen) {
|
||||
showDialog(dialogId)
|
||||
} else {
|
||||
@@ -72,7 +70,7 @@ const UserUploadDialog = ({
|
||||
) {
|
||||
setSelectedFile(file)
|
||||
} else {
|
||||
alert('엑셀 파일만 업로드 가능합니다. (.xlsx, .xls, .csv)')
|
||||
alert("엑셀 파일만 업로드 가능합니다. (.xlsx, .xls, .csv)")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +98,9 @@ const UserUploadDialog = ({
|
||||
handleRemoveFile();
|
||||
handleOpenChange(false);
|
||||
} catch (e) {
|
||||
const err = apiError(e);
|
||||
const err = apiError(e, {
|
||||
fallbackMessage: "File upload failed.",
|
||||
});
|
||||
console.error(err.status, err.code, err.message);
|
||||
alert("업로드에 실패했습니다.");
|
||||
} finally {
|
||||
@@ -108,7 +108,7 @@ const UserUploadDialog = ({
|
||||
}
|
||||
};
|
||||
|
||||
// ✅ Dialog에서 닫힐 때: 파일도 초기화 + 상태 닫기
|
||||
// Dialog가 닫힐 때 파일 선택 상태 초기화
|
||||
const handleDialogOpenChange = (nextOpen: boolean) => {
|
||||
if (!nextOpen) {
|
||||
handleRemoveFile()
|
||||
@@ -120,7 +120,7 @@ const UserUploadDialog = ({
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleDialogOpenChange}>
|
||||
<DialogContent className="sm:max-w-[600px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className=" content-text-2xl font-bold">엑셀 업로드</DialogTitle>
|
||||
<DialogTitle className=" text-2xl font-bold">User upload</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-6 py-4">
|
||||
@@ -129,7 +129,7 @@ const UserUploadDialog = ({
|
||||
<Button
|
||||
type="button"
|
||||
variant="default"
|
||||
className="content-text-lg bg-excel"
|
||||
className="text-lg bg-excel"
|
||||
onClick={onDownloadTemplate}
|
||||
>
|
||||
<Download className="w-4 h-4 mr-2" />
|
||||
@@ -138,11 +138,11 @@ const UserUploadDialog = ({
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="flex-1 content-text-lg w-full"
|
||||
className="flex-1 text-lg w-full"
|
||||
onClick={handleUploadClick}
|
||||
>
|
||||
<Upload className="w-4 h-4 mr-2" />
|
||||
{selectedFile ? selectedFile.name : '선택된 파일 없음'}
|
||||
{selectedFile ? selectedFile.name : "선택된 파일 없음"}
|
||||
</Button>
|
||||
<div className="w-9 h-8">
|
||||
{selectedFile && (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'use client'
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import {
|
||||
@@ -18,16 +18,16 @@ import { UserInfoSaveRequest } from '@/types/user'
|
||||
import KriPassword from "@/components/common/KriPassword";
|
||||
import {KriSelect, KriSelectItem} from "@/components/common/KriSelect";
|
||||
import {DataVerification} from "@/types/common";
|
||||
import {apiError} from "@/lib/http-util";
|
||||
import {apiError} from "@kri/common/http";
|
||||
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
|
||||
import {FW_TEAM, USER_NAME_REGEX} from "@/const/userConst";
|
||||
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@/const/commonConst";
|
||||
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@kri/common/http";
|
||||
|
||||
export type UserUpsertDialogProps = {
|
||||
/** Jotai로 관리할 다이얼로그 ID (기본값: 'userUpsertDialog') */
|
||||
/** Jotai로 관리할 다이얼로그 ID */
|
||||
dialogId?: DialogId
|
||||
|
||||
/** 필요하면 여전히 외부에서 open 제어도 가능하게 */
|
||||
/** 필요한 경우 부모에서 직접 open 제어 */
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
|
||||
@@ -71,15 +71,13 @@ const UserUpsertDialog = ({
|
||||
const [isCheckedDuplicate, setIsCheckedDuplicate] = useState(false);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
|
||||
// 🔹 실제로 Dialog에 넘길 open 값 (외부 open 있으면 우선)
|
||||
// 실제 Dialog에 전달할 open 값
|
||||
const resolvedOpen = open ?? isDialogOpen(dialogId);
|
||||
|
||||
// 🔹 실제 onOpenChange 핸들러 (외부 콜백 + jotai 둘 다 처리)
|
||||
// 부모 콜백과 jotai 상태를 함께 처리
|
||||
const handleOpenChange = (nextOpen: boolean) => {
|
||||
// 1) 외부에서 넘겨준 onOpenChange 먼저 호출
|
||||
onOpenChange?.(nextOpen);
|
||||
|
||||
// 2) jotai 전역 상태도 함께 업데이트
|
||||
if (nextOpen) {
|
||||
showDialog(dialogId);
|
||||
} else {
|
||||
@@ -117,7 +115,7 @@ const UserUpsertDialog = ({
|
||||
|
||||
const handleCheckDuplicate = async () => {
|
||||
if (!formData.userId.trim()) {
|
||||
alert('아이디를 입력해주세요.');
|
||||
alert("아이디를 입력해주세요.");
|
||||
return
|
||||
}
|
||||
|
||||
@@ -127,7 +125,7 @@ const UserUpsertDialog = ({
|
||||
alert(isDuplicate.errMessage);
|
||||
setIsCheckedDuplicate(false);
|
||||
} else {
|
||||
alert('사용 가능한 아이디입니다.');
|
||||
alert("사용 가능한 아이디입니다.");
|
||||
setIsCheckedDuplicate(true);
|
||||
}
|
||||
} else {
|
||||
@@ -137,23 +135,23 @@ const UserUpsertDialog = ({
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!formData.userId.trim()) {
|
||||
alert('아이디를 입력해주세요.');
|
||||
alert("아이디를 입력해주세요.");
|
||||
return;
|
||||
}
|
||||
if (mode === 'create' && !isCheckedDuplicate) {
|
||||
alert('아이디 중복체크를 해주세요.');
|
||||
alert("아이디 중복체크를 해주세요.");
|
||||
return;
|
||||
}
|
||||
if (!formData.userPw.trim()) {
|
||||
alert('비밀번호를 입력해주세요.');
|
||||
alert("비밀번호를 입력해주세요.");
|
||||
return;
|
||||
}
|
||||
if (!formData.userName.trim()) {
|
||||
alert('이름을 입력해주세요.');
|
||||
alert("이름을 입력해주세요.");
|
||||
return;
|
||||
}
|
||||
if(!USER_NAME_REGEX.test(formData.userName)){
|
||||
alert('올바르지 않은 이름입니다.');
|
||||
alert("올바르지 않은 이름입니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -165,13 +163,15 @@ const UserUpsertDialog = ({
|
||||
await onSubmit(formData as UserInfoSaveRequest);
|
||||
handleOpenChange(false);
|
||||
} catch (e) {
|
||||
const err = apiError(e);
|
||||
const err = apiError(e, {
|
||||
fallbackMessage: "Save failed.",
|
||||
});
|
||||
console.error(err.status, err.code, err.message);
|
||||
if(err.code !== NONE_HTTP_ERROR && err.code !== UNKNOWN_HTTP_ERROR){
|
||||
alert(err.message);
|
||||
}
|
||||
else{
|
||||
alert('저장에 실패했습니다.');
|
||||
alert("저장에 실패했습니다.");
|
||||
}
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
@@ -180,9 +180,9 @@ const UserUpsertDialog = ({
|
||||
|
||||
return (
|
||||
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-[500px] content-text-sm">
|
||||
<DialogContent className="sm:max-w-[500px] text-sm">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="content-text-sxl">
|
||||
<DialogTitle className="text-xl">
|
||||
{mode === 'create' ? '계정 등록' : '계정 수정'}
|
||||
</DialogTitle>
|
||||
<DialogDescription>면접원 계정 정보를 입력해주세요.</DialogDescription>
|
||||
@@ -195,7 +195,7 @@ const UserUpsertDialog = ({
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
id="userId"
|
||||
placeholder="아이디를 입력하세요"
|
||||
placeholder="Enter ID"
|
||||
value={formData.userId}
|
||||
onChange={(e) => handleInputChange('userId', e.target.value)}
|
||||
disabled={mode === 'edit'}
|
||||
@@ -206,7 +206,7 @@ const UserUpsertDialog = ({
|
||||
onClick={handleCheckDuplicate}
|
||||
disabled={!formData.userId.trim() || isCheckedDuplicate}
|
||||
>
|
||||
{isCheckedDuplicate ? '확인완료' : '중복체크'}
|
||||
{isCheckedDuplicate ? "확인완료" : "중복체크"}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -219,7 +219,7 @@ const UserUpsertDialog = ({
|
||||
id="password"
|
||||
value={formData.userPw}
|
||||
onChange={(v) => handleInputChange('userPw', v)}
|
||||
placeholder="비밀번호를 입력하세요"
|
||||
placeholder="Enter password"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
@@ -228,7 +228,7 @@ const UserUpsertDialog = ({
|
||||
</Label>
|
||||
<Input
|
||||
id="userName"
|
||||
placeholder="이름을 입력하세요"
|
||||
placeholder="Enter name"
|
||||
value={formData.userName}
|
||||
onChange={(e) => handleInputChange('userName', e.target.value)}
|
||||
/>
|
||||
@@ -240,7 +240,7 @@ const UserUpsertDialog = ({
|
||||
value={String(formData.userRole)}
|
||||
onChange={(e) => {
|
||||
if(mode !== 'create'){
|
||||
alert("권한이 변경되면 해당 계정에 배정된 리스트 정보가 초기화 됩니다.");
|
||||
alert("권한이 변경되면 해당 계정에 배정된 리스트 정보가 초기화됩니다.");
|
||||
}
|
||||
|
||||
handleInputChange('userRole', Number(e));
|
||||
@@ -267,7 +267,7 @@ const UserUpsertDialog = ({
|
||||
:
|
||||
<Input
|
||||
id="userCmpn"
|
||||
placeholder="소속 회사를 입력하세요"
|
||||
placeholder="Enter company"
|
||||
value={formData.userCmpn}
|
||||
disabled={!isInternal}
|
||||
onChange={(e) => handleInputChange('userCmpn', e.target.value)}
|
||||
@@ -279,7 +279,7 @@ const UserUpsertDialog = ({
|
||||
<Label htmlFor="memo">메모</Label>
|
||||
<textarea id="memo" className="flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
rows={3}
|
||||
placeholder="메모를 입력하세요"
|
||||
placeholder="Enter memo"
|
||||
value={formData.memo}
|
||||
onChange={(e) => handleInputChange('memo', e.target.value)}
|
||||
/>
|
||||
@@ -298,7 +298,7 @@ const UserUpsertDialog = ({
|
||||
onClick={handleSubmit}
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
{mode === 'create' ? '등록' : '수정'}
|
||||
{mode === 'create' ? "등록" : "수정"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
@@ -306,4 +306,4 @@ const UserUpsertDialog = ({
|
||||
)
|
||||
}
|
||||
|
||||
export default UserUpsertDialog
|
||||
export default UserUpsertDialog
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
import * as React from "react";
|
||||
import { toast } from "sonner";
|
||||
import { cn } from "@kri/common/ui";
|
||||
|
||||
import type { KriEditorProps } from "./types";
|
||||
import { cn } from "./utils/cn";
|
||||
import { compressImage } from "./utils/imageCompression";
|
||||
import { useDebouncedChange } from "./hooks/useDebouncedChange";
|
||||
import { sanitizeHtmlForPreview } from "./utils/sanitizeHtml";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { cn } from "./utils/cn"; // 기존 "@/lib/utils" 제거
|
||||
import { cn } from "@kri/common/ui";
|
||||
import type { KriEditorProps } from "./types";
|
||||
import { useDebouncedChange } from "./hooks/useDebouncedChange";
|
||||
import { useTextareaInsert } from "./hooks/useTextareaInsert";
|
||||
@@ -192,4 +192,4 @@ export function KriEditorSms(props: SmsEditorProps) {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -18,11 +18,11 @@ import TableHeader from "@tiptap/extension-table-header";
|
||||
import TableCell from "@tiptap/extension-table-cell";
|
||||
|
||||
import { toast } from "sonner";
|
||||
import { cn } from "@kri/common/ui";
|
||||
|
||||
import type { KriEditorProps, KriEditorMode, ToolbarState } from "./types";
|
||||
import { FontSize } from "./extensions/font-size";
|
||||
import { Div } from "./extensions/div";
|
||||
import { cn } from "./utils/cn";
|
||||
import { compressImage } from "./utils/imageCompression";
|
||||
import { sanitizeHtml } from "./utils/sanitizeHtml";
|
||||
import { Toolbar } from "./toolbar/Toolbar";
|
||||
|
||||
@@ -3,7 +3,8 @@ import { Extension } from "@tiptap/core";
|
||||
declare module "@tiptap/core" {
|
||||
interface Commands<ReturnType> {
|
||||
fontSize: {
|
||||
setFontSize: (fontSize: string | null) => ReturnType;
|
||||
setFontSize: (fontSize: string) => ReturnType;
|
||||
unsetFontSize: () => ReturnType;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -17,7 +18,7 @@ export const FontSize = Extension.create({
|
||||
attributes: {
|
||||
fontSize: {
|
||||
default: null as string | null,
|
||||
parseHTML: (element) => (element as HTMLElement).style.fontSize || null,
|
||||
parseHTML: (element) => (element).style.fontSize || null,
|
||||
renderHTML: (attributes) => {
|
||||
if (!attributes.fontSize) return {};
|
||||
return { style: `font-size:${attributes.fontSize}` };
|
||||
@@ -33,11 +34,13 @@ export const FontSize = Extension.create({
|
||||
setFontSize:
|
||||
(fontSize) =>
|
||||
({ chain }) => {
|
||||
if (!fontSize) {
|
||||
return chain().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run();
|
||||
}
|
||||
return chain().setMark("textStyle", { fontSize }).run();
|
||||
},
|
||||
unsetFontSize:
|
||||
() =>
|
||||
({ chain }) => {
|
||||
return chain().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run();
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { cn } from "../utils/cn";
|
||||
import { cn } from "@kri/common/ui";
|
||||
import {
|
||||
AlignCenter,
|
||||
AlignLeft,
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
export function cn(...inputs: Array<string | undefined | null | false>) {
|
||||
return inputs.filter(Boolean).join(" ");
|
||||
}
|
||||
@@ -1,15 +1,28 @@
|
||||
export function sanitizeHtml(input: string): string {
|
||||
if (!input) return "";
|
||||
"use client";
|
||||
|
||||
let s = input.replace(/<\s*script[^>]*>[\s\S]*?<\s*\/\s*script\s*>/gi, "");
|
||||
s = s.replace(/<\s*style[^>]*>[\s\S]*?<\s*\/\s*style\s*>/gi, "");
|
||||
s = s.replace(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi, "");
|
||||
s = s.replace(/\s(href|src)\s*=\s*("|')\s*javascript:[^"']*("|')/gi, ' $1="#"');
|
||||
import DOMPurify from "dompurify";
|
||||
|
||||
return s;
|
||||
const HTML_PROFILE = {
|
||||
USE_PROFILES: {
|
||||
html: true,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export function sanitizeHtml(
|
||||
input: string,
|
||||
): string {
|
||||
if (!input) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return DOMPurify.sanitize(
|
||||
input,
|
||||
HTML_PROFILE,
|
||||
);
|
||||
}
|
||||
|
||||
// 기존 코드 호환용
|
||||
export function sanitizeHtmlForPreview(input: string): string {
|
||||
export function sanitizeHtmlForPreview(
|
||||
input: string,
|
||||
): string {
|
||||
return sanitizeHtml(input);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ interface BodyTitleProps {
|
||||
const BodyTitle = ({titleText}:BodyTitleProps) => {
|
||||
return (
|
||||
<div className="flex justify-between items-center">
|
||||
<h1 className="font-bold content-text-2xl">{titleText}</h1>
|
||||
<h1 className="font-bold text-2xl">{titleText}</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,12 +7,15 @@ import Image from "next/image";
|
||||
import { topMenus } from "@/config/menu.data";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import type {LoginUser} from "@/types/auth";
|
||||
import {useEffect, useState} from "react";
|
||||
import {useEffect, useMemo, useState} from "react";
|
||||
import {useSelectedProject} from "@/hooks/useSelectedProject";
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
|
||||
interface HeaderProps {
|
||||
isMain: boolean;
|
||||
menuOpen: boolean;
|
||||
activeTopId: string;
|
||||
isViewProjectTitle: boolean;
|
||||
fontSize: number;
|
||||
onToggleMenu: () => void;
|
||||
onNavigate: (path: string) => void;
|
||||
@@ -24,6 +27,7 @@ export const Header = ({
|
||||
isMain,
|
||||
menuOpen,
|
||||
activeTopId,
|
||||
isViewProjectTitle,
|
||||
fontSize,
|
||||
onToggleMenu,
|
||||
onNavigate,
|
||||
@@ -32,16 +36,21 @@ export const Header = ({
|
||||
}: HeaderProps) => {
|
||||
const router = useRouter();
|
||||
const { auth } = useAuth();
|
||||
const mounted = useMounted();
|
||||
const [userInfo, setUserInfo] = useState<LoginUser|undefined>(undefined);
|
||||
const { selectedProject } = useSelectedProject();
|
||||
const projectName = useMemo(() => selectedProject?.prjctName ?? "", [selectedProject]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!mounted) return;
|
||||
|
||||
if(auth.user){
|
||||
setUserInfo(auth.user);
|
||||
}
|
||||
else{
|
||||
router.replace("/logout");
|
||||
}
|
||||
}, [auth.user])
|
||||
}, [auth.user, mounted, router])
|
||||
|
||||
return (
|
||||
<header className="bg-white border-b border-gray-200 sticky top-0 z-40">
|
||||
@@ -89,7 +98,11 @@ export const Header = ({
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-grow justify-center">
|
||||
{isViewProjectTitle && projectName &&
|
||||
<h1 className="font-bold text-2xl ml-3">{projectName}</h1>
|
||||
}
|
||||
</div>
|
||||
{/* 우측 컨트롤 */}
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="flex items-center gap-1 border-r pr-4">
|
||||
@@ -127,4 +140,4 @@ export const Header = ({
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@ import { Header } from "@/components/layout/Header";
|
||||
import { Sidebar } from "@/components/layout/Sidebar";
|
||||
import {useFontSize} from "@/hooks/useFontSize";
|
||||
import {projectSideMenus, manageSideMenus, topMenus} from "@/config/menu.data";
|
||||
import ProjectTitle from "@/components/layout/ProjectTitle";
|
||||
import {cn} from "@/lib/utils";
|
||||
import {FONT_SIZE} from "@/const/commonConst";
|
||||
import {useSelectedProject} from "@/hooks/useSelectedProject";
|
||||
@@ -20,7 +19,7 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
|
||||
const { selectedProject } = useSelectedProject();
|
||||
const { selectedProject, isSelectedProjectHydrated } = useSelectedProject();
|
||||
const [menuOpen, setMenuOpen] = useState(true);
|
||||
const [fontSize, setFontSize] = useFontSize(initialFontSize, { hydrateFromCookie: false });
|
||||
|
||||
@@ -60,21 +59,14 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
|
||||
setFontSize(Math.min(FONT_SIZE.MAX, fontSize + 2));
|
||||
}
|
||||
|
||||
// CSS 변수 동기화
|
||||
useEffect(() => {
|
||||
if (typeof document === "undefined") return;
|
||||
document.documentElement.style.setProperty(
|
||||
"--content-font-size",
|
||||
`${fontSize}px`,
|
||||
);
|
||||
}, [fontSize]);
|
||||
if (!isSelectedProjectHydrated) return;
|
||||
|
||||
useEffect(() => {
|
||||
if(!isMain && isProjectMenu && !selectedProject){
|
||||
alert("옳지 않은 접근입니다.");
|
||||
router.replace("/");
|
||||
}
|
||||
}, []);
|
||||
}, [isMain, isProjectMenu, isSelectedProjectHydrated, router, selectedProject]);
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -88,6 +80,7 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
|
||||
isMain={isMain}
|
||||
menuOpen={menuOpen}
|
||||
activeTopId={activeTop.id}
|
||||
isViewProjectTitle={isViewProjectTitle}
|
||||
fontSize={fontSize}
|
||||
onToggleMenu={() => setMenuOpen((prev) => !prev)}
|
||||
onNavigate={movePage}
|
||||
@@ -120,9 +113,6 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
|
||||
// SSR 단계에서의 초기 폰트 값을 FOUC 없이 유지하기 위해 fallback을 함께 지정
|
||||
style={{ fontSize: `var(--content-font-size, ${initialFontSize}px)` }}
|
||||
>
|
||||
{isViewProjectTitle &&
|
||||
<ProjectTitle/>
|
||||
}
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
@@ -138,4 +128,4 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default MainLayout;
|
||||
export default MainLayout;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import {useSelectedProject} from "@/hooks/useSelectedProject";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
|
||||
const ProjectTitle = () => {
|
||||
const mounted = useMounted();
|
||||
const { selectedProject } = useSelectedProject();
|
||||
|
||||
if(!mounted) return null;
|
||||
|
||||
return (
|
||||
<div className="flex justify-between items-center mb-2">
|
||||
<h1 className="font-bold content-text-2xl">{selectedProject?.prjctName}</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProjectTitle
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ChevronDown } from "lucide-react";
|
||||
import { SideMenuItem } from "@/config/menu.types";
|
||||
import {SidebarProjectSearch} from "@/components/layout/SidebarProjectSearch ";
|
||||
import {SidebarProjectSearch} from "@/components/layout/SidebarProjectSearch";
|
||||
|
||||
interface SidebarProps {
|
||||
isProjectMenu: boolean;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import {useDebouncedValue} from "@/hooks/useDebouncedValue";
|
||||
import { useDebouncedValue, useMounted } from "@kri/common/hooks";
|
||||
import {useMemo, useState} from "react";
|
||||
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
|
||||
import {useSelectedProject} from "@/hooks/useSelectedProject";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import {PROJECT_SEARCH_COUNT} from "@/const/projectConst";
|
||||
import {SelectedProject} from "@/store/jotai/project";
|
||||
import {useProjectTopQuery} from "@/query/project";
|
||||
@@ -37,7 +36,7 @@ export const SidebarProjectSearch = () =>{
|
||||
searchMode="inputOnly"
|
||||
onSearchValueChange={setSearchKeyword}
|
||||
placeholder="프로젝트 검색..."
|
||||
spanClassName="content-text-sm"
|
||||
spanClassName="text-sm"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
preventDeselect
|
||||
@@ -47,4 +46,4 @@ export const SidebarProjectSearch = () =>{
|
||||
getValue={(item) => String(item.prjctIdx)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,8 @@ import {Input} from "@/components/ui/input";
|
||||
import {Checkbox} from "@/components/ui/checkbox";
|
||||
import {KriEditor, KriEditorCommand} from "@/components/kri-editor";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {cn, isBlank} from "@/lib/utils";
|
||||
import { isBlank } from "@kri/common";
|
||||
import {cn} from "@/lib/utils";
|
||||
import {ProjectMainTemplateUpdateRequest} from "@/types/project";
|
||||
import { DataVerification } from "@/types/common";
|
||||
import {
|
||||
@@ -263,7 +264,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
>
|
||||
<Card>
|
||||
<CardHeader className="border-b">
|
||||
<CardTitle className="text-center content-text-lg font-bold">
|
||||
<CardTitle className="text-center text-lg font-bold">
|
||||
{pageTitle}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
@@ -277,7 +278,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label htmlFor="tmplatNm" className="content-text-base">
|
||||
<Label htmlFor="tmplatNm" className="text-base">
|
||||
템플릿
|
||||
</Label>
|
||||
|
||||
@@ -287,7 +288,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
checked={mainDesired}
|
||||
onClick={toggleMainTemplate}
|
||||
/>
|
||||
<label htmlFor="mainTemplate" className="content-text-base cursor-pointer">
|
||||
<label htmlFor="mainTemplate" className="text-base cursor-pointer">
|
||||
대표 템플릿
|
||||
</label>
|
||||
</div>
|
||||
@@ -310,7 +311,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
|
||||
{isSms && (
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">타입</Label>
|
||||
<Label className="text-base">타입</Label>
|
||||
<KriSingleSelect
|
||||
items={[...SMS_TYPE_OPTIONS]}
|
||||
value={String(selectedTemplate.tmplatTy || MessageType.SMS)}
|
||||
@@ -325,7 +326,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
)}
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="tmplatNm" className="content-text-base">
|
||||
<Label htmlFor="tmplatNm" className="text-base">
|
||||
템플릿 명
|
||||
</Label>
|
||||
<Input
|
||||
@@ -337,7 +338,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="tmplatTitle" className="content-text-base">
|
||||
<Label htmlFor="tmplatTitle" className="text-base">
|
||||
제목
|
||||
</Label>
|
||||
<Input
|
||||
@@ -350,15 +351,15 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center">
|
||||
<Label className="content-text-base">변수 리스트</Label>
|
||||
<Label className="text-base">변수 리스트</Label>
|
||||
</div>
|
||||
|
||||
<div className="border rounded-md overflow-hidden">
|
||||
<div className="bg-blue-100 grid grid-cols-2 border-b">
|
||||
<div className="py-2 px-3 text-center font-medium border-r content-text-base">
|
||||
<div className="py-2 px-3 text-center font-medium border-r text-base">
|
||||
리스트 헤더명
|
||||
</div>
|
||||
<div className="py-2 px-3 text-center font-medium content-text-base">
|
||||
<div className="py-2 px-3 text-center font-medium text-base">
|
||||
치환 문자
|
||||
</div>
|
||||
</div>
|
||||
@@ -375,10 +376,10 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
handleVariableClick(placeholder);
|
||||
}}
|
||||
>
|
||||
<div className="py-2 px-3 text-center border-r content-text-base">
|
||||
<div className="py-2 px-3 text-center border-r text-base">
|
||||
{h.listHderNm}
|
||||
</div>
|
||||
<div className="py-2 px-3 text-center content-text-base">
|
||||
<div className="py-2 px-3 text-center text-base">
|
||||
{placeholder}
|
||||
</div>
|
||||
</div>
|
||||
@@ -391,7 +392,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
{selectedTemplate ? (
|
||||
isSmsTemplate(selectedTemplate) ? (
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="sendTel" className="content-text-base">
|
||||
<Label htmlFor="sendTel" className="text-base">
|
||||
발신 번호
|
||||
</Label>
|
||||
<Input
|
||||
@@ -401,13 +402,13 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
placeholder="발신 번호를 입력하세요"
|
||||
className="w-full"
|
||||
/>
|
||||
<p className="content-text-sm text-red-600 font-medium">
|
||||
<p className="text-sm text-red-600 font-medium">
|
||||
⚠️ 비즈 뿌리오에 등록된 발신 번호가 아니면 전송되지 않습니다.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="sendEmail" className="content-text-base">
|
||||
<Label htmlFor="sendEmail" className="text-base">
|
||||
발신 이메일
|
||||
</Label>
|
||||
<Input
|
||||
@@ -422,7 +423,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
) : null}
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="sendNm" className="content-text-base">
|
||||
<Label htmlFor="sendNm" className="text-base">
|
||||
발신자 명
|
||||
</Label>
|
||||
<Input
|
||||
@@ -488,4 +489,4 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
|
||||
);
|
||||
};
|
||||
|
||||
export default MessageTemplate;
|
||||
export default MessageTemplate;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { Provider as JotaiProvider } from "jotai";
|
||||
import { LoadingOverlay } from "@/components/common/LoadingOverlay";
|
||||
import { QueryProvider } from "./QueryProvider";
|
||||
import { QueryProvider } from "@kri/common/query";
|
||||
import { QueryLoadingSync } from "./QueryLoadingSync";
|
||||
|
||||
export function AppProvider({ children }: { children: React.ReactNode }) {
|
||||
@@ -15,4 +15,4 @@ export function AppProvider({ children }: { children: React.ReactNode }) {
|
||||
</QueryProvider>
|
||||
</JotaiProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useIsFetching, useIsMutating } from "@tanstack/react-query";
|
||||
import { QueryLoadingSync as CommonQueryLoadingSync } from "@kri/common/query";
|
||||
import { useSetAtom } from "jotai";
|
||||
import { queryLoadingAtom } from "@/store/jotai/loading";
|
||||
|
||||
export function QueryLoadingSync() {
|
||||
const fetching = useIsFetching({
|
||||
predicate: (q) => !q.options.meta?.ignoreGlobalLoading,
|
||||
});
|
||||
const mutating = useIsMutating();
|
||||
const [, setQueryLoading] = useAtom(queryLoadingAtom);
|
||||
const setQueryLoading = useSetAtom(queryLoadingAtom);
|
||||
|
||||
useEffect(() => {
|
||||
setQueryLoading(fetching + mutating > 0);
|
||||
}, [fetching, mutating, setQueryLoading]);
|
||||
|
||||
return null;
|
||||
}
|
||||
return <CommonQueryLoadingSync onLoadingChange={setQueryLoading} />;
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
|
||||
export function QueryProvider({ children }: { children: React.ReactNode }) {
|
||||
const [client] = useState(
|
||||
() =>
|
||||
new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
retry: 1,
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
staleTime: 30_000,
|
||||
gcTime: 5 * 60_000,
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
return <QueryClientProvider client={client}>{children}</QueryClientProvider>;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { DataTableColumn } from "@/components/data-table/DataTable.type";
|
||||
import {ListContactResult, listHeader, ListResultBase, ListSendResult} from "@/types/list";
|
||||
import { ListHeaderAssignConst, ListHeaderConst } from "@/const/listConst";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { formatKst } from "@/lib/utils";
|
||||
import { formatKst } from "@kri/common";
|
||||
import { ResultCode, ResultCodeType } from "@/types/project";
|
||||
|
||||
export type ListTableRow = Record<string, unknown>;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import {ProjectInfo} from "@/types/project";
|
||||
import {ColumnDef} from "@tanstack/react-table";
|
||||
import {Badge} from "@/components/ui/badge";
|
||||
import {cn, formatKst} from "@/lib/utils";
|
||||
import { formatKst } from "@kri/common";
|
||||
import {cn} from "@/lib/utils";
|
||||
import {PROJECT_STATUS_CLASS, PROJECT_STATUS_LABEL} from "@/const/projectConst";
|
||||
import {ItrntUserInfo} from "@/types/user";
|
||||
|
||||
@@ -50,4 +51,4 @@ export const getProjectColumns = (users:ItrntUserInfo[]): ColumnDef<ProjectInfo>
|
||||
cell: ({row}) => (formatKst(row.original.regDt ?? "", "date")),
|
||||
enableSorting: true,
|
||||
}
|
||||
];
|
||||
];
|
||||
|
||||
@@ -2,7 +2,7 @@ import {ColumnDef} from "@tanstack/react-table";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Pencil, Trash2} from "lucide-react";
|
||||
import {UserInfo} from "@/types/user";
|
||||
import {formatKst} from "@/lib/utils";
|
||||
import {formatKst} from "@kri/common";
|
||||
import {MultiSelectOption} from "@/components/ui/multi-select";
|
||||
|
||||
|
||||
@@ -77,4 +77,4 @@ export const getUserColumns = (actions: UserColumnsActions, userRoleArray:MultiS
|
||||
),
|
||||
enableSorting: false,
|
||||
},
|
||||
];
|
||||
];
|
||||
|
||||
@@ -11,7 +11,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
||||
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
||||
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
"placeholder-content-text-lg",
|
||||
"placeholder:text-lg",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -4,9 +4,4 @@ export const FONT_SIZE = {
|
||||
MAX: 24,
|
||||
} as const;
|
||||
|
||||
export const UNKNOWN_HTTP_ERROR = 'UNKNOWN_HTTP_ERROR';
|
||||
export const NONE_HTTP_ERROR = 'NONE_HTTP_ERROR';
|
||||
|
||||
export const ALLOW_REDIRECT = new Set(["complete", "screen", "quota"]);
|
||||
|
||||
export const DEFAULT_API_TIMEOUT_MS = 60_000;
|
||||
@@ -21,10 +21,11 @@ export const ListHeaderSpecificConst = {
|
||||
TEL_NUM: 21,
|
||||
EMAIL: 31,
|
||||
FILE: 81,
|
||||
CONTENT_ITEM: 91,
|
||||
} as const;
|
||||
|
||||
export const ListHeaderConst = {
|
||||
TEXT: 91,
|
||||
TEXT: 99,
|
||||
...ListHeaderDefaultConst,
|
||||
...ListHeaderSpecificConst,
|
||||
} as const;
|
||||
@@ -33,6 +34,7 @@ type ListHeaderType = (typeof ListHeaderConst)[keyof typeof ListHeaderConst];
|
||||
|
||||
export const LIST_HEADER_TYPE_ORDER = [
|
||||
ListHeaderConst.TEXT,
|
||||
ListHeaderConst.CONTENT_ITEM,
|
||||
ListHeaderConst.TEL_NUM,
|
||||
ListHeaderConst.EMAIL,
|
||||
ListHeaderConst.FILE,
|
||||
@@ -41,11 +43,18 @@ export const LIST_HEADER_TYPE_ORDER = [
|
||||
type ListHeaderOptionType = (typeof LIST_HEADER_TYPE_ORDER)[number];
|
||||
|
||||
export const LIST_HEADER_TYPE_LABEL = {
|
||||
[ListHeaderConst.SID]: "SID",
|
||||
[ListHeaderConst.IS_USE]: "사용 여부",
|
||||
[ListHeaderConst.OUTSOURCE]: "외주 SV",
|
||||
[ListHeaderConst.CONTACT_INTERVIEWER]: "컨택원",
|
||||
[ListHeaderConst.FIELD_INTERVIEWER]: "면접원",
|
||||
[ListHeaderConst.MEMO]: "중요 메모",
|
||||
[ListHeaderConst.TEXT]: "일반",
|
||||
[ListHeaderConst.TEL_NUM]: "전화번호",
|
||||
[ListHeaderConst.EMAIL]: "이메일",
|
||||
[ListHeaderConst.FILE]: "파일 업로드",
|
||||
} as const satisfies Partial<Record<ListHeaderType, string>> &
|
||||
[ListHeaderConst.CONTENT_ITEM]: "목록형",
|
||||
} as const satisfies Record<ListHeaderType, string> &
|
||||
Record<ListHeaderOptionType, string>;
|
||||
|
||||
export const LIST_HEADER_TYPE_OPTIONS = LIST_HEADER_TYPE_ORDER.map((value) => ({
|
||||
|
||||
@@ -1,42 +1,82 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback } from "react";
|
||||
import { useAtom } from "jotai";
|
||||
import { authStateAtom, type AuthState } from "@/store/jotai/auth";
|
||||
import { createAuthHook, type AuthState as CommonAuthState } from "@kri/common/hooks";
|
||||
import { getLocalStorage, removeLocalStorage, setLocalStorage } from "@/store/storage/secure-storage";
|
||||
import { StorageKeys } from "@/store/storage/storage-keys";
|
||||
import type { LoginUser } from "@/types/auth";
|
||||
|
||||
export const useAuth = () => {
|
||||
const [auth, setAuth] = useAtom(authStateAtom);
|
||||
type ContactAuthExtra = {
|
||||
seatNumber: string | null;
|
||||
};
|
||||
|
||||
// 로그인 성공 후 LoginResponse 를 바로 넣어줄 수 있게
|
||||
const setFromLoginResponse = useCallback(
|
||||
(res: LoginUser, loginSeatNumber:string|null = null) => {
|
||||
setAuth({
|
||||
user: res,
|
||||
seatNumber: loginSeatNumber,
|
||||
});
|
||||
},
|
||||
[setAuth],
|
||||
export type AuthState = CommonAuthState<LoginUser, ContactAuthExtra>;
|
||||
|
||||
const initialAuthState: AuthState = {
|
||||
user: null,
|
||||
seatNumber: null,
|
||||
};
|
||||
|
||||
const loadInitialAuthState = (): AuthState => {
|
||||
const stored = getLocalStorage(StorageKeys.AuthState);
|
||||
|
||||
if (stored && typeof stored === "object" && "user" in stored) {
|
||||
return {
|
||||
...initialAuthState,
|
||||
...(stored as Partial<AuthState>),
|
||||
};
|
||||
}
|
||||
|
||||
return initialAuthState;
|
||||
};
|
||||
|
||||
const { authAtom, useAuth: useCommonAuth } = createAuthHook<LoginUser, ContactAuthExtra>({
|
||||
initialState: loadInitialAuthState(),
|
||||
});
|
||||
|
||||
export const authStateAtom = authAtom;
|
||||
|
||||
const persistAuth = (next: AuthState) => {
|
||||
if (next.user === null && next.seatNumber === null) {
|
||||
removeLocalStorage(StorageKeys.AuthState);
|
||||
return;
|
||||
}
|
||||
|
||||
setLocalStorage(StorageKeys.AuthState, next);
|
||||
};
|
||||
|
||||
export const useAuth = () => {
|
||||
const { auth, setAuth: setCommonAuth } = useCommonAuth();
|
||||
|
||||
const setAuth = useCallback(
|
||||
(next: AuthState | ((prev: AuthState) => AuthState)) => {
|
||||
setCommonAuth((prev) => {
|
||||
const resolved = typeof next === "function" ? next(prev) : next;
|
||||
persistAuth(resolved);
|
||||
return resolved;
|
||||
});
|
||||
},
|
||||
[setCommonAuth],
|
||||
);
|
||||
|
||||
const updateAuth = useCallback(
|
||||
(next: AuthState | ((prev: AuthState) => AuthState)) => {
|
||||
setAuth(next);
|
||||
},
|
||||
[setAuth],
|
||||
const setFromLoginResponse = useCallback(
|
||||
(res: LoginUser, loginSeatNumber: string | null = null) => {
|
||||
setAuth({
|
||||
user: res,
|
||||
seatNumber: loginSeatNumber,
|
||||
});
|
||||
},
|
||||
[setAuth],
|
||||
);
|
||||
|
||||
const logout = useCallback(() => {
|
||||
setAuth({
|
||||
user: null,
|
||||
seatNumber: null,
|
||||
});
|
||||
setAuth(initialAuthState);
|
||||
}, [setAuth]);
|
||||
|
||||
return {
|
||||
auth,
|
||||
setAuth: updateAuth,
|
||||
setAuth,
|
||||
setFromLoginResponse,
|
||||
logout,
|
||||
};
|
||||
}
|
||||
} as const;
|
||||
};
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export function useDebouncedValue<T>(value: T, delayMs = 1200) {
|
||||
const [debounced, setDebounced] = useState(value);
|
||||
|
||||
useEffect(() => {
|
||||
const t = setTimeout(() => setDebounced(value), delayMs);
|
||||
return () => clearTimeout(t);
|
||||
}, [value, delayMs]);
|
||||
|
||||
return debounced;
|
||||
}
|
||||
@@ -1,48 +1,43 @@
|
||||
import { useAtom } from 'jotai'
|
||||
import {DialogId, openDialogIdsAtom} from "@/store/jotai/dialog";
|
||||
"use client";
|
||||
|
||||
import { useCallback } from "react";
|
||||
import { createDialogHook } from "@kri/common/hooks";
|
||||
import type { DialogId } from "@/store/jotai/dialog";
|
||||
|
||||
const { openDialogIdsAtom, useDialog: useCommonDialog } = createDialogHook<DialogId>();
|
||||
|
||||
export { openDialogIdsAtom };
|
||||
|
||||
export function useDialog() {
|
||||
const [openDialogIds, setOpenDialogIds] = useAtom(openDialogIdsAtom)
|
||||
const {
|
||||
openDialogIds,
|
||||
isDialogOpen,
|
||||
openDialog,
|
||||
closeDialog,
|
||||
closeAllDialogs,
|
||||
} = useCommonDialog();
|
||||
|
||||
/**
|
||||
* 다이얼로그 열기
|
||||
* @param dialogId 다이얼로그를 구분할 ID
|
||||
* @param onlyThis true 이면 기존 다이얼로그 전부 닫고 이 것만 연다.
|
||||
* false 이면 기존 배열에 추가한다.
|
||||
*/
|
||||
const showDialog = (dialogId: DialogId, onlyThis: boolean = true) => {
|
||||
setOpenDialogIds(prev => {
|
||||
const showDialog = useCallback(
|
||||
(dialogId: DialogId, onlyThis: boolean = true) => {
|
||||
if (onlyThis) {
|
||||
// 이 다이얼로그만 열기
|
||||
return [dialogId]
|
||||
closeAllDialogs();
|
||||
}
|
||||
|
||||
// 이미 열려 있으면 그대로
|
||||
if (prev.includes(dialogId)) {
|
||||
return prev
|
||||
}
|
||||
openDialog(dialogId);
|
||||
},
|
||||
[closeAllDialogs, openDialog],
|
||||
);
|
||||
|
||||
// 여러 개 동시에 열기 허용
|
||||
return [...prev, dialogId]
|
||||
})
|
||||
}
|
||||
const hideDialog = useCallback(
|
||||
(dialogId: DialogId) => {
|
||||
closeDialog(dialogId);
|
||||
},
|
||||
[closeDialog],
|
||||
);
|
||||
|
||||
/**
|
||||
* 다이얼로그 닫기
|
||||
*/
|
||||
const hideDialog = (dialogId: DialogId) => {
|
||||
setOpenDialogIds(prev => prev.filter(id => id !== dialogId))
|
||||
}
|
||||
|
||||
/**
|
||||
* 다이얼로그 열려있는지 여부
|
||||
*/
|
||||
const isDialogOpen = (dialogId: DialogId) => openDialogIds.includes(dialogId)
|
||||
|
||||
/**
|
||||
* 모든 다이얼로그 닫기 (있으면 편하니까 같이 제공)
|
||||
*/
|
||||
const hideAll = () => setOpenDialogIds([])
|
||||
const hideAll = useCallback(() => {
|
||||
closeAllDialogs();
|
||||
}, [closeAllDialogs]);
|
||||
|
||||
return {
|
||||
openDialogIds,
|
||||
@@ -50,5 +45,5 @@ export function useDialog() {
|
||||
showDialog,
|
||||
hideDialog,
|
||||
hideAll,
|
||||
}
|
||||
}
|
||||
} as const;
|
||||
}
|
||||
|
||||
@@ -1,106 +1,39 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { cookieStore } from "@/store/cookie/cookie";
|
||||
import { CookieKeys } from "@/store/cookie/cookie-keys";
|
||||
import {FONT_SIZE} from "@/const/commonConst";
|
||||
import {
|
||||
createFontSizeHook,
|
||||
} from "@kri/common/hooks";
|
||||
import {
|
||||
FONT_SIZE,
|
||||
} from "@/const/commonConst";
|
||||
import {
|
||||
cookieStore,
|
||||
} from "@/store/cookie/client-cookie";
|
||||
import {
|
||||
CookieKeys,
|
||||
} from "@/store/cookie/cookie-keys";
|
||||
|
||||
const MIN_FONT_SIZE = 12;
|
||||
const MAX_FONT_SIZE = 24;
|
||||
const DEFAULT_DAYS = 365;
|
||||
|
||||
const clampFontSize = (size: number) => {
|
||||
return Math.min(MAX_FONT_SIZE, Math.max(MIN_FONT_SIZE, size));
|
||||
}
|
||||
|
||||
/**
|
||||
* 쿠키에서 폰트 사이즈 읽기
|
||||
*/
|
||||
const readFontSizeFromCookie = (defaultSize: number): number => {
|
||||
const raw = cookieStore.get(CookieKeys.FontSize);
|
||||
if (!raw) return defaultSize;
|
||||
|
||||
const parsed = parseInt(raw, 10);
|
||||
if (Number.isNaN(parsed)) return defaultSize;
|
||||
|
||||
return clampFontSize(parsed);
|
||||
}
|
||||
|
||||
/**
|
||||
* 쿠키에 폰트 사이즈 저장
|
||||
*/
|
||||
const writeFontSizeToCookie = (size: number) => {
|
||||
const clamped = clampFontSize(size);
|
||||
cookieStore.set(CookieKeys.FontSize, String(clamped), {
|
||||
days: DEFAULT_DAYS,
|
||||
path: "/",
|
||||
sameSite: "Lax",
|
||||
});
|
||||
}
|
||||
|
||||
type UseFontSizeOptions = {
|
||||
/**
|
||||
* 클라이언트 마운트 시 쿠키에서 초기값을 다시 읽어올지 여부
|
||||
* - true: (기본값) 쿠키에서 읽어옴
|
||||
* - false: 전달받은 defaultSize를 그대로 사용 (SSR 값 유지, FOUC 방지)
|
||||
*/
|
||||
hydrateFromCookie?: boolean;
|
||||
}
|
||||
|
||||
export const useFontSize = (
|
||||
defaultSize: number = FONT_SIZE.DEFAULT,
|
||||
options: UseFontSizeOptions = {},
|
||||
) => {
|
||||
const { hydrateFromCookie = true } = options;
|
||||
|
||||
const [fontSize, setFontSize] = useState<number>(() => {
|
||||
// SSR로 전달된 초기값을 신뢰해야 하는 경우 쿠키 재조회 생략
|
||||
if (!hydrateFromCookie) return clampFontSize(defaultSize);
|
||||
return readFontSizeFromCookie(defaultSize);
|
||||
const fontSizeHook =
|
||||
createFontSizeHook({
|
||||
defaultSize: FONT_SIZE.DEFAULT,
|
||||
minSize: FONT_SIZE.MIN,
|
||||
maxSize: FONT_SIZE.MAX,
|
||||
cookieStore,
|
||||
cookieKey: CookieKeys.FontSize,
|
||||
cookieOptions: {
|
||||
days: 365,
|
||||
path: "/",
|
||||
sameSite: "Lax",
|
||||
},
|
||||
cssVariable: "--content-font-size",
|
||||
eventName: "fontSizeChange",
|
||||
});
|
||||
|
||||
// CSS 변수 동기화
|
||||
useEffect(() => {
|
||||
if (typeof document === "undefined") return;
|
||||
document.documentElement.style.setProperty(
|
||||
"--content-font-size",
|
||||
`${fontSize}px`,
|
||||
);
|
||||
}, [fontSize]);
|
||||
export const useFontSize =
|
||||
fontSizeHook.useFontSize;
|
||||
|
||||
// 다른 컴포넌트/페이지에서 변경한 폰트 크기와 상태 동기화
|
||||
// 요청사항 반영: 브로드캐스트 수신 시 event.detail 대신 "쿠키"를 다시 읽어 반영한다.
|
||||
useEffect(() => {
|
||||
if (typeof window === "undefined") return;
|
||||
export const useFontSizeValue =
|
||||
fontSizeHook.useFontSizeValue;
|
||||
|
||||
const handler = (_e: Event) => {
|
||||
// 쿠키에 저장된 최신 값을 읽어 상태를 동기화한다.
|
||||
// 기본값은 현재 상태값을 폴백으로 사용하여 불필요한 변경을 방지한다.
|
||||
const next = readFontSizeFromCookie(fontSize);
|
||||
setFontSize(next);
|
||||
};
|
||||
|
||||
window.addEventListener("fontSizeChange", handler as EventListener);
|
||||
return () => window.removeEventListener("fontSizeChange", handler as EventListener);
|
||||
}, []);
|
||||
|
||||
const updateFontSize = useCallback((next: number) => {
|
||||
const clamped = clampFontSize(next);
|
||||
setFontSize(clamped);
|
||||
writeFontSizeToCookie(clamped);
|
||||
// 전역 이벤트로 다른 훅 인스턴스들에 변경 사항 전파
|
||||
if (typeof window !== "undefined") {
|
||||
window.dispatchEvent(new CustomEvent("fontSizeChange", { detail: clamped }));
|
||||
}
|
||||
}, []);
|
||||
|
||||
return [fontSize, updateFontSize] as const;
|
||||
}
|
||||
|
||||
export const useFontSizeValue = (
|
||||
options: UseFontSizeOptions = {},
|
||||
) => {
|
||||
const defaultSize = FONT_SIZE.DEFAULT;
|
||||
const [fontSize] = useFontSize(defaultSize, options);
|
||||
return fontSize;
|
||||
}
|
||||
export const clampFontSize =
|
||||
fontSizeHook.clampFontSize;
|
||||
|
||||
@@ -1,38 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import { useAtom } from "jotai";
|
||||
import { useCallback } from "react";
|
||||
import { manualLoadingAtom } from "@/store/jotai/loading";
|
||||
import { createLoadingHook } from "@kri/common/hooks";
|
||||
|
||||
export const useLoading = () => {
|
||||
const [isLoading, setIsLoading] = useAtom(manualLoadingAtom);
|
||||
const {
|
||||
loadingCountAtom,
|
||||
isLoadingAtom,
|
||||
useLoading,
|
||||
} = createLoadingHook();
|
||||
|
||||
const showLoading = useCallback(() => setIsLoading(true), [setIsLoading]);
|
||||
const hideLoading = useCallback(() => setIsLoading(false), [setIsLoading]);
|
||||
export {
|
||||
loadingCountAtom,
|
||||
isLoadingAtom,
|
||||
useLoading,
|
||||
};
|
||||
|
||||
const withLoadingAsync = useCallback(
|
||||
async <T,>(fn: () => Promise<T>): Promise<T> => {
|
||||
showLoading();
|
||||
try {
|
||||
return await fn();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
},
|
||||
[showLoading, hideLoading]
|
||||
);
|
||||
|
||||
const withLoading = useCallback(
|
||||
<T,>(fn: () => T): T => {
|
||||
showLoading();
|
||||
try {
|
||||
return fn();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
},
|
||||
[showLoading, hideLoading]
|
||||
);
|
||||
|
||||
return { isLoading, showLoading, hideLoading, withLoading, withLoadingAsync } as const;
|
||||
};
|
||||
export const manualLoadingAtom = isLoadingAtom;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export const useMounted = () => {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
useEffect(() => setMounted(true), []);
|
||||
return mounted;
|
||||
};
|
||||
@@ -1,16 +1,18 @@
|
||||
"use client";
|
||||
|
||||
import { useAtom } from "jotai";
|
||||
import { selectedProjectAtom } from "@/store/jotai/project";
|
||||
import { selectedProjectAtom, selectedProjectHydratedAtom } from "@/store/jotai/project";
|
||||
|
||||
export const useSelectedProject = () => {
|
||||
const [selectedProject, setSelectedProject] = useAtom(selectedProjectAtom);
|
||||
const [isSelectedProjectHydrated] = useAtom(selectedProjectHydratedAtom);
|
||||
|
||||
const clearSelectedProject = () => setSelectedProject(null);
|
||||
|
||||
return {
|
||||
selectedProject,
|
||||
isSelectedProjectHydrated,
|
||||
setSelectedProject,
|
||||
clearSelectedProject,
|
||||
} as const;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +1,43 @@
|
||||
"use client";
|
||||
|
||||
import { createStorageHook } from "@kri/common/hooks";
|
||||
import {
|
||||
setLocalStorage,
|
||||
getLocalStorage,
|
||||
removeLocalStorage,
|
||||
setSessionStorage,
|
||||
getSessionStorage,
|
||||
removeLocalStorage,
|
||||
removeSessionStorage,
|
||||
setLocalStorage,
|
||||
setSessionStorage,
|
||||
} from "@/store/storage/secure-storage";
|
||||
import { StorageKey, StorageType } from "@/store/storage/storage-keys";
|
||||
import { StorageKeys, StorageType } from "@/store/storage/storage-keys";
|
||||
import type { AuthState } from "@/hooks/useAuth";
|
||||
import type { SelectedProject } from "@/store/jotai/project";
|
||||
import type { ItrntUserInfo } from "@/types/user";
|
||||
|
||||
type ContactStorageSchema = {
|
||||
[StorageKeys.AuthState]: AuthState;
|
||||
[StorageKeys.SeatNumber]: string;
|
||||
[StorageKeys.LoginType]: string;
|
||||
[StorageKeys.SelectedProject]: SelectedProject;
|
||||
[StorageKeys.ItrntUserList]: ItrntUserInfo[];
|
||||
};
|
||||
|
||||
/**
|
||||
* 사용법:
|
||||
* const { set, get, remove } = useStorage(StorageKeys.SeatNumber);
|
||||
*/
|
||||
export const useStorage = (key: StorageKey) => {
|
||||
const storageType = StorageType[key]; // "local" | "session"
|
||||
type ContactStorageKey = Extract<keyof ContactStorageSchema, string>;
|
||||
|
||||
const set = (value: any): void => {
|
||||
if (storageType === "session") {
|
||||
setSessionStorage(key, value);
|
||||
} else {
|
||||
setLocalStorage(key, value);
|
||||
}
|
||||
};
|
||||
const useCommonStorage = createStorageHook<ContactStorageSchema>({
|
||||
resolveStorageScope: (key) => StorageType[key],
|
||||
localStorageAdapter: {
|
||||
get: getLocalStorage,
|
||||
set: setLocalStorage,
|
||||
remove: removeLocalStorage,
|
||||
},
|
||||
sessionStorageAdapter: {
|
||||
get: getSessionStorage,
|
||||
set: setSessionStorage,
|
||||
remove: removeSessionStorage,
|
||||
},
|
||||
});
|
||||
|
||||
const get = (): any => {
|
||||
if (storageType === "session") {
|
||||
return getSessionStorage(key);
|
||||
} else {
|
||||
return getLocalStorage(key);
|
||||
}
|
||||
};
|
||||
|
||||
const remove = (): void => {
|
||||
if (storageType === "session") {
|
||||
removeSessionStorage(key);
|
||||
} else {
|
||||
removeLocalStorage(key);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
set,
|
||||
get,
|
||||
remove,
|
||||
} as const;
|
||||
};
|
||||
export const useStorage = <TKey extends ContactStorageKey>(key: TKey) => {
|
||||
return useCommonStorage(key);
|
||||
};
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
const required = <K extends keyof typeof RAW_PUBLIC_ENV>(name: K) => {
|
||||
const v = RAW_PUBLIC_ENV[name];
|
||||
if (!v) throw new Error(`Missing env: ${name}`);
|
||||
return v;
|
||||
};
|
||||
import { createEnv, env } from "@kri/common/config";
|
||||
|
||||
const RAW_PUBLIC_ENV = {
|
||||
NEXT_PUBLIC_ENV: process.env.NEXT_PUBLIC_ENV,
|
||||
NEXT_PUBLIC_API_BASE: process.env.NEXT_PUBLIC_API_BASE,
|
||||
NEXT_PUBLIC_STORE_KEY: process.env.NEXT_PUBLIC_STORE_KEY,
|
||||
} as const;
|
||||
export const clientEnv = createEnv({
|
||||
ENV: env.required("NEXT_PUBLIC_ENV", process.env.NEXT_PUBLIC_ENV),
|
||||
|
||||
export const clientEnv = {
|
||||
ENV: required("NEXT_PUBLIC_ENV"),
|
||||
API_BASE: required("NEXT_PUBLIC_API_BASE"),
|
||||
STORE_KEY: required("NEXT_PUBLIC_STORE_KEY"),
|
||||
};
|
||||
API_BASE: env.required("NEXT_PUBLIC_API_BASE", process.env.NEXT_PUBLIC_API_BASE),
|
||||
|
||||
API_INTERNAL: env.required("NEXT_PUBLIC_API_INTERNAL", process.env.NEXT_PUBLIC_API_INTERNAL),
|
||||
|
||||
STORE_KEY: env.required("NEXT_PUBLIC_STORE_KEY", process.env.NEXT_PUBLIC_STORE_KEY),
|
||||
});
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
const required = (name: string) => {
|
||||
const v = process.env[name];
|
||||
if (!v) throw new Error(`Missing env: ${name}`);
|
||||
return v;
|
||||
};
|
||||
import "server-only";
|
||||
|
||||
export const serverEnv = {
|
||||
ENV: required("ENV"),
|
||||
CONTACT_SERVER: required("CONTACT_SERVER"),
|
||||
API_CONTACT_SERVER: required("API_CONTACT_SERVER"),
|
||||
API_NOTIHUB_SERVER: required("API_NOTIHUB_SERVER"),
|
||||
API_INTRANET_SERVER: required("API_INTRANET_SERVER"),
|
||||
API_KART_SERVER: required("API_KART_SERVER"),
|
||||
KART_API_KEY: required("KART_API_KEY"),
|
||||
// 다른 서버 전용 env들 추가 가능
|
||||
};
|
||||
import { createEnv, env } from "@kri/common/config";
|
||||
|
||||
export const serverEnv = createEnv({
|
||||
ENV: env.required("ENV", process.env.ENV),
|
||||
|
||||
CONTACT_SERVER: env.required("CONTACT_SERVER", process.env.CONTACT_SERVER),
|
||||
|
||||
API_CONTACT_SERVER: env.required("API_CONTACT_SERVER", process.env.API_CONTACT_SERVER),
|
||||
|
||||
API_NOTIHUB_SERVER: env.required("API_NOTIHUB_SERVER", process.env.API_NOTIHUB_SERVER),
|
||||
|
||||
API_INTRANET_SERVER: env.required("API_INTRANET_SERVER", process.env.API_INTRANET_SERVER),
|
||||
|
||||
API_KART_SERVER: env.required("API_KART_SERVER", process.env.API_KART_SERVER),
|
||||
|
||||
KART_API_KEY: env.required("KART_API_KEY", process.env.KART_API_KEY),
|
||||
});
|
||||
|
||||
@@ -1,327 +1,8 @@
|
||||
import { clientEnv } from "@/lib/env.client";
|
||||
import {DEFAULT_API_TIMEOUT_MS} from "@/const/commonConst";
|
||||
|
||||
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
||||
|
||||
export class HttpError extends Error {
|
||||
public readonly status: number;
|
||||
public readonly data: unknown;
|
||||
public readonly url: string;
|
||||
private readonly headerMap: Record<string, string>;
|
||||
|
||||
constructor(status: number, data: unknown, url: string, headers?: Headers) {
|
||||
super(`HTTP ${status}`);
|
||||
this.name = "HttpError";
|
||||
this.status = status;
|
||||
this.data = data;
|
||||
this.url = url;
|
||||
this.headerMap =
|
||||
headers && typeof headers.entries === "function"
|
||||
? Object.fromEntries(headers.entries())
|
||||
: {};
|
||||
}
|
||||
|
||||
get headers(): Record<string, string> {
|
||||
return this.headerMap;
|
||||
}
|
||||
|
||||
get traceId(): string | undefined {
|
||||
return this.headerMap["x-trace-id"] ?? this.headerMap["x-request-id"];
|
||||
}
|
||||
}
|
||||
|
||||
export type QueryValue = string | string[] | undefined;
|
||||
export type Query = Record<string, QueryValue>;
|
||||
export type PathParams = Record<string, string | number | boolean>;
|
||||
|
||||
export type NextFetchOptions = {
|
||||
revalidate?: number;
|
||||
tags?: string[];
|
||||
};
|
||||
|
||||
export type RequestOptions = {
|
||||
method?: HttpMethod;
|
||||
pathParams?: PathParams;
|
||||
query?: Query;
|
||||
json?: unknown;
|
||||
rawBody?: string;
|
||||
form?: FormData;
|
||||
headers?: Record<string, string>;
|
||||
timeoutMs?: number;
|
||||
suppressAlert?: boolean;
|
||||
onAuthError?: () => void;
|
||||
autoLogoutOnAuthError?: boolean;
|
||||
expectText?: boolean;
|
||||
expectBinary?: boolean;
|
||||
cache?: RequestCache; // "force-cache" | "no-store" | ...
|
||||
next?: NextFetchOptions; // Next 서버 fetch 확장 옵션
|
||||
};
|
||||
|
||||
export type HttpClientOptions = {
|
||||
getToken?: () => string | null;
|
||||
defaultTimeoutMs?: number;
|
||||
defaultHeaders?: Record<string, string>;
|
||||
setErrorMessage?: (status: number, serverMsg?: string) => string;
|
||||
};
|
||||
|
||||
let logoutRedirectStarted = false;
|
||||
|
||||
const canRedirectToLogout = (): boolean => {
|
||||
if (typeof window === "undefined") return false;
|
||||
if (logoutRedirectStarted) return false;
|
||||
|
||||
const { pathname } = window.location;
|
||||
if (pathname === "/logout" || pathname === "/login") return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const redirectToLogout = (): void => {
|
||||
if (!canRedirectToLogout()) return;
|
||||
|
||||
logoutRedirectStarted = true;
|
||||
|
||||
try {
|
||||
window.location.replace("/logout");
|
||||
} catch {}
|
||||
};
|
||||
|
||||
const replacePathParams = (path: string, params?: PathParams): string => {
|
||||
if (!params) return path;
|
||||
let out = path;
|
||||
for (const [k, v] of Object.entries(params)) {
|
||||
const ph = `:${k}`;
|
||||
if (out.includes(ph)) out = out.replace(ph, encodeURIComponent(String(v)));
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
const appendQuery = (u: URL, query?: Query): void => {
|
||||
if (!query) return;
|
||||
for (const [k, v] of Object.entries(query)) {
|
||||
if (Array.isArray(v)) v.forEach((it) => u.searchParams.append(k, it));
|
||||
else if (v !== undefined) u.searchParams.set(k, v);
|
||||
}
|
||||
};
|
||||
|
||||
const buildHeaders = (base: Record<string, string>, extra?: Record<string, string>): Headers => {
|
||||
const h = new Headers(base);
|
||||
if (extra) for (const [k, v] of Object.entries(extra)) h.set(k, v);
|
||||
return h;
|
||||
};
|
||||
|
||||
const isAbortError = (err: unknown): boolean => {
|
||||
if (!err || typeof err !== "object") return false;
|
||||
const e = err as { name?: unknown; code?: unknown; message?: unknown };
|
||||
return (
|
||||
e.name === "AbortError" || // browser fetch abort
|
||||
e.code === "ABORT_ERR" || // some runtimes
|
||||
(typeof e.message === "string" && e.message.toLowerCase().includes("aborted"))
|
||||
);
|
||||
};
|
||||
|
||||
const isJsonContentType = (ctype: string) => {
|
||||
const ct = (ctype ?? "").toLowerCase()
|
||||
return ct.includes("application/json") || ct.includes("+json")
|
||||
}
|
||||
|
||||
export const createHttpClient = (baseURL: string, opts: HttpClientOptions = {}) => {
|
||||
const {
|
||||
getToken,
|
||||
defaultTimeoutMs = DEFAULT_API_TIMEOUT_MS,
|
||||
defaultHeaders = { "content-type": "application/json" },
|
||||
setErrorMessage,
|
||||
} = opts;
|
||||
|
||||
const request = async <T = unknown>(path: string, options: RequestOptions = {}): Promise<T> => {
|
||||
const replaced = replacePathParams(path, options.pathParams);
|
||||
|
||||
let url: URL;
|
||||
if (/^https?:\/\//i.test(replaced)) {
|
||||
url = new URL(replaced);
|
||||
} else if (replaced.startsWith("/")) {
|
||||
const base = new URL(baseURL);
|
||||
const joinedPath = `${base.pathname.replace(/\/+$/, "")}/${replaced.replace(/^\/+/, "")}`;
|
||||
url = new URL(base.toString());
|
||||
url.pathname = joinedPath;
|
||||
} else {
|
||||
url = new URL(replaced, new URL(baseURL));
|
||||
}
|
||||
|
||||
appendQuery(url, options.query);
|
||||
|
||||
const base: Record<string, string> = { ...defaultHeaders };
|
||||
const token = getToken?.();
|
||||
if (token) base["authorization"] = `Bearer ${token}`;
|
||||
const headers = buildHeaders(base, options.headers);
|
||||
|
||||
let body: BodyInit | undefined;
|
||||
if (options.form) {
|
||||
headers.delete("content-type");
|
||||
body = options.form;
|
||||
} else if (options.rawBody !== undefined) {
|
||||
if (!headers.has("content-type")) headers.set("content-type", "text/plain;charset=utf-8");
|
||||
body = options.rawBody;
|
||||
} else if (options.json !== undefined) {
|
||||
if (!headers.has("content-type")) headers.set("content-type", "application/json");
|
||||
body = typeof options.json === "string" ? options.json : JSON.stringify(options.json);
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), options.timeoutMs ?? defaultTimeoutMs);
|
||||
|
||||
const isServer = typeof window === "undefined";
|
||||
const cacheMode: RequestCache = options.cache ?? (isServer && options.next ? "force-cache" : "no-store");
|
||||
const nextOpt = isServer ? options.next : undefined;
|
||||
|
||||
try {
|
||||
const res = await fetch(url.toString(), {
|
||||
method: options.method ?? (body ? "POST" : "GET"),
|
||||
headers,
|
||||
body,
|
||||
cache: cacheMode,
|
||||
// TS에서 RequestInit에 next가 없어서 캐스팅 필요
|
||||
...(nextOpt ? ({ next: nextOpt } as any) : {}),
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
if (options.expectBinary) {
|
||||
if (!res.ok) {
|
||||
const rawText = await res.text().catch(() => "");
|
||||
const ctype = res.headers.get("content-type") ?? ""
|
||||
const isJson = isJsonContentType(ctype)
|
||||
|
||||
let parsedError: unknown;
|
||||
if (isJson && rawText) {
|
||||
try {
|
||||
parsedError = JSON.parse(rawText);
|
||||
} catch {
|
||||
parsedError = rawText;
|
||||
}
|
||||
} else {
|
||||
parsedError = rawText || null;
|
||||
}
|
||||
|
||||
const autoLogout = options.autoLogoutOnAuthError ?? true;
|
||||
const suppressAlert = options.suppressAlert ?? true;
|
||||
|
||||
if (res.status === 401) options.onAuthError?.();
|
||||
|
||||
if ((res.status === 401 || res.status === 403) && autoLogout && typeof window !== "undefined") {
|
||||
redirectToLogout();
|
||||
throw new HttpError(res.status, parsedError, url.toString(), res.headers);
|
||||
}
|
||||
|
||||
if (!suppressAlert && typeof window !== "undefined") {
|
||||
const serverMsg =
|
||||
typeof parsedError === "object" && parsedError !== null && "message" in parsedError
|
||||
? String((parsedError as { message?: unknown }).message ?? "")
|
||||
: typeof parsedError === "string"
|
||||
? parsedError
|
||||
: undefined;
|
||||
|
||||
const msg = setErrorMessage?.(res.status, serverMsg) ?? (serverMsg ?? `HTTP ${res.status}`);
|
||||
alert(`[${res.status}] ${msg}`);
|
||||
}
|
||||
|
||||
throw new HttpError(res.status, parsedError, url.toString(), res.headers);
|
||||
}
|
||||
|
||||
const buffer = await res.arrayBuffer();
|
||||
return buffer as T;
|
||||
}
|
||||
|
||||
const ctype = res.headers.get("content-type") ?? "";
|
||||
const isJson = isJsonContentType(ctype)
|
||||
const rawText = await res.text().catch(() => "");
|
||||
|
||||
const parsed: unknown = options.expectText
|
||||
? rawText
|
||||
: isJson
|
||||
? rawText
|
||||
? JSON.parse(rawText)
|
||||
: null
|
||||
: rawText;
|
||||
|
||||
if (!res.ok) {
|
||||
const autoLogout = options.autoLogoutOnAuthError ?? true;
|
||||
const suppressAlert = options.suppressAlert ?? true;
|
||||
|
||||
if (res.status === 401) options.onAuthError?.();
|
||||
|
||||
if ((res.status === 401 || res.status === 403) && autoLogout && typeof window !== "undefined") {
|
||||
redirectToLogout();
|
||||
throw new HttpError(res.status, parsed, url.toString(), res.headers);
|
||||
}
|
||||
|
||||
if (!suppressAlert && typeof window !== "undefined") {
|
||||
const serverMsg =
|
||||
typeof parsed === "object" && parsed !== null && "message" in parsed
|
||||
? String((parsed as { message?: unknown }).message ?? "")
|
||||
: typeof parsed === "string"
|
||||
? parsed
|
||||
: undefined;
|
||||
|
||||
const msg = setErrorMessage?.(res.status, serverMsg) ?? (serverMsg ?? `HTTP ${res.status}`);
|
||||
alert(`[${res.status}] ${msg}`);
|
||||
}
|
||||
|
||||
throw new HttpError(res.status, parsed, url.toString(), res.headers);
|
||||
}
|
||||
|
||||
return parsed as T;
|
||||
} catch (err: unknown) {
|
||||
if (isAbortError(err)) {
|
||||
throw new HttpError(
|
||||
408,
|
||||
{ message: "요청 시간이 초과되었습니다.", timeoutMs: options.timeoutMs ?? defaultTimeoutMs },
|
||||
url.toString()
|
||||
);
|
||||
}
|
||||
|
||||
let code: string | undefined;
|
||||
if (typeof err === "object" && err !== null) {
|
||||
const anyErr = err as { cause?: unknown; code?: unknown };
|
||||
|
||||
if (anyErr.cause && typeof anyErr.cause === "object") {
|
||||
const cause = anyErr.cause as { code?: unknown };
|
||||
if (typeof cause.code === "string") code = cause.code;
|
||||
}
|
||||
if (!code && typeof anyErr.code === "string") code = anyErr.code;
|
||||
}
|
||||
|
||||
if (code === "ECONNREFUSED") {
|
||||
throw new HttpError(404, { message: "백엔드 서버를 찾을 수 없습니다." }, url.toString());
|
||||
}
|
||||
|
||||
throw err;
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
};
|
||||
|
||||
const get = <T = unknown>(path: string, o?: Omit<RequestOptions, "method" | "json" | "rawBody" | "form">) =>
|
||||
request<T>(path, { ...o, method: "GET" });
|
||||
|
||||
const post = <T = unknown>(path: string, json?: unknown, o?: Omit<RequestOptions, "method" | "json" | "rawBody" | "form">) =>
|
||||
request<T>(path, { ...o, method: "POST", json });
|
||||
|
||||
const put = <T = unknown>(path: string, json?: unknown, o?: Omit<RequestOptions, "method" | "json" | "rawBody" | "form">) =>
|
||||
request<T>(path, { ...o, method: "PUT", json });
|
||||
|
||||
const patch = <T = unknown>(path: string, json?: unknown, o?: Omit<RequestOptions, "method" | "json" | "rawBody" | "form">) =>
|
||||
request<T>(path, { ...o, method: "PATCH", json });
|
||||
|
||||
const del = <T = unknown>(path: string, o?: Omit<RequestOptions, "method">) =>
|
||||
request<T>(path, { ...o, method: "DELETE" });
|
||||
|
||||
const postForm = <T = unknown>(path: string, form: FormData, o?: Omit<RequestOptions, "method" | "json" | "rawBody" | "form">) =>
|
||||
request<T>(path, { ...o, method: "POST", form });
|
||||
|
||||
const putForm = <T = unknown>(path: string, form: FormData, o?: Omit<RequestOptions, "method" | "json" | "rawBody" | "form">) =>
|
||||
request<T>(path, { ...o, method: "PUT", form });
|
||||
|
||||
return { request, get, post, put, patch, del, postForm, putForm };
|
||||
};
|
||||
import { createHttpClient } from "@kri/common/http";
|
||||
|
||||
export const nextApi = createHttpClient(clientEnv.API_BASE);
|
||||
|
||||
export const internalApi = createHttpClient(clientEnv.API_INTERNAL, {
|
||||
defaultHeaders: {},
|
||||
});
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { cookies } from "next/headers";
|
||||
import { createHttpClient } from "@/lib/http-client";
|
||||
import { createHttpClient } from "@kri/common/http";
|
||||
import { serverEnv } from "@/lib/env.server";
|
||||
import { CookieKeys } from "@/store/cookie/cookie-keys";
|
||||
|
||||
const createServerApi = async (rootUrl: string, defaultHeaders?: Record<string, string>) => {
|
||||
const cookieStore = await cookies();
|
||||
const accessToken = cookieStore.get("access_token")?.value ?? null;
|
||||
const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value ?? null;
|
||||
|
||||
return createHttpClient(rootUrl, {
|
||||
getToken: () => accessToken, // 이미 위에서 읽은 값만 참조
|
||||
getToken: () => accessToken,
|
||||
defaultHeaders: {
|
||||
"content-type": "application/json",
|
||||
...(defaultHeaders ?? {}),
|
||||
@@ -17,18 +18,18 @@ const createServerApi = async (rootUrl: string, defaultHeaders?: Record<string,
|
||||
|
||||
export const createContactApi = () => {
|
||||
return createServerApi(serverEnv.API_CONTACT_SERVER);
|
||||
}
|
||||
};
|
||||
|
||||
export const createNotihubApi = () => {
|
||||
return createServerApi(serverEnv.API_NOTIHUB_SERVER);
|
||||
}
|
||||
};
|
||||
|
||||
export const createIntranetApi = () => {
|
||||
return createServerApi(serverEnv.API_INTRANET_SERVER);
|
||||
}
|
||||
};
|
||||
|
||||
export const createKartApi = () => {
|
||||
return createServerApi(serverEnv.API_KART_SERVER, {
|
||||
"X-API-Key": serverEnv.KART_API_KEY,
|
||||
});
|
||||
};
|
||||
};
|
||||
@@ -1,52 +0,0 @@
|
||||
import {NextResponse} from "next/server";
|
||||
import {HttpError} from "@/lib/http-client";
|
||||
import {clientEnv} from "@/lib/env.client";
|
||||
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@/const/commonConst";
|
||||
|
||||
export type ApiError = {
|
||||
status: number
|
||||
code: string
|
||||
message: string
|
||||
}
|
||||
|
||||
export const errorToResponse = (error: unknown) => {
|
||||
if (error instanceof HttpError) {
|
||||
const payload = error.data ?? { message: "서버에서 오류 응답을 받았습니다." }
|
||||
return NextResponse.json(payload, { status: error.status })
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{ message: "서버 내부 오류가 발생했습니다." },
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
|
||||
const isDev = clientEnv.ENV !== "prod"
|
||||
|
||||
export const apiError = (e: unknown): ApiError => {
|
||||
if (e instanceof HttpError) {
|
||||
const d = e.data as any
|
||||
const code = typeof d?.code === "string" ? d.code : UNKNOWN_HTTP_ERROR
|
||||
const message =
|
||||
(typeof d?.detail === "string" && d.detail) ||
|
||||
(typeof d?.message === "string" && d.message) ||
|
||||
(typeof d?.errMessage === "string" && d.errMessage) ||
|
||||
(typeof d === "string" && d) ||
|
||||
`HTTP ${e.status}`
|
||||
|
||||
if (isDev) {
|
||||
console.groupCollapsed(
|
||||
`[API ERROR] ${e.status}${code ? ` / ${code}` : ""}`
|
||||
)
|
||||
console.log("url:", e.url)
|
||||
if (e.traceId) console.log("traceId:", e.traceId)
|
||||
console.log("raw data:", d)
|
||||
console.groupEnd()
|
||||
}
|
||||
|
||||
return { status: e.status, code, message }
|
||||
}
|
||||
|
||||
if (isDev) console.error("[NON-HTTP ERROR]", e)
|
||||
return { status: 500, code: NONE_HTTP_ERROR, message: "저장에 실패했습니다." }
|
||||
}
|
||||
@@ -1,196 +1,28 @@
|
||||
import CryptoJS from "crypto-js";
|
||||
import { createSecurity } from "@kri/common/security";
|
||||
import { clientEnv } from "@/lib/env.client";
|
||||
|
||||
const KEY = CryptoJS.enc.Utf8.parse("kr!-c0nTacT-fr0nT-CrypT0-Key-STR");
|
||||
const IV = CryptoJS.enc.Utf8.parse("kr!-c0nTacT-IVST");
|
||||
const KEY = "kr!-c0nTacT-fr0nT-CrypT0-Key-STR";
|
||||
|
||||
export type WordArray = CryptoJS.lib.WordArray;
|
||||
const IV = "kr!-c0nTacT-IVST";
|
||||
|
||||
export class Security {
|
||||
public static encryptBase64UrlObject(input: unknown): string {
|
||||
const data = JSON.stringify(input);
|
||||
return this.encryptBase64Url(data);
|
||||
}
|
||||
export const Security = createSecurity({
|
||||
key: KEY,
|
||||
iv: IV,
|
||||
|
||||
public static decryptBase64UrlObject(input: string): unknown {
|
||||
const data = this.decryptBase64Url(input);
|
||||
return JSON.parse(data);
|
||||
}
|
||||
|
||||
public static encryptBase64Object(input: unknown): string {
|
||||
const data = JSON.stringify(input);
|
||||
return this.encryptBase64(data);
|
||||
}
|
||||
|
||||
public static decryptBase64Object(input: string): unknown {
|
||||
const data = this.decryptBase64(input);
|
||||
return JSON.parse(data);
|
||||
}
|
||||
|
||||
public static encryptBase64Url(input: string): string {
|
||||
const data = this.decodeUtf8(input);
|
||||
const params = this.encrypt(data);
|
||||
return this.encodeBase64Url(params);
|
||||
}
|
||||
|
||||
public static decryptBase64Url(input: string): string {
|
||||
const data = this.decodeBase64Url(input);
|
||||
const decryptedData = this.decrypt(data);
|
||||
return this.encodeUtf8(decryptedData);
|
||||
}
|
||||
|
||||
public static encryptBase64(input: string): string {
|
||||
const data = this.decodeUtf8(input);
|
||||
const params = this.encrypt(data);
|
||||
return this.encodeBase64(params);
|
||||
}
|
||||
public static decryptBase64(input: string): string {
|
||||
try {
|
||||
const data = this.decodeBase64(input);
|
||||
const decryptedData = this.decrypt(data);
|
||||
return this.encodeUtf8(decryptedData);
|
||||
} catch (error) {
|
||||
console.error("SecurityFunction.decryptBase64 오류:", {
|
||||
input: input?.substring(0, 50) + "...", // 처음 50자만 로그
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
});
|
||||
throw error;
|
||||
onInvalidConfig: ({ message }) => {
|
||||
if (typeof window === "undefined" || clientEnv.ENV !== "local") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static encrypt(input: WordArray): WordArray {
|
||||
const params = CryptoJS.AES.encrypt(input, KEY, {
|
||||
iv: IV,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
});
|
||||
return params.ciphertext;
|
||||
}
|
||||
const target = window as Window & {
|
||||
__kfpaCryptoConfigAlerted?: boolean;
|
||||
};
|
||||
|
||||
public static decrypt(input: WordArray): WordArray {
|
||||
const params = CryptoJS.lib.CipherParams.create({
|
||||
ciphertext: input,
|
||||
});
|
||||
return CryptoJS.AES.decrypt(params, KEY, {
|
||||
iv: IV,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
});
|
||||
}
|
||||
|
||||
public static convertUint8ArrayToWordArray(input: Uint8Array): WordArray {
|
||||
const words: number[] = [];
|
||||
let i = 0;
|
||||
while (i < input.length) {
|
||||
const word =
|
||||
(input[i++] << 24) |
|
||||
(input[i++] << 16) |
|
||||
(input[i++] << 8) |
|
||||
input[i++];
|
||||
words.push(word);
|
||||
if (target.__kfpaCryptoConfigAlerted) {
|
||||
return;
|
||||
}
|
||||
return CryptoJS.lib.WordArray.create(words, words.length * 4);
|
||||
}
|
||||
|
||||
public static convertWordArrayToUint8Array(input: WordArray): Uint8Array {
|
||||
const array = new Uint8Array(input.words.length << 2);
|
||||
for (let i = 0, j = 0; i < input.words.length; i++) {
|
||||
const word = input.words[i];
|
||||
array[j++] = word >> 24;
|
||||
array[j++] = (word >> 16) & 0xff;
|
||||
array[j++] = (word >> 8) & 0xff;
|
||||
array[j++] = word & 0xff;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public static computeHmacSha256Hex(input: WordArray, key: WordArray): string {
|
||||
return this.encodeHex(this.computeHmacSha256(input, key));
|
||||
}
|
||||
|
||||
public static computeHmacSha256(input: WordArray, key: WordArray): WordArray {
|
||||
return CryptoJS.HmacSHA256(input, key);
|
||||
}
|
||||
|
||||
public static computeSha256Hex(input: WordArray): string {
|
||||
return this.encodeHex(this.computeSha256(input));
|
||||
}
|
||||
|
||||
public static computeSha256(input: WordArray): WordArray {
|
||||
return CryptoJS.SHA256(input);
|
||||
}
|
||||
|
||||
private static convertToSpecialChars(base64: string): string {
|
||||
return Array.from(base64)
|
||||
.map((char) => char.charCodeAt(0).toString(2).padStart(16, "0"))
|
||||
.map((binary) => binary.replace(/0/g, "\u200b").replace(/1/g, "\u200c"))
|
||||
.join("ㅤ");
|
||||
}
|
||||
|
||||
private static convertFromSpecialChars(input: string): string {
|
||||
return input
|
||||
.split("ㅤ")
|
||||
.map((bin) => bin.replace(/\u200b/g, "0").replace(/\u200c/g, "1"))
|
||||
.map((binary) => String.fromCharCode(parseInt(binary, 2)))
|
||||
.join("");
|
||||
}
|
||||
|
||||
public static encodeBase64UrlUtf8(input: string): string {
|
||||
return this.encodeBase64Url(this.decodeUtf8(input));
|
||||
}
|
||||
|
||||
public static decodeBase64UrlUtf8(input: string): string {
|
||||
return this.encodeUtf8(this.decodeBase64Url(input));
|
||||
}
|
||||
|
||||
public static encodeBase64Url(input: WordArray): string {
|
||||
const base64url = CryptoJS.enc.Base64url.stringify(input);
|
||||
return this.convertToSpecialChars(base64url);
|
||||
}
|
||||
|
||||
public static decodeBase64Url(input: string): WordArray {
|
||||
try {
|
||||
const base64url = this.convertFromSpecialChars(input);
|
||||
return CryptoJS.enc.Base64url.parse(base64url);
|
||||
} catch {
|
||||
return CryptoJS.enc.Base64url.parse(input);
|
||||
}
|
||||
}
|
||||
|
||||
public static encodeBase64Utf8(input: string): string {
|
||||
return this.encodeBase64(this.decodeUtf8(input));
|
||||
}
|
||||
|
||||
public static decodeBase64Utf8(input: string): string {
|
||||
return this.encodeUtf8(this.decodeBase64(input));
|
||||
}
|
||||
|
||||
public static encodeBase64(input: WordArray): string {
|
||||
const base64 = CryptoJS.enc.Base64.stringify(input);
|
||||
return this.convertToSpecialChars(base64);
|
||||
}
|
||||
|
||||
public static decodeBase64(input: string): WordArray {
|
||||
try {
|
||||
const base64 = this.convertFromSpecialChars(input);
|
||||
return CryptoJS.enc.Base64.parse(base64);
|
||||
} catch {
|
||||
return CryptoJS.enc.Base64.parse(input);
|
||||
}
|
||||
}
|
||||
|
||||
public static encodeHex(input: WordArray): string {
|
||||
return CryptoJS.enc.Hex.stringify(input);
|
||||
}
|
||||
|
||||
public static decodeHex(input: string): WordArray {
|
||||
return CryptoJS.enc.Hex.parse(input);
|
||||
}
|
||||
|
||||
public static encodeUtf8(input: WordArray): string {
|
||||
return CryptoJS.enc.Utf8.stringify(input);
|
||||
}
|
||||
|
||||
public static decodeUtf8(input: string): WordArray {
|
||||
return CryptoJS.enc.Utf8.parse(input);
|
||||
}
|
||||
}
|
||||
target.__kfpaCryptoConfigAlerted = true;
|
||||
window.alert(message);
|
||||
},
|
||||
});
|
||||
|
||||
139
src/lib/utils.ts
139
src/lib/utils.ts
@@ -1,137 +1,2 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
import type {NextRequest} from "next/server";
|
||||
|
||||
export type ValueOf<T> = T[keyof T];
|
||||
|
||||
export type EnumLikeKey<T extends Record<string, unknown>> = keyof T;
|
||||
export type EnumLikeValue<T extends Record<string, unknown>> = ValueOf<T>;
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
export function getKeyByValue<
|
||||
const T extends Record<PropertyKey, string>
|
||||
>(map: T, value: T[keyof T]) {
|
||||
const entry = Object.entries(map).find(([, v]) => v === value);
|
||||
return entry ? (entry[0] as keyof T) : undefined;
|
||||
}
|
||||
|
||||
export function getNumberKeyByValue(
|
||||
map: Record<number, string>,
|
||||
value: string
|
||||
): number | undefined {
|
||||
const entry = Object.entries(map).find(([, v]) => v === value);
|
||||
return entry ? Number(entry[0]) : undefined;
|
||||
}
|
||||
|
||||
export function buildUrlWithParams(
|
||||
targetPath: string,
|
||||
from: Record<string, string | string[] | undefined>,
|
||||
extra?: Record<string, string | undefined>,
|
||||
) {
|
||||
const qs = new URLSearchParams();
|
||||
for (const [k, v] of Object.entries(from)) {
|
||||
if (Array.isArray(v)) v.forEach((val) => qs.append(k, val));
|
||||
else if (v !== undefined) qs.set(k, v);
|
||||
}
|
||||
if (extra) for (const [k, v] of Object.entries(extra)) if (v) qs.set(k, v);
|
||||
return `${targetPath}${qs.toString() ? `?${qs}` : ""}`;
|
||||
}
|
||||
|
||||
export const downloadFile = (blob: Blob, filename: string) => {
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
export const downloadBase64File = (base64: string, filename: string) => {
|
||||
const byteString = atob(base64);
|
||||
const arrayBuffer = new ArrayBuffer(byteString.length);
|
||||
const uint8Array = new Uint8Array(arrayBuffer);
|
||||
|
||||
for (let i = 0; i < byteString.length; i++) {
|
||||
uint8Array[i] = byteString.charCodeAt(i);
|
||||
}
|
||||
|
||||
const blob = new Blob([arrayBuffer], {
|
||||
type:
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
});
|
||||
|
||||
downloadFile(blob, filename);
|
||||
};
|
||||
|
||||
export type DateTimeFormatOption =
|
||||
| "date" // 1-1. 날짜만
|
||||
| "dateHour" // 1-2. 날짜 + 시
|
||||
| "dateHourMin" // 1-3. 날짜 + 시 분
|
||||
| "dateTime"; // 1-4. 날짜 + 시 분 초
|
||||
|
||||
/**
|
||||
* 서버에서 받은 시간(ISO 문자열/Date/number)을 한국시간 기준으로 포맷팅
|
||||
* - 예: "2025-11-28T03:15:50Z" -> "2025-11-28 12:15:50" (KST)
|
||||
*/
|
||||
export const formatKst = (
|
||||
input: string | number | Date | null | undefined,
|
||||
opt: DateTimeFormatOption = "dateTime"
|
||||
): string => {
|
||||
if (!input) return "";
|
||||
|
||||
const d = input instanceof Date ? input : new Date(input);
|
||||
if (Number.isNaN(d.getTime())) return "";
|
||||
|
||||
// UTC -> KST(UTC+9) 변환
|
||||
const kst = new Date(d.getTime() + 9 * 60 * 60 * 1000);
|
||||
|
||||
const pad2 = (n: number) => String(n).padStart(2, "0");
|
||||
|
||||
const yyyy = kst.getUTCFullYear();
|
||||
const MM = pad2(kst.getUTCMonth() + 1);
|
||||
const dd = pad2(kst.getUTCDate());
|
||||
const HH = pad2(kst.getUTCHours());
|
||||
const mm = pad2(kst.getUTCMinutes());
|
||||
const ss = pad2(kst.getUTCSeconds());
|
||||
|
||||
if (opt === "date") return `${yyyy}-${MM}-${dd}`;
|
||||
if (opt === "dateHour") return `${yyyy}-${MM}-${dd} ${HH}`;
|
||||
if (opt === "dateHourMin") return `${yyyy}-${MM}-${dd} ${HH}:${mm}`;
|
||||
return `${yyyy}-${MM}-${dd} ${HH}:${mm}:${ss}`;
|
||||
};
|
||||
|
||||
export const isBlank = (v?: string | null) => !v || v.trim().length === 0;
|
||||
|
||||
export const getClientIp = (req: NextRequest): string | null => {
|
||||
const h = req.headers;
|
||||
|
||||
// 가장 흔한 케이스: 프록시/호스팅이 넣어줌
|
||||
const xff = h.get("x-forwarded-for");
|
||||
if (xff) {
|
||||
// "client, proxy1, proxy2" 형태. 보통 첫 번째가 client IP로 쓰이지만,
|
||||
// 프록시가 헤더를 덮어쓰지 않고 append만 하는 환경이면 spoof 가능성 있음.
|
||||
return xff.split(",")[0].trim();
|
||||
}
|
||||
|
||||
// 일부 인프라/프록시에서 쓰는 헤더들
|
||||
const xRealIp = h.get("x-real-ip");
|
||||
if (xRealIp) return xRealIp.trim();
|
||||
|
||||
// (Cloudflare 등) 사용 환경이면
|
||||
const cf = h.get("cf-connecting-ip");
|
||||
if (cf) return cf.trim();
|
||||
|
||||
// RFC 7239 Forwarded: for=1.2.3.4;proto=https;by=...
|
||||
const forwarded = h.get("forwarded");
|
||||
if (forwarded) {
|
||||
const m = forwarded.match(/for="?([^;,\s"]+)"?/i);
|
||||
if (m?.[1]) return m[1];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
//shadcn에서 이 경로의 cn을 사용하기 때문에 생성
|
||||
export { cn } from "@kri/common/ui";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {NextFetchEvent, NextRequest} from "next/server";
|
||||
import {catchRedirectPageLanding} from "@/middleware/catchRedirectPageLanding";
|
||||
import {catchRedirectPageLanding} from "@/proxy/catchRedirectPageLanding";
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
@@ -7,6 +7,6 @@ export const config = {
|
||||
],
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest, event: NextFetchEvent) {
|
||||
export function proxy(req: NextRequest, event: NextFetchEvent) {
|
||||
return catchRedirectPageLanding(req, event);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
import { NextResponse, type NextRequest, type NextFetchEvent } from "next/server";
|
||||
import { getClientIp } from "@/lib/utils";
|
||||
import {ALLOW_REDIRECT, DEFAULT_API_TIMEOUT_MS} from "@/const/commonConst";
|
||||
import { NextResponse, type NextFetchEvent, type NextRequest } from "next/server";
|
||||
import { getClientIp } from "@kri/common/server";
|
||||
import { DEFAULT_HTTP_TIMEOUT_MS } from "@kri/common/http";
|
||||
import { ALLOW_REDIRECT } from "@/const/commonConst";
|
||||
|
||||
export const catchRedirectPageLanding = async (req: NextRequest, event: NextFetchEvent) => {
|
||||
const pathname = req.nextUrl.pathname; // /redirect/quota
|
||||
void event;
|
||||
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const slug = pathname.split("/")[2] ?? "";
|
||||
const search = req.nextUrl.search;
|
||||
|
||||
if(!ALLOW_REDIRECT.has(slug)){
|
||||
if (!ALLOW_REDIRECT.has(slug)) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
@@ -23,28 +26,30 @@ export const catchRedirectPageLanding = async (req: NextRequest, event: NextFetc
|
||||
forwarded: h.get("forwarded"),
|
||||
};
|
||||
|
||||
const body = {};
|
||||
|
||||
const endpoint = new URL(req.url);
|
||||
endpoint.pathname = `/api/external/${encodeURIComponent(slug)}`;
|
||||
endpoint.search = search;
|
||||
|
||||
const controller = new AbortController();
|
||||
const t = setTimeout(() => controller.abort(), DEFAULT_API_TIMEOUT_MS);
|
||||
const t = setTimeout(() => controller.abort(), DEFAULT_HTTP_TIMEOUT_MS);
|
||||
|
||||
try {
|
||||
const res = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"x-entry-type": "redirect",
|
||||
"x-orig-uri": orig.uri,
|
||||
"x-orig-url": orig.url,
|
||||
"x-orig-user-agent": orig.userAgent ?? "",
|
||||
"x-orig-referer": orig.referer ?? "",
|
||||
"x-orig-origin": orig.origin ?? "",
|
||||
"x-orig-ip": orig.remoteAddr ?? "",
|
||||
// (선택) 내부 호출 마커
|
||||
"x-orig-x-forwarded-for": orig.xForwardedFor ?? "",
|
||||
"x-orig-forwarded": orig.forwarded ?? "",
|
||||
"x-internal-log": "1",
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
body: JSON.stringify({}),
|
||||
signal: controller.signal,
|
||||
cache: "no-store",
|
||||
});
|
||||
@@ -53,15 +58,8 @@ export const catchRedirectPageLanding = async (req: NextRequest, event: NextFetc
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
// 실패 처리 1) 에러 페이지로 redirect (추천)
|
||||
return goToError(req);
|
||||
|
||||
// 실패 처리 2) 그냥 에러 응답으로 차단하고 싶으면 아래로 대체
|
||||
// const text = await res.text().catch(() => "");
|
||||
// return new NextResponse(text || "External API call failed", { status: 502 });
|
||||
|
||||
} catch (e) {
|
||||
// 타임아웃/네트워크 오류 등
|
||||
} catch {
|
||||
return goToError(req);
|
||||
} finally {
|
||||
clearTimeout(t);
|
||||
@@ -73,4 +71,4 @@ const goToError = (req: NextRequest) => {
|
||||
errUrl.searchParams.set("code", "fetch_error");
|
||||
errUrl.searchParams.set("sid", req.nextUrl.searchParams.get("sid") ?? "");
|
||||
return NextResponse.redirect(errUrl, 307);
|
||||
}
|
||||
};
|
||||
@@ -15,7 +15,15 @@ export const useLoginMutation = () => {
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (v: { userId: string; userPw: string; seatNum: string; loginType: string }) => {
|
||||
return nextApi.post<LoginUser>("/login", { userId: v.userId, userPw: v.userPw }, { autoLogoutOnAuthError: false });
|
||||
return nextApi.post<LoginUser>(
|
||||
"/login",
|
||||
{ userId: v.userId, userPw: v.userPw },
|
||||
{
|
||||
skipUnauthorizedHandler: true,
|
||||
skipForbiddenHandler: true,
|
||||
skipResponseErrorHandler: true,
|
||||
},
|
||||
);
|
||||
},
|
||||
onSuccess: (data, v) => {
|
||||
try {
|
||||
@@ -38,7 +46,11 @@ export const useLogoutMutation = () => {
|
||||
const userId = auth.user?.userId ?? "";
|
||||
try {
|
||||
if (userId){
|
||||
await nextApi.post(`/logout/${userId}`, null, { autoLogoutOnAuthError: false });
|
||||
await nextApi.post(`/logout/${userId}`, null, {
|
||||
skipUnauthorizedHandler: true,
|
||||
skipForbiddenHandler: true,
|
||||
skipResponseErrorHandler: true,
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -51,4 +63,4 @@ export const useLogoutMutation = () => {
|
||||
qc.clear(); // 다음 사용자/세션에 서버상태 남지 않게
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
31
src/query/internal.ts
Normal file
31
src/query/internal.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import {keepPreviousData, useQuery} from "@tanstack/react-query";
|
||||
import {qk} from "@/query/key/keys";
|
||||
import {internalApi} from "@/lib/http-client";
|
||||
import {InternalInfo} from "@/types/internal";
|
||||
|
||||
const DEFAULT_INTERNAL_INFO: InternalInfo = {
|
||||
clientId: "",
|
||||
internalNo: "",
|
||||
externalNo: "",
|
||||
clientIp: "",
|
||||
};
|
||||
|
||||
export function useInternalInfoQuery(enabled?: boolean) {
|
||||
return useQuery({
|
||||
queryKey: qk.internalInfo(),
|
||||
queryFn: async (): Promise<InternalInfo> => {
|
||||
try {
|
||||
return await internalApi.get<InternalInfo>(
|
||||
`/new-contact-get-info.asp`,
|
||||
);
|
||||
} catch (error) {
|
||||
//내부 정보 조회 실패
|
||||
return DEFAULT_INTERNAL_INFO;
|
||||
}
|
||||
},
|
||||
enabled: enabled ?? true,
|
||||
staleTime: 0,
|
||||
placeholderData: keepPreviousData, // 검색 중 빈 배열로 깜빡임 방지
|
||||
meta: { ignoreGlobalLoading: true }, // 원하면 전역 오버레이 제외(네가 이미 메타 방식 쓰고 있었지)
|
||||
});
|
||||
}
|
||||
@@ -36,6 +36,10 @@ export const qk = {
|
||||
["kart", "project-list", itrntPrjctCd, userTeam, isKiwi, keyword] as const,
|
||||
/********** KON, KIWI 프로젝트 관련 KART에서 받아옴 **********/
|
||||
|
||||
/********** 찐 인트라넷 관련 **********/
|
||||
internalInfo: () => ["internal", "info"] as const,
|
||||
/********** 찐 인트라넷 관련 **********/
|
||||
|
||||
/********** 인트라넷 관련 **********/
|
||||
intranetProjectList: (keyword: string) => ["intranet", "project-list", keyword] as const,
|
||||
intranetUsers: () => ["intranet", "user-list"] as const,
|
||||
@@ -43,6 +47,7 @@ export const qk = {
|
||||
|
||||
/********** 리스트 관련 **********/
|
||||
listHeader: (prjctIdx: number) => ["list", "header", prjctIdx] as const,
|
||||
listUploadHistory: (prjctIdx: number) => ["list", "upload-history", prjctIdx] as const,
|
||||
listSearch: (prjctIdx: number, body: unknown) => ["list", "search-filter", prjctIdx, body] as const,
|
||||
/********** 리스트 관련 **********/
|
||||
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
import {keepPreviousData, useQuery} from "@tanstack/react-query";
|
||||
import {keepPreviousData, useMutation, useQuery, useQueryClient} from "@tanstack/react-query";
|
||||
import {qk} from "@/query/key/keys";
|
||||
import {nextApi} from "@/lib/http-client";
|
||||
import {listHeader, ListSearchRequest, ListSearchWithFullResult} from "@/types/list";
|
||||
import {PageResponse} from "@/types/common";
|
||||
import {
|
||||
ExcelUploadResult,
|
||||
listHeader,
|
||||
ListEventHistDownloadRequest,
|
||||
ListFilter,
|
||||
ListResetRequest,
|
||||
ListSearchRequest,
|
||||
ListSearchWithFullResult,
|
||||
ListUpdateRequest,
|
||||
ListUploadHistory,
|
||||
ListUploadRequest,
|
||||
} from "@/types/list";
|
||||
import type { PageResponse } from "@kri/common";
|
||||
import {ListHeaderAssignConst} from "@/const/listConst";
|
||||
|
||||
export function useListHeaderQuery(prjctIdx: number, enabled: boolean) {
|
||||
|
||||
return useQuery({
|
||||
queryKey: qk.listHeader(prjctIdx),
|
||||
queryFn: () =>
|
||||
@@ -30,8 +40,8 @@ const serializeListSearchRequest = (request: ListSearchRequest) => ({
|
||||
[ListHeaderAssignConst.CONTACT_INTERVIEWER]: [],
|
||||
[ListHeaderAssignConst.FIELD_INTERVIEWER]: [],
|
||||
},
|
||||
memo: request.listFilter.memo ?? "",
|
||||
otherItems: request.listFilter.otherItems ?? {},
|
||||
memoConditions: request.listFilter.memoConditions ?? [],
|
||||
otherItemConditions: request.listFilter.otherItemConditions ?? [],
|
||||
},
|
||||
pageRequest: request.pageRequest,
|
||||
});
|
||||
@@ -53,3 +63,112 @@ export function useListSearchQuery(prjctIdx: number, request: ListSearchRequest,
|
||||
meta: { ignoreGlobalLoading: true },
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadListExcelTemplateMutation() {
|
||||
return useMutation({
|
||||
mutationFn: (prjctIdx: number) =>
|
||||
nextApi.post<ArrayBuffer>(`/list/excel-template/${prjctIdx}`, undefined, { expectBinary: true }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useListUploadHistoryQuery(prjctIdx: number, enabled: boolean) {
|
||||
return useQuery({
|
||||
queryKey: qk.listUploadHistory(prjctIdx),
|
||||
queryFn: () => nextApi.get<ListUploadHistory[]>(`/list/upload-history/${prjctIdx}`),
|
||||
enabled,
|
||||
staleTime: 0,
|
||||
refetchOnMount: "always",
|
||||
placeholderData: keepPreviousData,
|
||||
meta: { ignoreGlobalLoading: true },
|
||||
});
|
||||
}
|
||||
|
||||
export function useUploadListExcelMutation(prjctIdx: number) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ file, request }: { file: File; request: ListUploadRequest }) => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
formData.append("request", new Blob([JSON.stringify(request)], { type: "application/json" }));
|
||||
return nextApi.postForm<ExcelUploadResult>(`/list/excel-upload/${prjctIdx}`, formData);
|
||||
},
|
||||
onSuccess: async () => {
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: qk.listHeader(prjctIdx) }),
|
||||
queryClient.invalidateQueries({ queryKey: qk.listUploadHistory(prjctIdx) }),
|
||||
queryClient.invalidateQueries({ queryKey: ["list", "search-filter"] }),
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateListHeaderMutation(prjctIdx: number) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (rows: listHeader[]) => nextApi.patch<void>(`/list/header/${prjctIdx}`, rows),
|
||||
onSuccess: async () => {
|
||||
await queryClient.invalidateQueries({ queryKey: qk.listHeader(prjctIdx) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useResetListMutation(prjctIdx: number) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (request: ListResetRequest) => nextApi.del<number>(`/list/${prjctIdx}`, { json: request }),
|
||||
onSuccess: async () => {
|
||||
await queryClient.invalidateQueries({ queryKey: ["list"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateListMutation(prjctIdx: number) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (request: ListUpdateRequest) => nextApi.patch<number>(`/list/update/${prjctIdx}`, request),
|
||||
onSuccess: async () => {
|
||||
await queryClient.invalidateQueries({ queryKey: ["list", "search-filter"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadListMutation(prjctIdx: number) {
|
||||
return useMutation({
|
||||
mutationFn: (listFilter: ListFilter) =>
|
||||
nextApi.post<ArrayBuffer>(`/list/excel-download/${prjctIdx}`, listFilter, { expectBinary: true }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadListUpdateHistoryMutation(prjctIdx: number) {
|
||||
return useMutation({
|
||||
mutationFn: (listFilter: ListFilter) =>
|
||||
nextApi.post<ArrayBuffer>(`/list/excel-download-update/${prjctIdx}`, listFilter, { expectBinary: true }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadListEventHistoryMutation(prjctIdx: number) {
|
||||
return useMutation({
|
||||
mutationFn: (request: ListEventHistDownloadRequest) =>
|
||||
nextApi.post<ArrayBuffer>(`/list/event-history-download/${prjctIdx}`, request, { expectBinary: true }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadListItemFileMutation(prjctIdx: number) {
|
||||
return useMutation({
|
||||
mutationFn: (listFilter: ListFilter) =>
|
||||
nextApi.post<ArrayBuffer>(`/list/item-file-download/${prjctIdx}`, listFilter, { expectBinary: true }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadUploadHistoryFileMutation(prjctIdx: number) {
|
||||
return useMutation({
|
||||
mutationFn: (listUploadLogId: string) =>
|
||||
nextApi.post<ArrayBuffer>(`/list/upload-history-file/${prjctIdx}/${listUploadLogId}`, undefined, {
|
||||
expectBinary: true,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import type {
|
||||
ProjectListRequest,
|
||||
ProjectOwnerResponse, ProjectUpdateRequest, ResultCode
|
||||
} from "@/types/project";
|
||||
import {PageRequest, PageResponse} from "@/types/common";
|
||||
import type { PageRequest, PageResponse } from "@kri/common";
|
||||
|
||||
export function useProjectOwnerListQuery(enabled: boolean = true) {
|
||||
return useQuery({
|
||||
@@ -227,4 +227,4 @@ export function useUploadScenarioImageMutation(prjctIdx: number, prjctCd: string
|
||||
qc.invalidateQueries({ queryKey: qk.projectInfo(prjctIdx) });
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
23
src/store/cookie/client-cookie.ts
Normal file
23
src/store/cookie/client-cookie.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
createCookieStore,
|
||||
type CookieSetOptions,
|
||||
} from "@kri/common/browser";
|
||||
import type {
|
||||
CookieKey,
|
||||
} from "./cookie-keys";
|
||||
|
||||
export type {
|
||||
CookieSetOptions,
|
||||
};
|
||||
|
||||
export const cookieStore =
|
||||
createCookieStore<CookieKey>({
|
||||
defaults: {
|
||||
days: 365,
|
||||
path: "/",
|
||||
secure: false,
|
||||
sameSite: "Lax",
|
||||
},
|
||||
});
|
||||
@@ -1,11 +1,7 @@
|
||||
export const CookieKeys = {
|
||||
FontSize: "kri_fontSize",
|
||||
AuthToken: "kri_authToken",
|
||||
// 필요하면 여기 계속 추가 (예: Theme: "kri_theme", ...)
|
||||
} as const;
|
||||
|
||||
export const CookieType: Record<CookieKey, "session" | "persistence-http-only" | "persistence"> = {
|
||||
[CookieKeys.FontSize]: "persistence",
|
||||
};
|
||||
|
||||
|
||||
export type CookieKey = (typeof CookieKeys)[keyof typeof CookieKeys];
|
||||
@@ -1,105 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import type { CookieKey } from "./cookie-keys";
|
||||
|
||||
export type CookieSetOptions = {
|
||||
days?: number; // 만료일: 기본 365일
|
||||
path?: string; // 기본 "/"
|
||||
secure?: boolean;
|
||||
sameSite?: "Lax" | "Strict" | "None";
|
||||
};
|
||||
|
||||
function isBrowser() {
|
||||
return typeof document !== "undefined";
|
||||
}
|
||||
|
||||
function buildCookieString(
|
||||
key: CookieKey,
|
||||
value: string,
|
||||
options: CookieSetOptions = {},
|
||||
): string {
|
||||
const {
|
||||
days = 365,
|
||||
path = "/",
|
||||
secure = false,
|
||||
sameSite = "Lax",
|
||||
} = options;
|
||||
|
||||
let cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
||||
|
||||
// 만료일
|
||||
if (Number.isFinite(days)) {
|
||||
const expires = new Date();
|
||||
expires.setDate(expires.getDate() + days);
|
||||
cookie += `; Expires=${expires.toUTCString()}`;
|
||||
}
|
||||
|
||||
if (path) {
|
||||
cookie += `; Path=${path}`;
|
||||
}
|
||||
|
||||
if (secure) {
|
||||
cookie += "; Secure";
|
||||
}
|
||||
|
||||
if (sameSite) {
|
||||
cookie += `; SameSite=${sameSite}`;
|
||||
}
|
||||
|
||||
return cookie;
|
||||
}
|
||||
|
||||
export const cookieStore = {
|
||||
/**
|
||||
* 문자열 값 가져오기 (없으면 null)
|
||||
*/
|
||||
get(key: CookieKey): string | null {
|
||||
if (!isBrowser()) return null;
|
||||
|
||||
try {
|
||||
const name = encodeURIComponent(key) + "=";
|
||||
const cookies = document.cookie ? document.cookie.split("; ") : [];
|
||||
|
||||
for (const c of cookies) {
|
||||
if (c.startsWith(name)) {
|
||||
const value = c.substring(name.length);
|
||||
return decodeURIComponent(value);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 문자열 값 저장
|
||||
*/
|
||||
set(key: CookieKey, value: string, options?: CookieSetOptions) {
|
||||
if (!isBrowser()) return;
|
||||
|
||||
try {
|
||||
const cookie = buildCookieString(key, value, options);
|
||||
document.cookie = cookie;
|
||||
} catch {
|
||||
// 쿠키 설정 실패는 조용히 무시
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 쿠키 삭제
|
||||
*/
|
||||
remove(key: CookieKey, options?: Omit<CookieSetOptions, "days">) {
|
||||
if (!isBrowser()) return;
|
||||
|
||||
try {
|
||||
document.cookie = buildCookieString(key, "", {
|
||||
...(options ?? {}),
|
||||
days: -1, // 과거로 설정해서 삭제
|
||||
});
|
||||
} catch {
|
||||
// 무시
|
||||
}
|
||||
},
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user