Add loading indicator for admin asset initialization

Introduced a "loading" div to indicate when admin assets are being fetched. Updated rendering logic and styles in related components to account for this state. Prepared groundwork for potential view transitions.
This commit is contained in:
dswbx
2025-01-10 18:04:40 +01:00
parent bb756548a6
commit c7d983942f
5 changed files with 71 additions and 21 deletions

View File

@@ -64,18 +64,36 @@ export function useNavigate() {
(
url: string,
options?:
| { query?: object; absolute?: boolean; replace?: boolean; state?: any }
| {
query?: object;
absolute?: boolean;
replace?: boolean;
state?: any;
transition?: boolean;
}
| { reload: true }
) => {
if (options && "reload" in options) {
window.location.href = url;
return;
}
const wrap = (fn: () => void) => {
fn();
// prepared for view transition
/*if (options && "transition" in options && options.transition === false) {
fn();
} else {
document.startViewTransition(fn);
}*/
};
const _url = options?.absolute ? `~/${basepath}${url}`.replace(/\/+/g, "/") : url;
navigate(options?.query ? withQuery(_url, options?.query) : _url, {
replace: options?.replace,
state: options?.state
wrap(() => {
if (options && "reload" in options) {
window.location.href = url;
return;
}
const _url = options?.absolute ? `~/${basepath}${url}`.replace(/\/+/g, "/") : url;
navigate(options?.query ? withQuery(_url, options?.query) : _url, {
replace: options?.replace,
state: options?.state
});
});
},
location