1a761e8e15
TaxBaik CI/CD / build-and-deploy (push) Successful in 48s
**Issue**: White screen appears 1-2 seconds during page load/transitions while Blazor circuit connects **Solution**: Add loading spinner overlay that displays while Blazor initializes **Changes**: 1. App.razor: Add loading overlay HTML element 2. admin.css: Add loading spinner styles + animations 3. admin-session.js: Show overlay on load, hide when Blazor circuit ready **UX Flow**: - Page load starts → Blazor loading spinner appears - Blazor circuit connects (~1-2s) → Spinner disappears - Page fully interactive → User sees content **Styling**: - Centered spinner with 'Loading...' text - Semi-transparent background (blur effect) - Smooth fade-out when complete - High z-index (9999) to cover all content This provides clear visual feedback that the app is working, not frozen. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
window.taxbaikAdminSession = {
|
|
syncRouteClass: function () {
|
|
document.documentElement.classList.toggle(
|
|
'admin-login-route',
|
|
window.location.pathname.toLowerCase().endsWith('/admin/login'));
|
|
},
|
|
clearAuthToken: function () {
|
|
try {
|
|
localStorage.removeItem('auth_token');
|
|
} catch {
|
|
// Ignore storage errors; redirect still recovers the session.
|
|
}
|
|
},
|
|
watchReconnect: function () {
|
|
window.taxbaikAdminSession.syncRouteClass();
|
|
window.addEventListener('popstate', window.taxbaikAdminSession.syncRouteClass);
|
|
|
|
// Show loading indicator on page load (hide when Blazor circuit connects)
|
|
const loadingOverlay = document.getElementById('blazor-loading');
|
|
if (loadingOverlay) {
|
|
loadingOverlay.classList.add('show');
|
|
// Hide loading when Blazor is ready
|
|
Blazor.start().then(() => {
|
|
if (loadingOverlay) {
|
|
loadingOverlay.classList.remove('show');
|
|
}
|
|
});
|
|
}
|
|
|
|
const modal = document.getElementById('components-reconnect-modal');
|
|
if (!modal) {
|
|
return;
|
|
}
|
|
|
|
const reloadOnRejectedCircuit = () => {
|
|
const className = modal.className || '';
|
|
if (className.includes('components-reconnect-failed') ||
|
|
className.includes('components-reconnect-rejected')) {
|
|
window.setTimeout(() => window.location.reload(), 1500);
|
|
}
|
|
};
|
|
|
|
new MutationObserver(reloadOnRejectedCircuit)
|
|
.observe(modal, { attributes: true, attributeFilter: ['class'] });
|
|
}
|
|
};
|