refactor(WEB): 프론트엔드 대규모 코드 정리 및 리팩토링
- 미사용 코드 삭제: ThemeContext, itemStore, utils/date.ts, utils/formatAmount.ts - 유틸리티 이동: date, formatAmount → src/lib/utils/ (중앙 집중화) - 다수 page.tsx 클라이언트 컴포넌트 패턴 통일 - DateRangeSelector 리팩토링 및 date-range-picker UI 컴포넌트 추가 - ThemeSelect/themeStore Zustand 직접 연동으로 전환 - 건설/회계/영업/품목/출하 등 전반적 컴포넌트 개선 - UniversalListPage, IntegratedListTemplateV2 타입 확장 - 프론트엔드 종합 리뷰 문서 및 개선 체크리스트 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { usePermission } from '@/hooks/usePermission';
|
||||
import { format } from 'date-fns';
|
||||
import { Trash2, Send, Save, Eye, Loader2 } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { DeleteConfirmDialog } from '@/components/ui/confirm-dialog';
|
||||
import { IntegratedDetailTemplate } from '@/components/templates/IntegratedDetailTemplate';
|
||||
import {
|
||||
documentCreateConfig,
|
||||
@@ -110,6 +111,9 @@ export function DocumentCreate() {
|
||||
// 복제 모드 toast 중복 호출 방지
|
||||
const copyToastShownRef = useRef(false);
|
||||
|
||||
// 삭제 확인 다이얼로그
|
||||
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
|
||||
|
||||
// Hydration 불일치 방지: 클라이언트에서만 날짜 초기화
|
||||
useEffect(() => {
|
||||
const today = format(new Date(), 'yyyy-MM-dd');
|
||||
@@ -327,10 +331,12 @@ export function DocumentCreate() {
|
||||
router.back();
|
||||
}, [router]);
|
||||
|
||||
const handleDelete = useCallback(async () => {
|
||||
if (!confirm('작성 중인 문서를 삭제하시겠습니까?')) {
|
||||
return;
|
||||
}
|
||||
const handleDelete = useCallback(() => {
|
||||
setIsDeleteDialogOpen(true);
|
||||
}, []);
|
||||
|
||||
const handleDeleteConfirm = useCallback(async () => {
|
||||
setIsDeleteDialogOpen(false);
|
||||
|
||||
// 수정 모드: 실제 문서 삭제
|
||||
if (isEditMode && documentId) {
|
||||
@@ -639,6 +645,14 @@ export function DocumentCreate() {
|
||||
handleSubmit();
|
||||
}}
|
||||
/>
|
||||
|
||||
<DeleteConfirmDialog
|
||||
open={isDeleteDialogOpen}
|
||||
onOpenChange={setIsDeleteDialogOpen}
|
||||
onConfirm={handleDeleteConfirm}
|
||||
title="문서 삭제"
|
||||
description="작성 중인 문서를 삭제하시겠습니까?"
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user