탭 전환 메인 구조 단순화

This commit is contained in:
hyunho
2026-03-25 12:57:15 +09:00
parent fc5c2a627d
commit 4feb4e792f
2 changed files with 14 additions and 15 deletions

View File

@@ -8,8 +8,9 @@ const logoutBtn = document.getElementById("logout-btn");
const userBadge = document.getElementById("user-badge");
const currentViewTitle = document.getElementById("current-view-title");
const navButtons = Array.from(document.querySelectorAll(".header-center [data-view]"));
const stages = Array.from(document.querySelectorAll(".main-stage[data-stage]"));
const organizationFrame = document.getElementById("organization-frame");
const organizationStage = document.getElementById("organization-stage");
const emptyStage = document.getElementById("empty-stage");
const viewLabels = {
ledger: "사업관리대장",
@@ -47,11 +48,15 @@ function setActiveView(view) {
button.classList.toggle("active", active);
button.classList.toggle("muted", !active);
});
stages.forEach((stage) => {
stage.hidden = stage.dataset.stage !== currentView;
});
const isOrganization = currentView === "organization";
if (organizationStage) {
organizationStage.hidden = !isOrganization;
}
if (emptyStage) {
emptyStage.hidden = isOrganization;
}
if (currentView === "organization" && previousView !== "organization" && organizationFrame) {
if (isOrganization && previousView !== "organization" && organizationFrame) {
const frameSrc = organizationFrame.dataset.src || organizationFrame.src;
organizationFrame.src = frameSrc;
}