Merge pull request 'fix(layout): 부서관리 탭 라벨 hardcoded 한글 fallback 추가' (#6) from johngreen into main
Build & Deploy to K8s / build-and-deploy (push) Successful in 8m28s
Build & Deploy to K8s / build-and-deploy (push) Successful in 8m28s
This commit was merged in pull request #6.
This commit is contained in:
@@ -409,7 +409,12 @@ function AppLayoutInner({ children }: AppLayoutProps) {
|
||||
|
||||
if (pathname.startsWith("/admin") && pathname !== "/admin") {
|
||||
store.setMode("admin");
|
||||
store.openTab({ type: "admin", title: pathname.split("/").pop() || "관리자", admin_url: pathname });
|
||||
// menu API 가 실패하는 환경 (SUPER_ADMIN cross-tenant 등) 에서도 한글 라벨 유지
|
||||
const ADMIN_PATH_LABELS: Record<string, string> = {
|
||||
"/admin/userMng/deptMngList": "부서관리",
|
||||
};
|
||||
const fallbackTitle = ADMIN_PATH_LABELS[pathname] || pathname.split("/").pop() || "관리자";
|
||||
store.openTab({ type: "admin", title: fallbackTitle, admin_url: pathname });
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -903,15 +908,18 @@ function AppLayoutInner({ children }: AppLayoutProps) {
|
||||
}, [activeTab, uiMenus, isMenuActive]);
|
||||
|
||||
// URL 직접 진입 / sessionStorage 복원 시 admin 탭의 영어 path-segment title 을
|
||||
// menu_name_kor (uiMenus 의 tabTitle/label/name) 로 한 번만 갱신.
|
||||
// menu_name_kor (uiMenus 의 tabTitle/label/name) 로 갱신.
|
||||
// menu API 가 실패한 환경 (SUPER_ADMIN cross-tenant) 에서도 동작하도록 hardcoded map 도 같이 검사.
|
||||
useEffect(() => {
|
||||
if (uiMenus.length === 0) return;
|
||||
const ADMIN_PATH_LABELS: Record<string, string> = {
|
||||
"/admin/userMng/deptMngList": "부서관리",
|
||||
};
|
||||
const store = useTabStore.getState();
|
||||
for (const tab of store.admin.tabs) {
|
||||
if (tab.type !== "admin" || !tab.admin_url) continue;
|
||||
const matched = uiMenus.find((m: any) => m.url === tab.admin_url);
|
||||
const koreanTitle: string | undefined =
|
||||
matched?.tabTitle || matched?.label || matched?.name;
|
||||
matched?.tabTitle || matched?.label || matched?.name || ADMIN_PATH_LABELS[tab.admin_url];
|
||||
if (koreanTitle && tab.title !== koreanTitle) {
|
||||
store.updateTabTitle(tab.id, koreanTitle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user