fix(admin): simplify shared blazor shell
TaxBaik CI/CD / build-and-deploy (push) Successful in 4m0s

This commit is contained in:
2026-07-05 18:50:31 +09:00
parent 41b723e908
commit 8799fe250b
7 changed files with 11 additions and 142 deletions
@@ -35,131 +35,19 @@
<p>로드 중...</p>
</div>
</div>
<script>
// 로그인 화면은 prerender로 즉시 표시되므로 스피너가 필요 없다.
// 그 외 인증 화면은 WASM 부팅이 끝날 때까지(AdminShell.OnAfterRenderAsync에서 hideLoading 호출)
// 스피너를 "업데이트 스플래시"로 보여준다.
if (!document.documentElement.classList.contains('admin-login-route')) {
var loadingOverlay = document.getElementById('blazor-loading');
if (loadingOverlay) loadingOverlay.classList.add('show');
window.setTimeout(function () {
if (window.taxbaikAdminSession && typeof window.taxbaikAdminSession.hideLoading === 'function') {
window.taxbaikAdminSession.hideLoading();
}
}, 8000);
}
</script>
<MudThemeProvider @bind-IsDarkMode="isDarkMode" Theme="mudTheme" />
<Routes />
<Routes @rendermode="InteractiveWebAssembly" />
<script src="/taxbaik/_content/MudBlazor/MudBlazor.min.js"></script>
<script src="/taxbaik/js/admin-session.js"></script>
<script src="/taxbaik/admin/_framework/blazor.webassembly.js"></script>
<script>
// admin-session.js 로드 완료 대기 후 초기화
function initSession() {
if (window.taxbaikAdminSession) {
if (typeof window.taxbaikAdminSession.initErrorLogging === 'function') {
window.taxbaikAdminSession.initErrorLogging();
}
if (typeof window.taxbaikAdminSession.bindLoginForm === 'function') {
if (document.documentElement.classList.contains('admin-login-route') &&
window.taxbaikAdminSession &&
typeof window.taxbaikAdminSession.bindLoginForm === 'function') {
window.taxbaikAdminSession.bindLoginForm();
}
if (typeof window.taxbaikAdminSession.watchReconnect === 'function') {
window.taxbaikAdminSession.watchReconnect();
}
} else {
// admin-session.js가 아직 로드되지 않았으면 재시도
setTimeout(initSession, 50);
}
}
initSession();
</script>
</body>
</html>
@code {
private bool isDarkMode = false;
private MudTheme mudTheme = new()
{
Palette = new PaletteLight()
{
Primary = "#1976D2",
PrimaryContrastText = "#FFFFFF",
Secondary = "#2D9F7E",
SecondaryContrastText = "#FFFFFF",
Tertiary = "#FF8A50",
TertiaryContrastText = "#FFFFFF",
Surface = "#F5F7FA",
Background = "#FFFFFF",
BackgroundGrey = "#F8F9FB",
DrawerBackground = "#FFFFFF",
DrawerText = "#424242",
AppbarBackground = "#FFFFFF",
AppbarText = "#424242",
TextPrimary = "#1A1A1A",
TextSecondary = "#64748B",
TextDisabled = "#94A3B8",
ActionDefault = "#1976D2",
ActionDisabled = "#BDBDBD",
Divider = "#E2E8F0",
DividerLight = "#F1F5F9",
Error = "#DC2626",
ErrorContrastText = "#FFFFFF",
Warning = "#F59E0B",
WarningContrastText = "#FFFFFF",
Info = "#06B6D4",
InfoContrastText = "#FFFFFF",
Success = "#16A34A",
SuccessContrastText = "#FFFFFF",
},
LayoutProperties = new LayoutProperties()
{
DefaultBorderRadius = "6px"
},
Typography = new Typography()
{
Default = new Default()
{
FontSize = ".8125rem",
FontWeight = 400,
LineHeight = 1.5
},
H1 = new H1()
{
FontSize = "1.75rem",
FontWeight = 600,
LineHeight = 1.2
},
H2 = new H2()
{
FontSize = "1.5rem",
FontWeight = 600,
LineHeight = 1.3
},
H3 = new H3()
{
FontSize = "1.25rem",
FontWeight = 600,
LineHeight = 1.3
},
H4 = new H4()
{
FontSize = "1.1rem",
FontWeight = 600,
LineHeight = 1.4
},
H5 = new H5()
{
FontSize = "0.95rem",
FontWeight = 500,
LineHeight = 1.4
},
H6 = new H6()
{
FontSize = "0.85rem",
FontWeight = 500,
LineHeight = 1.5
}
}
};
}
@@ -39,7 +39,7 @@
Dense="true"
Hover="true"
Striped="true"
Virtualize="true"
RowsPerPage="30"
Class="admin-grid">
<Columns>
@@ -51,7 +51,7 @@ else
Dense="true"
Hover="true"
Striped="true"
Virtualize="true"
RowsPerPage="30"
SelectedItem="@selectedContract"
SelectedItemChanged="OnRowSelected"
@@ -39,7 +39,7 @@
Dense="true"
Hover="true"
Striped="true"
Virtualize="true"
RowsPerPage="30"
Class="admin-grid">
<Columns>
@@ -45,7 +45,7 @@ else
Dense="true"
Hover="true"
Striped="true"
Virtualize="true"
RowsPerPage="30"
SelectedItem="@selectedSchedule"
SelectedItemChanged="OnRowSelected"
@@ -41,7 +41,7 @@ else
Dense="true"
Hover="true"
Striped="true"
Virtualize="true"
RowsPerPage="30"
SelectedItem="@selectedProfile"
SelectedItemChanged="OnRowSelected"
@@ -1,11 +1,6 @@
@inject NavigationManager Navigation
@inject IJSRuntime JS
@implements IDisposable
<MudPopoverProvider />
<MudDialogProvider />
<MudSnackbarProvider />
<MudLayout Class="admin-shell">
<MudAppBar Elevation="0" Class="admin-topbar">
<MudIconButton Icon="@Icons.Material.Filled.Menu"
@@ -43,7 +38,7 @@
</div>
</MudAppBar>
<MudDrawer @bind-open="@drawerOpen"
<MudDrawer Open="@drawerOpen"
Elevation="0"
Variant="DrawerVariant.Responsive"
Breakpoint="Breakpoint.Md"
@@ -106,27 +101,13 @@
Navigation.LocationChanged += OnLocationChanged;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await JS.InvokeVoidAsync("taxbaikAdminSession.setContext", "admin/shell", "navigation", "layout", "shell", "shell", "", "main");
await JS.InvokeVoidAsync("taxbaikAdminSession.hideLoading");
}
}
private void OnLocationChanged(object? sender, LocationChangedEventArgs args)
{
var route = new Uri(args.Location).AbsolutePath;
_ = JS.InvokeVoidAsync("taxbaikAdminSession.setContext", route, "navigation", "route-change", "layout", "shell", "", route);
_ = InvokeAsync(() => JS.InvokeVoidAsync("taxbaikAdminSession.hideLoading"));
}
private void ToggleDrawer()
{
drawerOpen = !drawerOpen;
_ = JS.InvokeVoidAsync("taxbaikAdminSession.setContext", "admin/shell", "navigation", "drawer", drawerOpen ? "opened" : "closed", "shell", "", "drawer");
_ = JS.InvokeVoidAsync("taxbaikAdminSession.traceUiState", "admin-shell", drawerOpen ? "drawer opened" : "drawer closed");
}
private void NavigateTo(string url)