feat(admin): stabilize blog and admin patterns
TaxBaik CI/CD / build-and-deploy (push) Has been cancelled
TaxBaik CI/CD / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -21,51 +21,9 @@ window.taxbaikAdminSession = {
|
||||
},
|
||||
|
||||
showLoading: function () {
|
||||
if (document.documentElement.classList.contains('admin-login-route')) {
|
||||
window.taxbaikAdminSession.hideLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
const overlay = document.getElementById('blazor-loading');
|
||||
if (!overlay) return;
|
||||
|
||||
// Show overlay immediately
|
||||
overlay.classList.add('show');
|
||||
|
||||
// Check if page is already ready (cached state on fast nav)
|
||||
const pageReady =
|
||||
document.querySelector('.admin-page-hero') !== null ||
|
||||
document.querySelector('.admin-login-page') !== null;
|
||||
if (pageReady) {
|
||||
// Page already rendered, hide immediately
|
||||
window.taxbaikAdminSession.hideLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
// Start observer to catch future mutations
|
||||
if (window._taxbaikLoadingObserver) {
|
||||
window._taxbaikLoadingObserver.disconnect();
|
||||
}
|
||||
window._taxbaikLoadingObserver = new MutationObserver(function () {
|
||||
const pageReady =
|
||||
document.querySelector('.admin-page-hero') !== null ||
|
||||
document.querySelector('.admin-login-page') !== null;
|
||||
if (pageReady) {
|
||||
window.taxbaikAdminSession.hideLoading();
|
||||
}
|
||||
});
|
||||
window._taxbaikLoadingObserver.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
|
||||
// Safety fallback: hide after 3 seconds regardless.
|
||||
if (window._taxbaikLoadingTimeout) {
|
||||
clearTimeout(window._taxbaikLoadingTimeout);
|
||||
}
|
||||
window._taxbaikLoadingTimeout = setTimeout(function () {
|
||||
window.taxbaikAdminSession.hideLoading();
|
||||
}, 3000);
|
||||
// Route transitions are handled by Blazor; avoid full-screen overlays
|
||||
// that block drawer interaction and make the app feel frozen.
|
||||
window.taxbaikAdminSession.hideLoading();
|
||||
},
|
||||
|
||||
hideLoading: function () {
|
||||
@@ -93,9 +51,8 @@ window.taxbaikAdminSession = {
|
||||
window.taxbaikAdminSession.hideLoading();
|
||||
}
|
||||
|
||||
// Show loading on initial page load — overlay has 'show' from HTML,
|
||||
// but we still need to set up the observer to detect when to hide it.
|
||||
window.taxbaikAdminSession.showLoading();
|
||||
// Keep the initial overlay hidden unless explicitly enabled elsewhere.
|
||||
window.taxbaikAdminSession.hideLoading();
|
||||
|
||||
const modal = document.getElementById('components-reconnect-modal');
|
||||
if (!modal) return;
|
||||
|
||||
Reference in New Issue
Block a user