This commit is contained in:
hyojun.choi 2024-09-04 18:28:24 +09:00
commit dbb5a56126
4 changed files with 23 additions and 16 deletions

View File

@ -14,7 +14,7 @@ import { Button } from '@nextui-org/react'
import SingleDatePicker from './common/datepicker/SingleDatePicker'
import RangeDatePicker from './common/datepicker/RangeDatePicker'
import QGrid from './common/grid/QGrid'
import { QToast } from '@/hooks/useToast'
import { toastUp } from '@/hooks/useToast'
export default function Intro() {
const { get } = useAxios()
@ -127,7 +127,7 @@ export default function Intro() {
<Button
color="primary"
onClick={() => {
QToast({
toastUp({
message: 'This is a toast message',
type: 'success',
})

View File

@ -14,6 +14,7 @@ import QSelect from '@/components/ui/QSelect'
import styles from './playground.module.css'
import { useRecoilState } from 'recoil'
import { cadFileNameState, useCadFileState } from '@/store/canvasAtom'
import { toastUp } from '@/hooks/useToast'
export default function Playground() {
const [useCadFile, setUseCadFile] = useRecoilState(useCadFileState)
@ -47,9 +48,11 @@ export default function Playground() {
convertDwgToPng(res.data.Files[0].FileName, res.data.Files[0].FileData)
setUseCadFile(true)
setCadFileName(res.data.Files[0].FileName)
toastUp({ message: '파일 변환 완료', type: 'success' })
})
.catch((err) => {
console.error(err)
toastUp({ message: '파일 변환 실패', type: 'error' })
})
}

View File

@ -789,9 +789,11 @@ export default function Roof2(props) {
<Button
className="m-1 p-2"
onClick={() => {
setUseCadFile(false)
setCadFileName('')
handleCadImageInit()
if (useCadFile) {
setUseCadFile(false)
setCadFileName('')
handleCadImageInit()
}
}}
>
cad 파일 초기화
@ -799,15 +801,17 @@ export default function Roof2(props) {
<Button
className="m-1 p-2"
onClick={() => {
backImg
.set({
selectable: false,
})
.sendToBack()
canvas.clear()
canvas.add(backImg)
canvas.renderAll()
setCadFileComplete(true)
if (useCadFile) {
backImg
.set({
selectable: false,
})
.sendToBack()
canvas.clear()
canvas.add(backImg)
canvas.renderAll()
setCadFileComplete(true)
}
}}
>
cad 파일 조정 완료

View File

@ -13,7 +13,7 @@ const toastDefaultOptions = {
closeOnClick: true,
}
const QToast = (props) => {
const toastUp = (props) => {
// type TypeOptions = 'info' | 'success' | 'warning' | 'error' | 'default'
const { message, type = 'info', options } = props
const customOptions = { ...toastDefaultOptions, ...options }
@ -32,4 +32,4 @@ const QToast = (props) => {
}
}
export { QToast }
export { toastUp }