feat(B 페이지): 떠남 물음 가드 · 지금 프로젝트 = 탭마다 (PLAN 572-2 · 요구 400~403)

- B04 · B07 · B08 · B09 가 공용 guardProjectLeave 에 {dirty, save, discard} 등록 — 고침 있을 때만 [취소 · 폐기 · 저장]
  - B04 = 관 지점 고침(drainageDirty) · 저장 = 관 지점 · 세부유역 영구저장
  - B07 = CAD · 탭 고침 · 저장 = saveEditedDrawings · 폐기 = 고친 도면 CAD 자동백업도 버림(discardEditedRecovery)
  - B08 = 세션 b08-* 칸 넷 · 저장 = saveShown · B09 = b09-estimation 칸 · 저장 = saveChanged
- 지금 프로젝트 직접 읽기(localStorage) → currentProjectId() · B02 새 프로젝트 = setCurrentProject — B02 · B03 · B04 · B07 · B08 · B09 · B11
- 다른 프로젝트 보관함 지우기 셋(B04 · B05 종단 · B11) 뺌 — enterProject 한 곳 · 다른 탭 보관분 안 지움
- B02 · B03 은 가드 없음 — 저장 안 한 프로젝트 값 없음(B03 올리기 끊김은 이어 올리기 배너가 받음)
- 시험 test_560_4 넓힘(B 가드 · 탭 프로젝트 · 보관함) · helper_298_2 · helper_481_2 · test_204_2 흉내를 currentProjectId 로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 18:07:58 +09:00
co-authored by Claude Opus 5.5
parent 92d952d8ac
commit 676b46eb9e
21 changed files with 154 additions and 47 deletions
+3 -7
View File
@@ -1,9 +1,4 @@
import {
CURRENT_PROJECT_ID_KEY,
ROUTES,
UPLOAD_ALLOWED_EXT,
UPLOAD_MAX_FILES,
} from "@config/config_frontend";
import { ROUTES, UPLOAD_ALLOWED_EXT, UPLOAD_MAX_FILES } from "@config/config_frontend";
import { currentLanguageIndex, ui_locales } from "@ui/ui_template_locale";
import { createBanner } from "@ui/ui_template_banner";
import { createDrop } from "@ui/ui_template_drop";
@@ -56,6 +51,7 @@ import {
} from "./B03_FileInput_UI_Support";
import "./B03_FileInput_UI_Style.css";
import "./B03_FileInput_UI_Style_Card.css";
import { currentProjectId } from "../A00_Common/b_project_switch";
function L(key: keyof typeof ui_locales): string {
return ui_locales[key][currentLanguageIndex];
@@ -72,7 +68,7 @@ export async function renderB03FileInput(root: HTMLElement): Promise<void> {
const progressMap = new Map<FileSlot, ProgressBarHandle>();
let uploadButton: HTMLButtonElement;
let resumeBanner: HTMLDivElement;
let activeProjectId = localStorage.getItem(CURRENT_PROJECT_ID_KEY) ?? "";
let activeProjectId = currentProjectId();
// 업로드가 도는 동안은 화면 전체를 잠근다 — 같은 파일을 두 번 올리거나 도중에 다른
// 단계로 넘어가는 것을 막는다(2026-08-08 사용자 지시).
let pageRoot: HTMLElement | null = null;
+5 -4
View File
@@ -7,7 +7,7 @@
* 화면이 들고 있는 상태는 `ctx` 로 받아 쓰기만 한다 — 동작·순서는 종전과 같다.
* ========================================================================== */
import { CURRENT_PROJECT_ID_KEY, type RoutePath } from "@config/config_frontend";
import { type RoutePath } from "@config/config_frontend";
import { createBanner } from "@ui/ui_template_banner";
import { createButton, showToast } from "@ui/ui_template_elements";
import { currentLanguageIndex, ui_locales } from "@ui/ui_template_locale";
@@ -29,6 +29,7 @@ import {
type FileSlotState,
type StoredUploadSession,
} from "./B03_FileInput_UI_Support";
import { currentProjectId } from "../A00_Common/b_project_switch";
function L(key: keyof typeof ui_locales): string {
return ui_locales[key][currentLanguageIndex];
@@ -70,7 +71,7 @@ function clearDerivedCaches(projectId: string): void {
export function createUploadFlow(ctx: UploadFlowContext): UploadFlowHandle {
async function detectPausedUploads(): Promise<void> {
ctx.setProjectId(localStorage.getItem(CURRENT_PROJECT_ID_KEY) ?? "");
ctx.setProjectId(currentProjectId());
ctx.resumeBanner.replaceChildren();
ctx.resumeBanner.classList.remove("is-visible");
if (!ctx.projectId()) return;
@@ -128,7 +129,7 @@ export function createUploadFlow(ctx: UploadFlowContext): UploadFlowHandle {
async function attachSelectedTempBatch(): Promise<void> {
const batch = ctx.tempPicker.selected();
if (!batch) return;
ctx.setProjectId(localStorage.getItem(CURRENT_PROJECT_ID_KEY) ?? "");
ctx.setProjectId(currentProjectId());
if (!ctx.projectId()) {
ctx.pageError.textContent = L("B03_File_Error_Project");
return;
@@ -193,7 +194,7 @@ export function createUploadFlow(ctx: UploadFlowContext): UploadFlowHandle {
}
return;
}
ctx.setProjectId(localStorage.getItem(CURRENT_PROJECT_ID_KEY) ?? "");
ctx.setProjectId(currentProjectId());
const validation = validateSlots(
ctx.slots,
ctx.selectedStates(),
+3 -2
View File
@@ -7,7 +7,7 @@
* 옛 결과가 지워지면 서버가 409 confirm 으로 묻고 → 확인 창 → confirm_replace 로 다시.
* ========================================================================== */
import { API_BASE_URL, CURRENT_PROJECT_ID_KEY } from "@config/config_frontend";
import { API_BASE_URL } from "@config/config_frontend";
import { createBanner } from "@ui/ui_template_banner";
import {
createButton,
@@ -20,6 +20,7 @@ import {
import { t } from "@ui/ui_template_locale";
import { createListRow } from "@ui/ui_template_list_row";
import { openModal } from "@ui/ui_template_modal";
import { currentProjectId } from "../A00_Common/b_project_switch";
interface AssignedRoute {
assignee_id: number;
@@ -100,7 +101,7 @@ export function mountPlanImport(
bannerHost: HTMLElement,
onImported: () => void,
): void {
const projectId = localStorage.getItem(CURRENT_PROJECT_ID_KEY) ?? "";
const projectId = currentProjectId();
if (!projectId) return;
const lasFree = (): boolean => localStorage.getItem(`b03_las_free_${projectId}`) === "1";
const banner = el("div", { className: "b03-file__plan-update" });