From 308c20fd9cfc9364a50662f653102b49cc9d5167 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Tue, 29 Sep 2026 20:45:32 +0900 Subject: [PATCH] =?UTF-8?q?refactor(B05):=20[=EC=B4=88=EA=B8=B0=ED=99=94]?= =?UTF-8?q?=20=EB=B3=B8=EB=AC=B8=EC=9D=84=20design=5Freset=20=ED=95=9C=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EB=A1=9C(sub4=20=ED=8C=90=20=EC=9C=84?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=C2=B7=2024-2b)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - resetDesignAction 은 design_reset.resetDesign 을 부름 · B06 [초기화]와 같은 함수 Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01EauA2ATmqNRbeV48s9CcBr --- B05_Profile/B05_Profile_UI_Page_Actions.ts | 50 ++++------------------ 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/B05_Profile/B05_Profile_UI_Page_Actions.ts b/B05_Profile/B05_Profile_UI_Page_Actions.ts index a08bab99..4e4982eb 100644 --- a/B05_Profile/B05_Profile_UI_Page_Actions.ts +++ b/B05_Profile/B05_Profile_UI_Page_Actions.ts @@ -7,31 +7,17 @@ * 세션에 쌓인 조작은 [저장]·[확정]에서만 정본으로 나간다). * ========================================================================== */ -import { ROUTES } from "@config/config_frontend"; import { currentLanguageIndex, ui_locales } from "@ui/ui_template_locale"; -import { - hideLoadingOverlay, - showConfirmDialog, - showLoadingOverlay, - showToast, -} from "@ui/ui_template_elements"; -import { navigateTo } from "../A00_Common/router"; -import { - clearRouteLatestCache, - confirmRoute, - resetRouteDesign, - solveRoute, - type RouteLatestResponse, -} from "./B05_Profile_Api_Fetch"; +import { hideLoadingOverlay, showLoadingOverlay, showToast } from "@ui/ui_template_elements"; +import { resetDesign } from "../A00_Common/design/design_reset"; +import { confirmRoute, solveRoute, type RouteLatestResponse } from "./B05_Profile_Api_Fetch"; import { saveDesign } from "../A00_Common/design/design_save"; import { invalidateSectionDetail, saveCachedCrossPatches, } from "../B06_Section/B06_Section_Section_Store"; -import { clearDrafts } from "../A00_Common/b_page_state"; import { saveCorridorIfDirty } from "./B05_Profile_UI_Corridor"; import { circlePoint, routePoint } from "./B05_Profile_UI_Page_Helpers"; -import { clearAlignmentDrafts } from "./B05_Profile_UI_Profile_Edit"; import type { createRoutePanel } from "./B05_Profile_UI_Panel"; import type { createRouteProfilePanel } from "./B05_Profile_UI_Profile_Panel"; import type { createStructuresBridge } from "./B05_Profile_UI_Page_Structures"; @@ -189,30 +175,10 @@ export async function tempSaveAction(ctx: PageActionContext): Promise { }); } -/** [초기화] — 사용자 편집 전부 폐기, 계획노선 CSV 기본값으로 B05·B06 재계산 후 재진입. - * 네이티브 confirm은 공용 헤드 브라우저가 자동 취소해 버튼이 죽은 듯 보였다 - * (2026-08-19 진단) — 화면 안 모달로 확인받는다. */ +/** [초기화] — 두 보기가 같은 함수를 부른다(`design_reset` · 계획서 24-2b). 페이지만 아는 + * 상단측 변경분만 여기서 비운다. */ export async function resetDesignAction(ctx: PageActionContext): Promise { - if (!(await showConfirmDialog(L("B05_Route_Reset_Confirm"), "초기화"))) return; - showLoadingOverlay(); - try { - await resetRouteDesign(ctx.projectId); - // 옛 경로 기준 캐시를 전부 비우고 페이지를 새로 그린다 — 초기 계산본이 정본이 된다. - clearRouteLatestCache(ctx.projectId); - invalidateSectionDetail(ctx.projectId); - // 사용자 조작(② 초안)은 **등록표 한 곳**에서 통째로 버린다(2026-09-06 일원화). - // 예전에는 파일마다 따로 지워 새 값이 늘 때 빠뜨리기 쉬웠다. 노선 범위 초안은 - // 노선이 바뀌면 키가 달라져 자연히 딸려 오지 않는다. - clearDrafts(ctx.projectId, ctx.latest()?.route?.id ?? null); - ctx.uphillOverrides.clear(); - // 계획선 편집 초안도 함께 버린다 — 남기면 초기값 위에 옛 편집이 다시 얹혀 계획선이 - // 측점에서 원지반선과 만나지 않는다(2026-09-04 실측: 새로고침 후 최대 6.0m 어긋남). - clearAlignmentDrafts(); - showToast(L("B05_Route_Reset_Success"), "success"); - navigateTo(ROUTES.B05_PROFILE); - } catch (error) { - showToast(error instanceof Error ? error.message : L("B05_Route_Reset_Failed"), "error"); - } finally { - hideLoadingOverlay(); - } + await resetDesign(ctx.projectId, ctx.latest()?.route?.id ?? null, () => + ctx.uphillOverrides.clear(), + ); }