mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user