From b8bbaba37fd2407ee233bf286c614f17e71e4d19 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 11:17:23 +0900 Subject: [PATCH 01/15] Update environment configuration: change API host URL to production and set development port to 5010 --- .env.development | 2 +- dev.ecosystem.config.js | 2 +- prd1.ecosystem.config.js | 13 +++++++++++++ prd2.ecosystem.config.js | 13 +++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 prd1.ecosystem.config.js create mode 100644 prd2.ecosystem.config.js diff --git a/.env.development b/.env.development index 8890f8d4..a2f63287 100644 --- a/.env.development +++ b/.env.development @@ -2,7 +2,7 @@ NEXT_PUBLIC_API_SERVER_PATH="https://dev-api.hanasys.jp" NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" -NEXT_PUBLIC_API_HOST_URL="http://1.248.227.176:5000" +NEXT_PUBLIC_API_HOST_URL="https://dev.hanasys.jp" SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" diff --git a/dev.ecosystem.config.js b/dev.ecosystem.config.js index 6a38ad34..3bd3ffde 100644 --- a/dev.ecosystem.config.js +++ b/dev.ecosystem.config.js @@ -6,7 +6,7 @@ module.exports = { instances: 1, exec_mode: 'fork', env: { - NODE_ENV: 'development', + PORT: 5010, }, }, ], diff --git a/prd1.ecosystem.config.js b/prd1.ecosystem.config.js new file mode 100644 index 00000000..6a85f59b --- /dev/null +++ b/prd1.ecosystem.config.js @@ -0,0 +1,13 @@ +module.exports = { + apps: [ + { + name: 'qcast-front-production-1', + script: 'node_modules/next/dist/bin/next', + instances: 1, + exec_mode: 'fork', + env: { + PORT: 5000, + }, + }, + ], +} diff --git a/prd2.ecosystem.config.js b/prd2.ecosystem.config.js new file mode 100644 index 00000000..0083d8e3 --- /dev/null +++ b/prd2.ecosystem.config.js @@ -0,0 +1,13 @@ +module.exports = { + apps: [ + { + name: 'qcast-front-production-2', + script: 'node_modules/next/dist/bin/next', + instances: 1, + exec_mode: 'fork', + env: { + PORT: 5001, + }, + }, + ], +} -- 2.47.2 From 3dc205cb461b3ab15b4056ccf7b31a0b9f34ccbf Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 13:05:47 +0900 Subject: [PATCH 02/15] Refactor environment configuration: update package.json scripts to use env-cmd for different environments and replace process.env.NEXT_PUBLIC_API_HOST_URL with Config().baseUrl in API calls across multiple components. --- .env.localhost | 28 ++++++++++++++++++++++++++++ package.json | 12 +++++++----- src/components/Main.jsx | 6 ++++++ src/config/config.common.js | 11 +++++++++++ src/config/config.development.js | 13 +++++++++++++ src/config/config.export.js | 19 +++++++++++++++++++ src/config/config.local.js | 13 +++++++++++++ src/config/config.production.js | 13 +++++++++++++ src/hooks/common/useRefFiles.js | 11 ++++++----- src/hooks/floorPlan/useImgLoader.js | 3 ++- 10 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 .env.localhost create mode 100644 src/config/config.common.js create mode 100644 src/config/config.development.js create mode 100644 src/config/config.export.js create mode 100644 src/config/config.local.js create mode 100644 src/config/config.production.js diff --git a/.env.localhost b/.env.localhost new file mode 100644 index 00000000..08261ec0 --- /dev/null +++ b/.env.localhost @@ -0,0 +1,28 @@ +NEXT_PUBLIC_API_SERVER_PATH="https://dev-api.hanasys.jp" + +NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" + +NEXT_PUBLIC_API_HOST_URL="http://localhost:3000" + +SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" + +# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" +# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_yAS4QDalL9jgQ7vS" +NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" + +NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" +NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" + +# 테스트용 +# AWS_REGION="ap-northeast-2" +# AMPLIFY_BUCKET="interplug" +# AWS_ACCESS_KEY_ID="AKIAVWMWJCUXFHEAZ4FR" +# AWS_SECRET_ACCESS_KEY="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" +# NEXT_PUBLIC_AWS_S3_BASE_URL="https://interplug.s3.ap-northeast-2.amazonaws.com" + +# 실제 일본 서버 +AWS_REGION="ap-northeast-1" +AMPLIFY_BUCKET="files.hanasys.jp" +AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" +AWS_SECRET_ACCESS_KEY="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" +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" \ No newline at end of file diff --git a/package.json b/package.json index bbddf9ad..4dfc44ef 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,12 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", - "build": "next build", - "start:cluster1": "next start -p 5000", - "start:cluster2": "next start -p 5001", - "start:dev": "next start -p 5010", + "dev": "env-cmd -f .env.localhost next dev", + "build": "env-cmd -f .env.productionnext build", + "build:dev": "env-cmd -f .env.development next build", + "start:cluster1": "env-cmd -f .env.production next start -p 5000", + "start:cluster2": "env-cmd -f .env.production next start -p 5001", + "start:dev": "env-cmd -f .env.development next start -p 5010", "lint": "next lint", "serve": "node server.js" }, @@ -18,6 +19,7 @@ "big.js": "^6.2.2", "chart.js": "^4.4.6", "dayjs": "^1.11.13", + "env-cmd": "^10.1.0", "fabric": "^5.3.0", "framer-motion": "^11.2.13", "fs": "^0.0.1-security", diff --git a/src/components/Main.jsx b/src/components/Main.jsx index 520014b1..7ba7c07e 100644 --- a/src/components/Main.jsx +++ b/src/components/Main.jsx @@ -14,6 +14,7 @@ import { sessionStore } from '@/store/commonAtom' import { isObjectNotEmpty } from '@/util/common-utils' import BoardDetailModal from './community/modal/BoardDetailModal' +import Config from '@/config/config.export' export default function MainPage() { const [sessionState, setSessionState] = useRecoilState(sessionStore) @@ -135,6 +136,11 @@ export default function MainPage() { )} + {Config().mode} +
+ {Config().baseUrl} +
+ {process.env.NEXT_PUBLIC_API_HOST_URL} ) } diff --git a/src/config/config.common.js b/src/config/config.common.js new file mode 100644 index 00000000..dc2208ae --- /dev/null +++ b/src/config/config.common.js @@ -0,0 +1,11 @@ +// local, development, production 과 관계없이 동일한 값으로 반환되는 부분은 해당 함수의 return 되는 부분만 수정하면 됩니다. (달라져야 하는 값이 아닌, 같은 값에 대해서는 local, development, production 파일을 모두 수정할 필요가 없어지게 됩니다.) +export default function getConfigs(params) { + // local, development, production 마다 달라지는 값 + const { baseUrl, mode } = params + + // 공통으로 반환되는 구조 + return { + baseUrl, + mode, + } +} diff --git a/src/config/config.development.js b/src/config/config.development.js new file mode 100644 index 00000000..2c9870a4 --- /dev/null +++ b/src/config/config.development.js @@ -0,0 +1,13 @@ +import getConfigs from './config.common' + +// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 development 환경에 맞는 값을 지정합니다.) +const baseUrl = 'https://dev.hanssys.jp' +const mode = 'development' + +// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다. +const configDevelopment = getConfigs({ + baseUrl, + mode, +}) + +export default configDevelopment diff --git a/src/config/config.export.js b/src/config/config.export.js new file mode 100644 index 00000000..89487634 --- /dev/null +++ b/src/config/config.export.js @@ -0,0 +1,19 @@ +import configDevelopment from './config.development' +import configLocal from './config.local' +import configProduction from './config.production' + +// 클라이언트에서는 이 함수를 사용하여 config 값을 참조합니다. +const Config = () => { + switch (process.env.NEXT_PUBLIC_RUN_MODE) { + case 'local': + return configLocal + case 'development': + return configDevelopment + case 'production': + return configProduction + default: + return configLocal + } +} + +export default Config diff --git a/src/config/config.local.js b/src/config/config.local.js new file mode 100644 index 00000000..b0bee8ad --- /dev/null +++ b/src/config/config.local.js @@ -0,0 +1,13 @@ +import getConfigs from './config.common' + +// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 local 환경에 맞는 값을 지정합니다.) +const baseUrl = 'http://localhost:3000' +const mode = 'local' + +// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다. +const configLocal = getConfigs({ + baseUrl, + mode, +}) + +export default configLocal diff --git a/src/config/config.production.js b/src/config/config.production.js new file mode 100644 index 00000000..fc012875 --- /dev/null +++ b/src/config/config.production.js @@ -0,0 +1,13 @@ +import getConfigs from './config.common' + +// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 production 환경에 맞는 값을 지정합니다.) +const baseUrl = 'https://www.hanasys.jp' +const mode = 'production' + +// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다. +const configProduction = getConfigs({ + baseUrl, + mode, +}) + +export default configProduction diff --git a/src/hooks/common/useRefFiles.js b/src/hooks/common/useRefFiles.js index d13e7213..a74a7f8a 100644 --- a/src/hooks/common/useRefFiles.js +++ b/src/hooks/common/useRefFiles.js @@ -8,6 +8,7 @@ import { useCanvas } from '@/hooks/useCanvas' import { deleteBackGroundImage, setBackGroundImage } from '@/lib/imageActions' import { settingModalFirstOptionsState } from '@/store/settingAtom' import { popSpinnerState } from '@/store/popupAtom' +import Config from '@/config/config.export' /** * 배경 이미지 관리 @@ -97,7 +98,7 @@ export function useRefFiles() { setPopSpinnerStore(true) console.log('🚀 ~ handleFileDelete ~ handleFileDelete:', refImage) console.log('🚀 ~ handleFileDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName) - await del({ url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/upload?fileName=${currentCanvasPlan.bgImageName}` }) + await del({ url: `${Config().baseUrl}/api/image/upload?fileName=${currentCanvasPlan.bgImageName}` }) setCurrentBgImage(null) await deleteBackGroundImage({ objectId: currentCanvasPlan.id, @@ -118,7 +119,7 @@ export function useRefFiles() { confirmFn: async () => { console.log('🚀 ~ handleAddressDelete ~ handleAddressDelete:', refImage) console.log('🚀 ~ handleAddressDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName) - await del({ url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/map?fileName=${currentCanvasPlan.bgImageName}` }) + await del({ url: `${Config().baseUrl}/api/image/map?fileName=${currentCanvasPlan.bgImageName}` }) setMapPositionAddress('') setCurrentBgImage(null) await deleteBackGroundImage({ @@ -149,7 +150,7 @@ export function useRefFiles() { })) const res = await get({ - url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/map?q=${queryRef.current.value}&fileNm=${currentCanvasPlan.id}&zoom=20`, + url: `${Config().baseUrl}/api/image/map?q=${queryRef.current.value}&fileNm=${currentCanvasPlan.id}&zoom=20`, }) console.log('🚀 ~ handleMapImageDown ~ res:', res) setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${res.fileName}`) @@ -208,7 +209,7 @@ export function useRefFiles() { formData.append('file', file) const res = await post({ - url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/upload`, + url: `${Config().baseUrl}/api/image/upload`, data: formData, }) console.log('🚀 ~ handleUploadImageRefFile ~ res:', res) @@ -240,7 +241,7 @@ export function useRefFiles() { /** 캐드 도면 파일 업로드 */ const result = await post({ - url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/cad`, + url: `${Config().baseUrl}/api/image/cad`, data: res, }) console.log('🚀 ~ handleUploadConvertRefFile ~ result:', result) diff --git a/src/hooks/floorPlan/useImgLoader.js b/src/hooks/floorPlan/useImgLoader.js index ca5fef79..12c9cbb2 100644 --- a/src/hooks/floorPlan/useImgLoader.js +++ b/src/hooks/floorPlan/useImgLoader.js @@ -5,6 +5,7 @@ import { usePlan } from '../usePlan' import { POLYGON_TYPE } from '@/common/common' import { QcastContext } from '@/app/QcastProvider' import { useContext } from 'react' +import Config from '@/config/config.export' /** * 이미지 로더 hook @@ -80,7 +81,7 @@ export function useImgLoader() { /** 이미지 크롭 요청 */ const result = await post({ // url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/image/canvas`, - url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/canvas`, + url: `${Config().baseUrl}/api/image/canvas`, data: formData, }) console.log('🚀 ~ handleCanvasToPng ~ result:', result) -- 2.47.2 From ada62ae8ec018e3f5a7516289089a00a419e57a0 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 14:38:20 +0900 Subject: [PATCH 03/15] Add local development configuration: introduce config.local.dev.js and update config export logic in config.export.js. Enhance package.json with a new local:dev script for environment management. --- package.json | 1 + src/config/config.export.js | 3 +++ src/config/config.local.dev.js | 13 +++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 src/config/config.local.dev.js diff --git a/package.json b/package.json index 4dfc44ef..dab5ced3 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "scripts": { "dev": "env-cmd -f .env.localhost next dev", + "local:dev": "env-cmd -f .env.localhost.dev next dev", "build": "env-cmd -f .env.productionnext build", "build:dev": "env-cmd -f .env.development next build", "start:cluster1": "env-cmd -f .env.production next start -p 5000", diff --git a/src/config/config.export.js b/src/config/config.export.js index 89487634..650e1f58 100644 --- a/src/config/config.export.js +++ b/src/config/config.export.js @@ -1,5 +1,6 @@ import configDevelopment from './config.development' import configLocal from './config.local' +import configLocalDev from './config.local.dev' import configProduction from './config.production' // 클라이언트에서는 이 함수를 사용하여 config 값을 참조합니다. @@ -7,6 +8,8 @@ const Config = () => { switch (process.env.NEXT_PUBLIC_RUN_MODE) { case 'local': return configLocal + case 'local.dev': + return configLocalDev case 'development': return configDevelopment case 'production': diff --git a/src/config/config.local.dev.js b/src/config/config.local.dev.js new file mode 100644 index 00000000..5ba35451 --- /dev/null +++ b/src/config/config.local.dev.js @@ -0,0 +1,13 @@ +import getConfigs from './config.common' + +// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 local 환경에 맞는 값을 지정합니다.) +const baseUrl = 'http://1.248.227.176:5000' +const mode = 'local.dev' + +// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다. +const configLocalDev = getConfigs({ + baseUrl, + mode, +}) + +export default configLocalDev -- 2.47.2 From c4e5aa1b01b8a93a26a315469a8c94ee7949a819 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 14:41:03 +0900 Subject: [PATCH 04/15] Update startscript to use local development command for consistency with new environment configuration. --- startscript.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/startscript.js b/startscript.js index e276be78..195c0f59 100644 --- a/startscript.js +++ b/startscript.js @@ -1,2 +1,2 @@ var exec = require('child_process').exec -exec('yarn dev -p 5000', { windowsHide: true }) +exec('yarn local:dev -p 5000', { windowsHide: true }) -- 2.47.2 From 2ed020bbcc5e07b0a9f6d1bad579b3f010329c1f Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 14:48:11 +0900 Subject: [PATCH 05/15] Add local development ecosystem configuration for Next.js application. --- dev.local.ecosystem.config.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 dev.local.ecosystem.config.js diff --git a/dev.local.ecosystem.config.js b/dev.local.ecosystem.config.js new file mode 100644 index 00000000..f508bdcc --- /dev/null +++ b/dev.local.ecosystem.config.js @@ -0,0 +1,13 @@ +module.exports = { + apps: [ + { + name: 'qcast-front-local-development', + script: 'node_modules/next/dist/bin/next', + instances: 1, + exec_mode: 'fork', + env: { + PORT: 5000, + }, + }, + ], +} -- 2.47.2 From 3034e66c4fcf5c4226380ea1f456f11100c56490 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 14:55:37 +0900 Subject: [PATCH 06/15] Add local environment configuration for development: create .env.local.dev file and update package.json with new build script for local development. --- .env.local.dev | 28 ++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 29 insertions(+) create mode 100644 .env.local.dev diff --git a/.env.local.dev b/.env.local.dev new file mode 100644 index 00000000..8890f8d4 --- /dev/null +++ b/.env.local.dev @@ -0,0 +1,28 @@ +NEXT_PUBLIC_API_SERVER_PATH="https://dev-api.hanasys.jp" + +NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" + +NEXT_PUBLIC_API_HOST_URL="http://1.248.227.176:5000" + +SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" + +# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" +# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_yAS4QDalL9jgQ7vS" +NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" + +NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" +NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" + +# 테스트용 +# AWS_REGION="ap-northeast-2" +# AMPLIFY_BUCKET="interplug" +# AWS_ACCESS_KEY_ID="AKIAVWMWJCUXFHEAZ4FR" +# AWS_SECRET_ACCESS_KEY="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" +# NEXT_PUBLIC_AWS_S3_BASE_URL="https://interplug.s3.ap-northeast-2.amazonaws.com" + +# 실제 일본 서버 +AWS_REGION="ap-northeast-1" +AMPLIFY_BUCKET="files.hanasys.jp" +AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" +AWS_SECRET_ACCESS_KEY="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" +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" \ No newline at end of file diff --git a/package.json b/package.json index dab5ced3..763a250f 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "local:dev": "env-cmd -f .env.localhost.dev next dev", "build": "env-cmd -f .env.productionnext build", "build:dev": "env-cmd -f .env.development next build", + "build:dev:local": "env-cmd -f .env.local.dev next build", "start:cluster1": "env-cmd -f .env.production next start -p 5000", "start:cluster2": "env-cmd -f .env.production next start -p 5001", "start:dev": "env-cmd -f .env.development next start -p 5010", -- 2.47.2 From 272ff4f93f5ea494a581b78a8d92e3c8aa8d1395 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Thu, 29 May 2025 15:00:34 +0900 Subject: [PATCH 07/15] =?UTF-8?q?=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EB=AA=A8?= =?UTF-8?q?=EB=93=9C=EC=8B=9C=20config=20=EC=B0=BD=EC=9D=80=20=EC=95=88?= =?UTF-8?q?=EB=8B=AB=ED=9E=88=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/common/useCommonUtils.js | 5 +++-- src/hooks/usePopup.js | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/hooks/common/useCommonUtils.js b/src/hooks/common/useCommonUtils.js index fd021135..b5b4ed51 100644 --- a/src/hooks/common/useCommonUtils.js +++ b/src/hooks/common/useCommonUtils.js @@ -22,7 +22,7 @@ export function useCommonUtils() { const lengthTextFont = useRecoilValue(fontSelector('lengthText')) const commonTextFont = useRecoilValue(fontSelector('commonText')) const [commonUtils, setCommonUtilsState] = useRecoilState(commonUtilsState) - const { addPopup, closeAll } = usePopup() + const { addPopup, closeAll, targetClose } = usePopup() const { drawDirectionArrow, addLengthText } = usePolygon() const { applyDormers } = useObjectBatch({}) @@ -38,8 +38,9 @@ export function useCommonUtils() { const commonTextMode = () => { let textbox - closeAll() + if (commonUtils.text) { + targetClose('other') setTimeout(() => { commonTextKeyEvent() addCanvasMouseEventListener('mouse:down', (event) => { diff --git a/src/hooks/usePopup.js b/src/hooks/usePopup.js index 726ab353..c8a43b2a 100644 --- a/src/hooks/usePopup.js +++ b/src/hooks/usePopup.js @@ -128,11 +128,17 @@ export function usePopup() { } } + const targetClose = (type) => { + popup[type] = [] + setPopup({ ...popup, [type]: [] }) + } + return { popup, addPopup, closePopup, closePopups, closeAll, + targetClose, } } -- 2.47.2 From 3594e96a87c70d22f1723a7e7acf6f34633cb116 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 15:13:36 +0900 Subject: [PATCH 08/15] Fix local development script in package.json to reference the correct .env.local.dev file. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 763a250f..3f2f516c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "dev": "env-cmd -f .env.localhost next dev", - "local:dev": "env-cmd -f .env.localhost.dev next dev", + "local:dev": "env-cmd -f .env.local.dev next dev", "build": "env-cmd -f .env.productionnext build", "build:dev": "env-cmd -f .env.development next build", "build:dev:local": "env-cmd -f .env.local.dev next build", -- 2.47.2 From 772cccce89b51c7e8e36e31d86e11e3e96fb4418 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 15:27:52 +0900 Subject: [PATCH 09/15] Update environment configuration files to include NEXT_PUBLIC_RUN_MODE for development, local.dev, local, and production environments. Adjust package.json script to rename build command for local development. --- .env.development | 2 ++ .env.local.dev | 2 ++ .env.localhost | 2 ++ .env.production | 2 ++ package.json | 2 +- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.env.development b/.env.development index a2f63287..a2e762f7 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,5 @@ +NEXT_PUBLIC_RUN_MODE="development" + NEXT_PUBLIC_API_SERVER_PATH="https://dev-api.hanasys.jp" NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" diff --git a/.env.local.dev b/.env.local.dev index 8890f8d4..dc91dbc7 100644 --- a/.env.local.dev +++ b/.env.local.dev @@ -1,3 +1,5 @@ +NEXT_PUBLIC_RUN_MODE="local.dev" + NEXT_PUBLIC_API_SERVER_PATH="https://dev-api.hanasys.jp" NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" diff --git a/.env.localhost b/.env.localhost index 08261ec0..bca449ce 100644 --- a/.env.localhost +++ b/.env.localhost @@ -1,3 +1,5 @@ +NEXT_PUBLIC_RUN_MODE="local" + NEXT_PUBLIC_API_SERVER_PATH="https://dev-api.hanasys.jp" NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" diff --git a/.env.production b/.env.production index 1c886cfd..6295bb97 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,5 @@ +NEXT_PUBLIC_RUN_MODE="production" + NEXT_PUBLIC_API_SERVER_PATH="https://api.hanasys.jp/" NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" diff --git a/package.json b/package.json index 3f2f516c..d784f800 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "local:dev": "env-cmd -f .env.local.dev next dev", "build": "env-cmd -f .env.productionnext build", "build:dev": "env-cmd -f .env.development next build", - "build:dev:local": "env-cmd -f .env.local.dev next build", + "build:local.dev": "env-cmd -f .env.local.dev next build", "start:cluster1": "env-cmd -f .env.production next start -p 5000", "start:cluster2": "env-cmd -f .env.production next start -p 5001", "start:dev": "env-cmd -f .env.development next start -p 5010", -- 2.47.2 From 5e8542efe54821db35cbb24d6faccf40da67619a Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 15:38:46 +0900 Subject: [PATCH 10/15] Remove unused environment configuration display from Main component. --- src/components/Main.jsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/Main.jsx b/src/components/Main.jsx index 7ba7c07e..9afadca7 100644 --- a/src/components/Main.jsx +++ b/src/components/Main.jsx @@ -136,11 +136,6 @@ export default function MainPage() { )} - {Config().mode} -
- {Config().baseUrl} -
- {process.env.NEXT_PUBLIC_API_HOST_URL} ) } -- 2.47.2 From 1fe86746c13d093c3864e4254db4856db9da1abc Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Thu, 29 May 2025 15:47:49 +0900 Subject: [PATCH 11/15] =?UTF-8?q?=EC=A7=80=EB=B6=95=20=ED=9D=90=EB=A6=84?= =?UTF-8?q?=EB=B0=A9=ED=96=A5=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/usePolygon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/usePolygon.js b/src/hooks/usePolygon.js index 148683ef..bcaec973 100644 --- a/src/hooks/usePolygon.js +++ b/src/hooks/usePolygon.js @@ -1100,7 +1100,7 @@ export const usePolygon = () => { }) // blue로 생성된 것들은 대표라인이 될 수 없음. - // representLines = representLines.filter((line) => line.stroke !== 'blue') + representLines = representLines.filter((line) => line.stroke !== 'blue') // representLines중 가장 긴 line을 찾는다. representLines.forEach((line) => { if (!representLine) { -- 2.47.2 From 1cd24aeca929a6a843201b69360eb92b6bf22927 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 15:55:53 +0900 Subject: [PATCH 12/15] Refactor image upload process: set fixed ContentType for uploaded images and convert Base64 to Blob for file handling in useRefFiles hook. --- src/app/api/image/cad/route.js | 3 ++- src/hooks/common/useRefFiles.js | 31 ++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/app/api/image/cad/route.js b/src/app/api/image/cad/route.js index b7d64a50..a0e60a4c 100644 --- a/src/app/api/image/cad/route.js +++ b/src/app/api/image/cad/route.js @@ -11,9 +11,10 @@ const s3 = new S3Client({ }) const uploadImage = async (file) => { + console.log('🚀 ~ uploadImage ~ file:', file) const Body = Buffer.from(await file.arrayBuffer()) const Key = `cads/${file.name}` - const ContentType = file.ContentType + const ContentType = 'image/png' await s3.send( new PutObjectCommand({ diff --git a/src/hooks/common/useRefFiles.js b/src/hooks/common/useRefFiles.js index a74a7f8a..90c96f30 100644 --- a/src/hooks/common/useRefFiles.js +++ b/src/hooks/common/useRefFiles.js @@ -8,7 +8,6 @@ import { useCanvas } from '@/hooks/useCanvas' import { deleteBackGroundImage, setBackGroundImage } from '@/lib/imageActions' import { settingModalFirstOptionsState } from '@/store/settingAtom' import { popSpinnerState } from '@/store/popupAtom' -import Config from '@/config/config.export' /** * 배경 이미지 관리 @@ -239,14 +238,40 @@ export function useRefFiles() { const res = await post({ url: converterUrl, data: formData }) console.log('🚀 ~ handleUploadConvertRefFile ~ res:', res) + // Convert Base64 to Blob + const base64Data = res.Files[0].FileData + const byteCharacters = atob(base64Data) + const byteArrays = [] + + for (let offset = 0; offset < byteCharacters.length; offset += 512) { + const slice = byteCharacters.slice(offset, offset + 512) + const byteNumbers = new Array(slice.length) + + for (let i = 0; i < slice.length; i++) { + byteNumbers[i] = slice.charCodeAt(i) + } + + const byteArray = new Uint8Array(byteNumbers) + byteArrays.push(byteArray) + } + + const blob = new Blob(byteArrays, { type: 'image/png' }) + + // Create File object from Blob + const convertImg = new File([blob], res.Files[0].FileName, { type: 'image/png' }) + + const newFormData = new FormData() + newFormData.append('file', convertImg) + /** 캐드 도면 파일 업로드 */ const result = await post({ url: `${Config().baseUrl}/api/image/cad`, - data: res, + data: newFormData, }) console.log('🚀 ~ handleUploadConvertRefFile ~ result:', result) - setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${res.fileName}`) + // setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${result.fileName}`) + setCurrentBgImage(result.filePath) setRefImage(file) const params = { -- 2.47.2 From da69eaa00ad684ed1478613d0e29f3de650cb800 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 29 May 2025 16:27:09 +0900 Subject: [PATCH 13/15] Import configuration module in useRefFiles hook for enhanced background image management. --- src/hooks/common/useRefFiles.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/common/useRefFiles.js b/src/hooks/common/useRefFiles.js index 90c96f30..e287221a 100644 --- a/src/hooks/common/useRefFiles.js +++ b/src/hooks/common/useRefFiles.js @@ -8,6 +8,7 @@ import { useCanvas } from '@/hooks/useCanvas' import { deleteBackGroundImage, setBackGroundImage } from '@/lib/imageActions' import { settingModalFirstOptionsState } from '@/store/settingAtom' import { popSpinnerState } from '@/store/popupAtom' +import Config from '@/config/config.export' /** * 배경 이미지 관리 -- 2.47.2 From 313be228be2e8ef4dc77c202b67dde8b3f4e6536 Mon Sep 17 00:00:00 2001 From: yjnoh Date: Thu, 29 May 2025 16:37:30 +0900 Subject: [PATCH 14/15] =?UTF-8?q?[1072]=20:=20[=E4=BC=8F=E5=9B=B3=E5=85=A5?= =?UTF-8?q?=E5=8A=9B=E3=81=AE"=E5=B1=8B=E6=A0=B9=E5=BD=A2=E7=8A=B6?= =?UTF-8?q?=E3=81=AE=E6=89=8B=E5=8B=95=E8=A8=AD=E5=AE=9A"=E3=81=AB?= =?UTF-8?q?=E3=81=A4=E3=81=84=E3=81=A6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [작업내용] : 메뉴 삭제 --- src/store/menuAtom.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/store/menuAtom.js b/src/store/menuAtom.js index 6cfa656c..fdb50461 100644 --- a/src/store/menuAtom.js +++ b/src/store/menuAtom.js @@ -37,11 +37,11 @@ export const subMenusState = atom({ // 지붕덮개 { id: 0, name: 'plan.menu.roof.cover.outline.drawing', menu: MENU.ROOF_COVERING.EXTERIOR_WALL_LINE }, { id: 1, name: 'plan.menu.roof.cover.roof.shape.setting', menu: MENU.ROOF_COVERING.ROOF_SHAPE_SETTINGS }, - { - id: 2, - name: 'plan.menu.roof.cover.roof.shape.passivity.setting', - menu: MENU.ROOF_COVERING.ROOF_SHAPE_PASSIVITY_SETTINGS, - }, + // { + // id: 2, + // name: 'plan.menu.roof.cover.roof.shape.passivity.setting', + // menu: MENU.ROOF_COVERING.ROOF_SHAPE_PASSIVITY_SETTINGS, + // }, { id: 3, name: 'plan.menu.roof.cover.auxiliary.line.drawing', menu: MENU.ROOF_COVERING.HELP_LINE_DRAWING }, { id: 4, name: 'plan.menu.roof.cover.eaves.kerava.edit', menu: MENU.ROOF_COVERING.EAVES_KERAVA_EDIT }, { id: 5, name: 'plan.menu.roof.cover.movement.shape.updown', menu: MENU.ROOF_COVERING.MOVEMENT_SHAPE_UPDOWN }, -- 2.47.2 From df323ffb389e7f5eedb2e924cccbc45c1ea4ea4d Mon Sep 17 00:00:00 2001 From: ysCha Date: Thu, 29 May 2025 16:42:34 +0900 Subject: [PATCH 15/15] =?UTF-8?q?qna=20selectbox=20hidden=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC,=20alert=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community/modal/QnaRegModal.jsx | 25 ++++++++++++++----- src/locales/ja.json | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/components/community/modal/QnaRegModal.jsx b/src/components/community/modal/QnaRegModal.jsx index 86d62428..d04f00fa 100644 --- a/src/components/community/modal/QnaRegModal.jsx +++ b/src/components/community/modal/QnaRegModal.jsx @@ -13,6 +13,7 @@ import { QcastContext } from '@/app/QcastProvider' import { useAxios } from '@/hooks/useAxios' import { globalLocaleStore } from '@/store/localeAtom' import { e } from 'mathjs' +import { set } from 'react-hook-form' export default function QnaRegModal({ setOpen, setReload, searchValue, selectPageBlock }) { @@ -24,6 +25,7 @@ export default function QnaRegModal({ setOpen, setReload, searchValue, selectPag const [qnaData, setQnaData] = useState([]) const [closeMdFlg, setCloseMdFlg] = useState(true) const [closeSmFlg, setCloseSmFlg] = useState(true) + const [hideSmFlg, setHideSmFlg] = useState(false) const qnaTypeLgCodeRef = useRef(null) const qnaTypeMdCodeRef = useRef(null) const qnaTypeSmCodeRef = useRef(null) @@ -71,7 +73,7 @@ let fileCheck = false; regUserTelNoRef.current.value = '' qnaTypeLgCodeRef.current.setValue(); qnaTypeMdCodeRef.current.setValue(); - qnaTypeSmCodeRef.current.setValue(); + qnaTypeSmCodeRef.current?.setValue(); titleRef.current.value = '' contentsRef.current.value = '' @@ -112,7 +114,7 @@ let fileCheck = false; setQnaData({ ...qnaData, qnaClsLrgCd:e.clCode}) setCloseMdFlg(false) qnaTypeMdCodeRef.current.setValue(); - qnaTypeSmCodeRef.current.setValue(); + qnaTypeSmCodeRef.current?.setValue(); } } @@ -131,10 +133,20 @@ let fileCheck = false; } }) - setQnaTypeSmCodeList(codeList) + + setQnaData({ ...qnaData, qnaClsMidCd: e.clCode }) setCloseSmFlg(false) - qnaTypeSmCodeRef.current.setValue(); + setQnaTypeSmCodeList(codeList) + qnaTypeSmCodeRef.current?.setValue(); + + if(codeList.length > 0) { + setHideSmFlg(false) + }else{ + setHideSmFlg(true) + } + + } @@ -393,6 +405,7 @@ let fileCheck = false; />
+ {!hideSmFlg && (