diff --git a/src/components/floor-plan/modal/ImgLoad.jsx b/src/components/floor-plan/modal/ImgLoad.jsx index 52ca977c..fa365c84 100644 --- a/src/components/floor-plan/modal/ImgLoad.jsx +++ b/src/components/floor-plan/modal/ImgLoad.jsx @@ -1,12 +1,32 @@ +import { useMessage } from '@/hooks/useMessage' +import { useRefFiles } from '@/hooks/common/useRefFiles' +import { usePlan } from '@/hooks/usePlan' + import WithDraggable from '@/components/common/draggable/WithDraggable' export default function ImgLoad() { + const { + refImage, + queryRef, + setRefImage, + handleRefFile, + refFileMethod, + setRefFileMethod, + handleRefFileMethod, + mapPositionAddress, + setMapPositionAddress, + handleFileDelete, + handleMapImageDown, + } = useRefFiles() + const { currentCanvasPlan } = usePlan() + const { getMessage } = useMessage() + return (
-

画像を読み込む

- +

{getMessage('common.input.file')}

+ {/* */}
@@ -19,7 +39,7 @@ export default function ImgLoad() {
- + handleRefFileMethod(e)} checked={refFileMethod === '1'} />
@@ -28,26 +48,34 @@ export default function ImgLoad() { ファイルの追加 - + handleRefFile(e.target.files[0])} />
- - + {/* + */} + {currentCanvasPlan?.bgImageName === null ? ( + + ) : ( + + )} + {(refImage || currentCanvasPlan?.bgImageName) && }
- + handleRefFileMethod(e)} checked={refFileMethod === '2'} />
- +
- - + {mapPositionAddress && } + {/* */}
diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx index c8dbdbca..6a69aaca 100644 --- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx +++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx @@ -8,8 +8,6 @@ import { useMessage } from '@/hooks/useMessage' import { useAxios } from '@/hooks/useAxios' import { useSwal } from '@/hooks/useSwal' import { usePopup } from '@/hooks/usePopup' -import useRefFiles from '@/hooks/common/useRefFiles' -import { usePlan } from '@/hooks/usePlan' import SizeGuide from '@/components/floor-plan/modal/placementShape/SizeGuide' import MaterialGuide from '@/components/floor-plan/modal/placementShape/MaterialGuide' @@ -24,20 +22,6 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set const [canvasSetting, setCanvasSetting] = useRecoilState(canvasSettingState) const { closePopup } = usePopup() const [basicSetting, setBasicSettings] = useRecoilState(basicSettingState) - const { - refImage, - queryRef, - setRefImage, - handleRefFile, - refFileMethod, - setRefFileMethod, - handleRefFileMethod, - mapPositionAddress, - setMapPositionAddress, - handleFileDelete, - handleMapImageDown, - } = useRefFiles() - const { currentCanvasPlan } = usePlan() const { getMessage } = useMessage() const { get, post } = useAxios() @@ -503,90 +487,6 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
- - {getMessage('common.input.file')} - -
-
- handleRefFileMethod(e)} - checked={refFileMethod === '1'} - /> - -
-
- handleRefFileMethod(e)} - checked={refFileMethod === '2'} - /> - -
-
- - {/* 파일 불러오기 */} - {refFileMethod === '1' && ( -
-
- - handleRefFile(e.target.files[0])} /> -
-
- {currentCanvasPlan?.bgImageName === null ? ( - - ) : ( - - )} - {(refImage || currentCanvasPlan?.bgImageName) && } -
-
- )} - - {/* 주소 불러오기 */} - {refFileMethod === '2' && ( -
- setMapPositionAddress(e.target.value)} - /> -
- -
- {mapPositionAddress && } - {/* */} -
- )} - {/*
-
- - handleRefFile(e.target.files[0])} /> -
-
- - {refImage && } -
-
*/} - -
diff --git a/src/hooks/common/useRefFiles.js b/src/hooks/common/useRefFiles.js index a5d085cc..07680c17 100644 --- a/src/hooks/common/useRefFiles.js +++ b/src/hooks/common/useRefFiles.js @@ -7,7 +7,7 @@ import { convertDwgToPng } from '@/lib/cadAction' import { useAxios } from '../useAxios' import { currentCanvasPlanState } from '@/store/canvasAtom' -export default function useRefFiles() { +export function useRefFiles() { const converterUrl = process.env.NEXT_PUBLIC_CONVERTER_API_URL const [refImage, setRefImage] = useState(null) const [refFileMethod, setRefFileMethod] = useState('1')