feat: 공동작업을 위한 프로젝트 구조 최적화 및 가이드 배포

This commit is contained in:
2026-04-13 17:29:13 +09:00
parent 6bca7beb8e
commit 6a038f0a64
50 changed files with 2874 additions and 1244 deletions

37
src/components/Sidebar.ts Normal file
View File

@@ -0,0 +1,37 @@
import { state } from '../state';
export function initSidebar(renderContent: () => void) {
const navItems = document.querySelectorAll('.nav-list li');
const titleElement = document.getElementById('current-tab-title') as HTMLHeadingElement;
const btnAddAsset = document.getElementById('btn-add-asset') as HTMLButtonElement;
navItems.forEach(item => {
item.addEventListener('click', () => {
// 탭 UI 업데이트
navItems.forEach(nav => nav.classList.remove('active'));
item.classList.add('active');
// 상태 업데이트
state.activeCategory = item.getAttribute('data-category') as 'hw' | 'sw';
state.activeSubTab = item.getAttribute('data-tab') || '대시보드';
// 타이틀 업데이트 (Deep Green 포인트 컬러 유지)
const catName = state.activeCategory === 'hw' ? '하드웨어' : '소프트웨어';
if (titleElement) {
titleElement.textContent = `${catName} / ${state.activeSubTab}`;
}
// 추가 버튼 노출 여부 (대시보드에서는 숨김)
if (btnAddAsset) {
if (state.activeSubTab === '대시보드') {
btnAddAsset.classList.add('hidden');
} else {
btnAddAsset.classList.remove('hidden');
}
}
// 화면 리렌더링
renderContent();
});
});
}