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:
유병철
2026-02-19 16:30:07 +09:00
parent b8dcb69e47
commit a2c3e4c41e
136 changed files with 1987 additions and 896 deletions

View File

@@ -29,6 +29,8 @@ import type { Post } from '../types';
import { getBoards } from '../BoardManagement/actions';
import { getPosts, getMyPosts, deletePost } from '../actions';
import type { Board } from '../BoardManagement/types';
import { toast } from 'sonner';
import { DeleteConfirmDialog } from '@/components/ui/confirm-dialog';
export function BoardListUnified() {
const router = useRouter();
@@ -42,6 +44,9 @@ export function BoardListUnified() {
const [startDate, setStartDate] = useState('');
const [endDate, setEndDate] = useState('');
// 삭제 확인 상태
const [deleteTarget, setDeleteTarget] = useState<{ boardCode: string; id: string } | null>(null);
// 현재 사용자 ID 가져오기
useEffect(() => {
const userId = localStorage.getItem('user_id') || '';
@@ -205,13 +210,8 @@ export function BoardListUnified() {
router.push(`/ko/board/${item.boardCode}/${item.id}?mode=edit`);
};
const handleDelete = async () => {
if (confirm('정말 삭제하시겠습니까?')) {
const result = await deletePost(item.boardCode, item.id);
if (result.success) {
window.location.reload(); // 삭제 후 새로고침
}
}
const handleDelete = () => {
setDeleteTarget({ boardCode: item.boardCode, id: item.id });
};
return (
@@ -296,13 +296,8 @@ export function BoardListUnified() {
router.push(`/ko/board/${item.boardCode}/${item.id}?mode=edit`);
};
const handleDelete = async () => {
if (confirm('정말 삭제하시겠습니까?')) {
const result = await deletePost(item.boardCode, item.id);
if (result.success) {
window.location.reload();
}
}
const handleDelete = () => {
setDeleteTarget({ boardCode: item.boardCode, id: item.id });
};
return (
@@ -361,10 +356,29 @@ export function BoardListUnified() {
itemsPerPage: 20,
}), [activeTab, boards, currentUserId, fetchTabs, router, startDate, endDate]);
const handleDeleteConfirm = useCallback(async () => {
if (!deleteTarget) return;
const result = await deletePost(deleteTarget.boardCode, deleteTarget.id);
if (result.success) {
window.location.reload();
}
setDeleteTarget(null);
}, [deleteTarget]);
return (
<UniversalListPage<Post>
config={config}
/>
<>
<UniversalListPage<Post>
config={config}
/>
<DeleteConfirmDialog
open={deleteTarget !== null}
onOpenChange={(open) => !open && setDeleteTarget(null)}
onConfirm={handleDeleteConfirm}
title="게시글 삭제"
description="정말 삭제하시겠습니까?"
/>
</>
);
}