Merge branch 'dev' into dev-yj
This commit is contained in:
commit
86661100e2
@ -25,6 +25,8 @@ import SampleReducer from './sample/SampleReducer'
|
|||||||
import styles from './playground.module.css'
|
import styles from './playground.module.css'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
import useSWRMutation from 'swr/mutation'
|
import useSWRMutation from 'swr/mutation'
|
||||||
|
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
||||||
|
import { canvasPopupStatusStore } from '@/store/canvasPopupStatusAtom'
|
||||||
|
|
||||||
export default function Playground() {
|
export default function Playground() {
|
||||||
const [useCadFile, setUseCadFile] = useRecoilState(useCadFileState)
|
const [useCadFile, setUseCadFile] = useRecoilState(useCadFileState)
|
||||||
@ -267,6 +269,12 @@ export default function Playground() {
|
|||||||
return <div>Error...</div>
|
return <div>Error...</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useCanvasPopupStatusController(1)
|
||||||
|
|
||||||
|
const [canvasPopupStatusState, setCanvasPopupStatusState] = useRecoilState(canvasPopupStatusStore)
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('🚀 ~ Playground ~ canvasPopupStatusState:', canvasPopupStatusState)
|
||||||
|
}, [canvasPopupStatusState])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container mx-auto p-4 m-4 border">
|
<div className="container mx-auto p-4 m-4 border">
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
import { useRecoilValue } from 'recoil'
|
||||||
|
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
||||||
|
import { canvasPopupStatusStore } from '@/store/canvasPopupStatusAtom'
|
||||||
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
|
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||||
|
|
||||||
const SelectOption01 = [{ name: '0' }, { name: '0' }, { name: '0' }, { name: '0' }]
|
const SelectOption01 = [{ name: '0' }, { name: '0' }, { name: '0' }, { name: '0' }]
|
||||||
|
|
||||||
@ -8,6 +11,12 @@ export default function StepUp({}) {
|
|||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [moduleTab, setModuleTab] = useState(1)
|
const [moduleTab, setModuleTab] = useState(1)
|
||||||
const [arrayLength, setArrayLength] = useState(3) //module-table-inner의 반복 개수
|
const [arrayLength, setArrayLength] = useState(3) //module-table-inner의 반복 개수
|
||||||
|
|
||||||
|
useCanvasPopupStatusController(6)
|
||||||
|
const canvasPopupStatusState = useRecoilValue(canvasPopupStatusStore)
|
||||||
|
if (Object.keys(canvasPopupStatusState[6]).length !== 0) {
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="properties-setting-wrap outer">
|
<div className="properties-setting-wrap outer">
|
||||||
|
|||||||
@ -344,8 +344,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
options={raftCodes}
|
options={raftCodes}
|
||||||
ref={roofRef.rafter}
|
ref={roofRef.rafter}
|
||||||
title={
|
title={
|
||||||
raftCodes.find((r) => r.clCode === (currentRoof?.raft === undefined ? currentRoof?.raftBaseCd : currentRoof?.raft))
|
raftCodes.find((r) => r.clCode === (currentRoof?.raft === undefined ? currentRoof?.raftBaseCd : currentRoof?.raft)).clCodeNm
|
||||||
.clCodeNm
|
|
||||||
}
|
}
|
||||||
value={currentRoof?.raft === undefined ? currentRoof?.raftBaseCd : currentRoof?.raft}
|
value={currentRoof?.raft === undefined ? currentRoof?.raftBaseCd : currentRoof?.raft}
|
||||||
onChange={(e) => handleRafterChange(e.clCode)}
|
onChange={(e) => handleRafterChange(e.clCode)}
|
||||||
@ -367,7 +366,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{currentRoof && ['C', 'R'].includes(currentRoof.roofPchAuth) && (
|
{currentRoof && ['C', 'R'].includes(currentRoof?.roofPchAuth) && (
|
||||||
<div className="flex-ment">
|
<div className="flex-ment">
|
||||||
<span>{getMessage('hajebichi')}</span>
|
<span>{getMessage('hajebichi')}</span>
|
||||||
<div className="input-grid" style={{ width: '84px' }}>
|
<div className="input-grid" style={{ width: '84px' }}>
|
||||||
@ -376,10 +375,10 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
className="input-origin block"
|
className="input-origin block"
|
||||||
name={`hajebichi`}
|
name={`hajebichi`}
|
||||||
ref={roofRef.hajebichi}
|
ref={roofRef.hajebichi}
|
||||||
value={parseInt(currentRoof.hajebichi)}
|
value={parseInt(currentRoof?.hajebichi)}
|
||||||
onChange={(e) => onlyNumberInputChange(e, changeInput)}
|
onChange={(e) => onlyNumberInputChange(e, changeInput)}
|
||||||
readOnly={currentRoof.roofPchAuth === 'R'}
|
readOnly={currentRoof?.roofPchAuth === 'R'}
|
||||||
disabled={currentRoof.roofSizeSet === '3'}
|
disabled={currentRoof?.roofSizeSet === '3'}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
28
src/hooks/common/useCanvasPopupStatusController.js
Normal file
28
src/hooks/common/useCanvasPopupStatusController.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useEffect } from 'react'
|
||||||
|
import useSWR from 'swr'
|
||||||
|
import useSWRMutation from 'swr/mutation'
|
||||||
|
import { useAxios } from '../useAxios'
|
||||||
|
import { useRecoilState } from 'recoil'
|
||||||
|
import { canvasPopupStatusStore } from '@/store/canvasPopupStatusAtom'
|
||||||
|
|
||||||
|
export function useCanvasPopupStatusController(popupType) {
|
||||||
|
const [canvasPopupStatusState, setCanvasPopupStatusState] = useRecoilState(canvasPopupStatusStore)
|
||||||
|
const { getFetcher, postFetcher } = useAxios()
|
||||||
|
const {
|
||||||
|
data: popupStatus,
|
||||||
|
error,
|
||||||
|
isLoading,
|
||||||
|
} = useSWR(popupType ? 'canvas-popup-status--data' : null, () => getFetcher(`http://localhost:8080/api/tutorial?popupType=${popupType}`))
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (popupStatus) {
|
||||||
|
setCanvasPopupStatusState({ ...canvasPopupStatusState, [popupType]: popupStatus })
|
||||||
|
}
|
||||||
|
}, [popupStatus])
|
||||||
|
|
||||||
|
const { trigger, isMutating } = useSWRMutation('canvas-popup-status-update', postFetcher)
|
||||||
|
|
||||||
|
return { trigger }
|
||||||
|
}
|
||||||
@ -34,6 +34,7 @@ import { useMasterController } from '@/hooks/common/useMasterController'
|
|||||||
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
|
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
|
||||||
import { useCanvasMenu } from '../common/useCanvasMenu'
|
import { useCanvasMenu } from '../common/useCanvasMenu'
|
||||||
import { menuTypeState } from '@/store/menuAtom'
|
import { menuTypeState } from '@/store/menuAtom'
|
||||||
|
import { usePopup } from '../usePopup'
|
||||||
|
|
||||||
const defaultDotLineGridSetting = {
|
const defaultDotLineGridSetting = {
|
||||||
INTERVAL: {
|
INTERVAL: {
|
||||||
@ -116,6 +117,8 @@ export function useCanvasSetting() {
|
|||||||
|
|
||||||
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
|
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
|
||||||
|
|
||||||
|
const { closeAll } = usePopup()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setFetchRoofMaterials(!fetchRoofMaterials)
|
setFetchRoofMaterials(!fetchRoofMaterials)
|
||||||
if (fetchRoofMaterials) {
|
if (fetchRoofMaterials) {
|
||||||
@ -369,7 +372,7 @@ export function useCanvasSetting() {
|
|||||||
if (!(Object.keys(canvasSetting).length === 0 && canvasSetting.constructor === Object)) {
|
if (!(Object.keys(canvasSetting).length === 0 && canvasSetting.constructor === Object)) {
|
||||||
setBasicSettings({ ...canvasSetting })
|
setBasicSettings({ ...canvasSetting })
|
||||||
}
|
}
|
||||||
//setCanvasSetting({ ...basicSetting })
|
setCanvasSetting({ ...basicSetting })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 기본설정(PlacementShapeSetting) 저장
|
// 기본설정(PlacementShapeSetting) 저장
|
||||||
@ -426,6 +429,7 @@ export function useCanvasSetting() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
swalFire({ text: error.message, icon: 'error' })
|
swalFire({ text: error.message, icon: 'error' })
|
||||||
}
|
}
|
||||||
|
closeAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanvasSetting 조회 및 초기화
|
// CanvasSetting 조회 및 초기화
|
||||||
|
|||||||
13
src/store/canvasPopupStatusAtom.js
Normal file
13
src/store/canvasPopupStatusAtom.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { atom } from 'recoil'
|
||||||
|
|
||||||
|
export const canvasPopupStatusStore = atom({
|
||||||
|
key: 'canvasPopupStatusState',
|
||||||
|
default: {
|
||||||
|
1: {},
|
||||||
|
2: {},
|
||||||
|
3: {},
|
||||||
|
4: {},
|
||||||
|
5: {},
|
||||||
|
6: {},
|
||||||
|
},
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user