Compare commits

..

No commits in common. "0c1c66f65cffbea8befca4588657e53edf83f427" and "654b8d6e08361105d7542476ea648614657a83bb" have entirely different histories.

3 changed files with 83 additions and 2 deletions

View File

@ -28,7 +28,9 @@ import { logger } from '@/util/logger'
import { QcastContext } from '@/app/QcastProvider' import { QcastContext } from '@/app/QcastProvider'
// [LOW-PITCH-WARN 2026-05-06] + alert // [LOW-PITCH-WARN 2026-05-06] + alert
import { useSwal } from '@/hooks/useSwal' import { useSwal } from '@/hooks/useSwal'
import { notifyLowPitchRestrictionForRoofs } from '@/util/roof-pitch-warning' import { notifyLowPitchRestrictionForRoofs, isLowPitchRestricted, LOW_PITCH_RESTRICTED_ROOF_IDS } from '@/util/roof-pitch-warning'
// [LOW-PITCH-DIAG 2026-05-06 TEMP] import +
import { debugCapture } from '@/util/debugCapture'
const INPUT_MODE = { const INPUT_MODE = {
SIZE_ROOF: '1', SIZE_ROOF: '1',
@ -397,6 +399,15 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, pla
index: 0, index: 0,
} }
// [LOW-PITCH-DIAG 2026-05-06 TEMP]
debugCapture.log('LOW-PITCH-DIAG handleSaveBtn', {
roofMatlCd: roofInfo.roofMatlCd,
pitch: roofInfo.pitch,
angle: roofInfo.angle,
idMatched: LOW_PITCH_RESTRICTED_ROOF_IDS.has(roofInfo.roofMatlCd),
restricted: isLowPitchRestricted(roofInfo),
})
// [LOW-PITCH-WARN 2026-05-06] 6 + (2 < 2.5 OR 11.31 < 14.04) alert. OK // [LOW-PITCH-WARN 2026-05-06] 6 + (2 < 2.5 OR 11.31 < 14.04) alert. OK
await notifyLowPitchRestrictionForRoofs([roofInfo], swalFire, getMessage) await notifyLowPitchRestrictionForRoofs([roofInfo], swalFire, getMessage)

View File

@ -33,7 +33,9 @@ import { useText } from '@/hooks/useText'
import { QLine } from '@/components/fabric/QLine' import { QLine } from '@/components/fabric/QLine'
import { calcLineActualSize2 } from '@/util/qpolygon-utils' import { calcLineActualSize2 } from '@/util/qpolygon-utils'
// [LOW-PITCH-WARN 2026-05-06] 저구배 + 특정 기와 사용 시 시공 매뉴얼 안내 alert // [LOW-PITCH-WARN 2026-05-06] 저구배 + 특정 기와 사용 시 시공 매뉴얼 안내 alert
import { notifyLowPitchRestrictionForRoofs } from '@/util/roof-pitch-warning' import { notifyLowPitchRestrictionForRoofs, isLowPitchRestricted, LOW_PITCH_RESTRICTED_ROOF_IDS } from '@/util/roof-pitch-warning'
// [LOW-PITCH-DIAG 2026-05-06 TEMP] 진단용 — 검증 후 import + 호출 함께 제거
import { debugCapture } from '@/util/debugCapture'
import { logger } from '@/util/logger' import { logger } from '@/util/logger'
export function useRoofAllocationSetting(id) { export function useRoofAllocationSetting(id) {
@ -310,6 +312,18 @@ export function useRoofAllocationSetting(id) {
* 선택한 지붕재로 할당 * 선택한 지붕재로 할당
*/ */
const handleSave = async () => { const handleSave = async () => {
// [LOW-PITCH-DIAG 2026-05-06 TEMP] 진단용 — 검증 후 제거
debugCapture.log('LOW-PITCH-DIAG handleSave', {
count: currentRoofList?.length,
list: currentRoofList?.map((r) => ({
roofMatlCd: r.roofMatlCd,
pitch: r.pitch,
angle: r.angle,
idMatched: LOW_PITCH_RESTRICTED_ROOF_IDS.has(r.roofMatlCd),
restricted: isLowPitchRestricted(r),
})),
})
// [LOW-PITCH-WARN 2026-05-06] 등록된 모든 지붕재에 대해 6종+저구배 검사 후 안내 alert. OK 누르면 저장 진행 // [LOW-PITCH-WARN 2026-05-06] 등록된 모든 지붕재에 대해 6종+저구배 검사 후 안내 alert. OK 누르면 저장 진행
await notifyLowPitchRestrictionForRoofs(currentRoofList, swalFire, getMessage) await notifyLowPitchRestrictionForRoofs(currentRoofList, swalFire, getMessage)
@ -352,6 +366,18 @@ export function useRoofAllocationSetting(id) {
* 지붕재 오른쪽 마우스 클릭 단일로 지붕재 변경 필요한 경우 * 지붕재 오른쪽 마우스 클릭 단일로 지붕재 변경 필요한 경우
*/ */
const handleSaveContext = async () => { const handleSaveContext = async () => {
// [LOW-PITCH-DIAG 2026-05-06 TEMP] 진단용 — 검증 후 제거
debugCapture.log('LOW-PITCH-DIAG handleSaveContext', {
count: currentRoofList?.length,
list: currentRoofList?.map((r) => ({
roofMatlCd: r.roofMatlCd,
pitch: r.pitch,
angle: r.angle,
idMatched: LOW_PITCH_RESTRICTED_ROOF_IDS.has(r.roofMatlCd),
restricted: isLowPitchRestricted(r),
})),
})
// [LOW-PITCH-WARN 2026-05-06] 등록된 모든 지붕재에 대해 6종+저구배 검사 후 안내 alert. OK 누르면 저장 진행 // [LOW-PITCH-WARN 2026-05-06] 등록된 모든 지붕재에 대해 6종+저구배 검사 후 안내 alert. OK 누르면 저장 진행
await notifyLowPitchRestrictionForRoofs(currentRoofList, swalFire, getMessage) await notifyLowPitchRestrictionForRoofs(currentRoofList, swalFire, getMessage)

44
src/util/debugCapture.js Normal file
View File

@ -0,0 +1,44 @@
// util/debugCapture.js
// 디버그 모드에서 상태/오브젝트를 파일로 저장하고 Claude가 읽을 수 있게 함
// 사용법:
// import { debugCapture } from '@/util/debugCapture'
// debugCapture.state('rackInfos', rackInfos) // 오브젝트 스냅샷 저장
// debugCapture.error('fetchFailed', error, context) // 에러 저장
// debugCapture.log('step label', someData) // 로그 저장
const isLoggingEnabled = process.env.NEXT_PUBLIC_ENABLE_LOGGING === 'true'
async function send(type, label, data) {
if (!isLoggingEnabled || typeof window === 'undefined') return
try {
await fetch('/api/debug', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ type, label, data, timestamp: new Date().toISOString() }),
})
} catch {}
}
export const debugCapture = {
// 오브젝트/상태 스냅샷 - debug/debug-snapshot.json 에 저장
state: (label, obj) => send('snapshot', label, obj),
// 에러 캡처 - debug/debug-errors.json 에 저장
error: (label, error, context = null) =>
send('error', label, {
message: error?.message ?? String(error),
stack: error?.stack ?? null,
context,
}),
// 일반 로그 - debug/debug.log 에 저장
log: (label, data) => send('log', label, data),
// 디버그 파일 전체 초기화
clear: async () => {
if (!isLoggingEnabled || typeof window === 'undefined') return
try {
await fetch('/api/debug', { method: 'DELETE' })
} catch {}
},
}