Merge branch 'dev' into dev-yj
This commit is contained in:
commit
62fdd091c6
16
src/app/GlobalDataProvider.js
Normal file
16
src/app/GlobalDataProvider.js
Normal file
@ -0,0 +1,16 @@
|
||||
'use client'
|
||||
|
||||
import { createContext, useState } from 'react'
|
||||
|
||||
export const GlobalDataContext = createContext({
|
||||
managementState: {},
|
||||
setManagementState: () => {},
|
||||
})
|
||||
|
||||
const GlobalDataProvider = ({ children }) => {
|
||||
const [managementState, setManagementState] = useState({})
|
||||
|
||||
return <GlobalDataContext.Provider value={{ managementState, setManagementState }}>{children}</GlobalDataContext.Provider>
|
||||
}
|
||||
|
||||
export default GlobalDataProvider
|
||||
@ -4,10 +4,11 @@ import { getSession } from '@/lib/authActions'
|
||||
import RecoilRootWrapper from './RecoilWrapper'
|
||||
|
||||
import { QcastProvider } from './QcastProvider'
|
||||
import SessionProvider from './SessionProvider'
|
||||
import GlobalDataProvider from './GlobalDataProvider'
|
||||
import Header from '@/components/header/Header'
|
||||
import QModal from '@/components/common/modal/QModal'
|
||||
import Dimmed from '@/components/ui/Dimmed'
|
||||
import SessionProvider from './SessionProvider'
|
||||
import PopupManager from '@/components/common/popupManager/PopupManager'
|
||||
|
||||
import './globals.css'
|
||||
@ -60,26 +61,28 @@ export default async function RootLayout({ children }) {
|
||||
|
||||
return (
|
||||
<RecoilRootWrapper>
|
||||
<html lang="en">
|
||||
<body>
|
||||
{headerPathname === '/login' || headerPathname === '/join' ? (
|
||||
<QcastProvider>{children}</QcastProvider>
|
||||
) : (
|
||||
<QcastProvider>
|
||||
<div className="wrap">
|
||||
<Header userSession={sessionProps} />
|
||||
<div className="content">
|
||||
<Dimmed />
|
||||
<SessionProvider useSession={sessionProps}>{children}</SessionProvider>
|
||||
<GlobalDataProvider>
|
||||
<html lang="en">
|
||||
<body>
|
||||
{headerPathname === '/login' || headerPathname === '/join' ? (
|
||||
<QcastProvider>{children}</QcastProvider>
|
||||
) : (
|
||||
<QcastProvider>
|
||||
<div className="wrap">
|
||||
<Header userSession={sessionProps} />
|
||||
<div className="content">
|
||||
<Dimmed />
|
||||
<SessionProvider useSession={sessionProps}>{children}</SessionProvider>
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
</QcastProvider>
|
||||
)}
|
||||
<QModal />
|
||||
<PopupManager />
|
||||
</body>
|
||||
</html>
|
||||
</QcastProvider>
|
||||
)}
|
||||
<QModal />
|
||||
<PopupManager />
|
||||
</body>
|
||||
</html>
|
||||
</GlobalDataProvider>
|
||||
</RecoilRootWrapper>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,20 +1,18 @@
|
||||
'ues client'
|
||||
|
||||
import { createContext, useEffect, useState } from 'react'
|
||||
import { createContext } from 'react'
|
||||
|
||||
export const ManagementContext = createContext({
|
||||
managementState: {},
|
||||
setManagementState: () => {},
|
||||
})
|
||||
export const ManagementContext = createContext({})
|
||||
|
||||
const ManagementProvider = ({ children }) => {
|
||||
const [managementState, setManagementState] = useState({})
|
||||
// const [managementState, setManagementState] = useState({})
|
||||
|
||||
useEffect(() => {
|
||||
console.log('🚀 ~ managementState:', managementState)
|
||||
}, [managementState])
|
||||
// useEffect(() => {
|
||||
// console.log('🚀 ~ managementState:', managementState)
|
||||
// }, [managementState])
|
||||
|
||||
return <ManagementContext.Provider value={{ managementState, setManagementState }}>{children}</ManagementContext.Provider>
|
||||
// return <ManagementContext.Provider value={{ managementState, setManagementState }}>{children}</ManagementContext.Provider>
|
||||
return <ManagementContext.Provider>{children}</ManagementContext.Provider>
|
||||
}
|
||||
|
||||
export default ManagementProvider
|
||||
|
||||
@ -35,10 +35,6 @@ export const QLine = fabric.util.createClass(fabric.Line, {
|
||||
|
||||
this.startPoint = { x: this.x1, y: this.y1 }
|
||||
this.endPoint = { x: this.x2, y: this.y2 }
|
||||
|
||||
if (canvas) {
|
||||
this.canvas = canvas
|
||||
}
|
||||
},
|
||||
|
||||
init: function () {
|
||||
|
||||
@ -238,11 +238,12 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
||||
<div className="placement-option">
|
||||
<div className="grid-select no-flx" style={{ width: '171px' }}>
|
||||
<QSelectBox
|
||||
title={basicSetting.roofSizeSet === '3' ? getMessage('modal.placement.initial.setting.size.none.pitch') : ''}
|
||||
ref={roofRef.roofCd}
|
||||
options={roofMaterials.map((roof, index) => {
|
||||
return { ...roof, name: globalLocale === 'ko' ? roof.roofMatlNm : roof.roofMatlNmJp }
|
||||
})}
|
||||
value={currentRoofMaterial}
|
||||
value={basicSetting.roofSizeSet === '3' ? null : currentRoofMaterial}
|
||||
onChange={(e) => handleRoofTypeChange(e.roofMatlCd)}
|
||||
sourceKey="id"
|
||||
targetKey="id"
|
||||
|
||||
@ -18,7 +18,8 @@ import WindSelectPop from './popup/WindSelectPop'
|
||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||
import StuffPlanQGrid from './StuffPlanQGrid'
|
||||
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||
import { ManagementContext } from '@/app/management/ManagementProvider'
|
||||
import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
||||
// import { ManagementContext } from '@/app/management/ManagementProvider'
|
||||
import DocDownOptionPop from '../estimate/popup/DocDownOptionPop'
|
||||
import { stuffSearchState } from '@/store/stuffAtom'
|
||||
import { QcastContext } from '@/app/QcastProvider'
|
||||
@ -106,7 +107,7 @@ export default function StuffDetail() {
|
||||
const objectNo = searchParams.get('objectNo') //url에서 물건번호 꺼내서 바로 set
|
||||
|
||||
const [editMode, setEditMode] = useState('NEW')
|
||||
const { managementState, setManagementState } = useContext(ManagementContext)
|
||||
const { managementState, setManagementState } = useContext(GlobalDataContext)
|
||||
const [planGridProps, setPlanGridProps] = useState({
|
||||
planGridData: [],
|
||||
isPageable: false,
|
||||
|
||||
@ -3,11 +3,12 @@
|
||||
import { useContext } from 'react'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import dayjs from 'dayjs'
|
||||
import { ManagementContext } from '@/app/management/ManagementProvider'
|
||||
import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
||||
// import { ManagementContext } from '@/app/management/ManagementProvider'
|
||||
export default function StuffHeader() {
|
||||
const { getMessage } = useMessage()
|
||||
|
||||
const { managementState } = useContext(ManagementContext)
|
||||
const { managementState } = useContext(GlobalDataContext)
|
||||
|
||||
//물건번호 복사
|
||||
const copyObjectNo = async (objectNo) => {
|
||||
|
||||
@ -13,7 +13,8 @@ import { useMessage } from '@/hooks/useMessage'
|
||||
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||
import { isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
|
||||
|
||||
import { ManagementContext } from '@/app/management/ManagementProvider'
|
||||
import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
||||
// import { ManagementContext } from '@/app/management/ManagementProvider'
|
||||
import { SessionContext } from '@/app/SessionProvider'
|
||||
|
||||
export default function StuffSubHeader({ type }) {
|
||||
@ -25,7 +26,7 @@ export default function StuffSubHeader({ type }) {
|
||||
|
||||
const { isGlobalLoading } = useContext(QcastContext)
|
||||
|
||||
const { managementState } = useContext(ManagementContext)
|
||||
const { managementState } = useContext(GlobalDataContext)
|
||||
|
||||
const [buttonStyle, setButtonStyle] = useState('')
|
||||
useEffect(() => {
|
||||
|
||||
@ -54,7 +54,7 @@ export default function SampleReducer() {
|
||||
return t
|
||||
}
|
||||
})
|
||||
setSampleState({ ...sampleState, tabs: newTabs })
|
||||
setSampleState({ tabs: newTabs })
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -3,7 +3,12 @@ import { canvasState, currentObjectState } from '@/store/canvasAtom'
|
||||
import { selectedRoofMaterialSelector } from '@/store/settingAtom'
|
||||
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
|
||||
import { POLYGON_TYPE } from '@/common/common'
|
||||
|
||||
const ROOF_COLOR = {
|
||||
0: 'rgb(199,240,213)',
|
||||
1: 'rgb(178,238,255)',
|
||||
2: 'rgb(187,204,255)',
|
||||
3: 'rgb(228,202,255)',
|
||||
}
|
||||
export function useRoofFn() {
|
||||
const canvas = useRecoilValue(canvasState)
|
||||
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
|
||||
@ -16,6 +21,7 @@ export function useRoofFn() {
|
||||
|
||||
let width = (roofMaterial.width ?? 226) / 10
|
||||
let height = (roofMaterial.length ?? 158) / 10
|
||||
const index = roofMaterial.index ?? 0
|
||||
let roofStyle = 2
|
||||
const inputPatternSize = { width: width, height: height } //임시 사이즈
|
||||
const patternSize = { ...inputPatternSize } // 입력된 값을 뒤집기 위해
|
||||
@ -35,7 +41,7 @@ export function useRoofFn() {
|
||||
const rows = Math.floor(patternSourceCanvas.height / patternSize.height)
|
||||
const cols = Math.floor(patternSourceCanvas.width / patternSize.width)
|
||||
|
||||
ctx.strokeStyle = mode === 'allPainted' ? 'black' : 'blue'
|
||||
ctx.strokeStyle = mode === 'allPainted' ? 'black' : ROOF_COLOR[index]
|
||||
ctx.lineWidth = mode === 'allPainted' ? 1 : 0.4
|
||||
ctx.fillStyle = mode === 'allPainted' ? 'rgba(0, 159, 64, 0.7)' : 'white'
|
||||
|
||||
|
||||
@ -88,10 +88,10 @@ export function useRoofShapePassivitySetting(id) {
|
||||
const lines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
||||
let stroke, strokeWidth
|
||||
lines.forEach((line) => {
|
||||
if (line.attributes.type === LINE_TYPE.WALLLINE.EAVES || line.attributes.type === LINE_TYPE.WALLLINE.HIPANDGABLE) {
|
||||
if (line.attributes?.type === LINE_TYPE.WALLLINE.EAVES || line.attributes?.type === LINE_TYPE.WALLLINE.HIPANDGABLE) {
|
||||
stroke = '#45CD7D'
|
||||
strokeWidth = 4
|
||||
} else if (line.attributes.type === LINE_TYPE.WALLLINE.GABLE || line.attributes.type === LINE_TYPE.WALLLINE.JERKINHEAD) {
|
||||
} else if (line.attributes?.type === LINE_TYPE.WALLLINE.GABLE || line.attributes?.type === LINE_TYPE.WALLLINE.JERKINHEAD) {
|
||||
stroke = '#3FBAE6'
|
||||
strokeWidth = 4
|
||||
} else {
|
||||
@ -136,7 +136,7 @@ export function useRoofShapePassivitySetting(id) {
|
||||
const index = lines.findIndex((line) => line === selectedLine)
|
||||
|
||||
const nextLine = lines[index + 1] || lines[0]
|
||||
if (nextLine.attributes.isFixed) {
|
||||
if (nextLine.attributes?.isFixed) {
|
||||
canvas.discardActiveObject()
|
||||
return
|
||||
}
|
||||
|
||||
@ -108,6 +108,7 @@ export function useContextMenu() {
|
||||
{
|
||||
id: 'roofMaterialPlacement',
|
||||
name: getMessage('contextmenu.roof.material.placement'),
|
||||
component: <RoofAllocationSetting id={popupId} />,
|
||||
},
|
||||
{
|
||||
id: 'roofMaterialRemove',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user