mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-02 04:12:47 +02:00
feat: replace unified loading approach with global loading provider and refactor loading handling across components
- Introduced GlobalLoadingProvider to manage a consistent loading overlay across the application. - Replaced existing loading implementations with useGlobalLoadingEffect hook for better control and to prevent animation resets. - Updated components such as LoginPage, AuthCallbackPage, and DashboardLayout to utilize the new global loading mechanism. - Removed UnifiedLoadingScreen component to streamline loading management and enhance user experience.
This commit is contained in:
parent
2d17d1a1b6
commit
66a3c877ef
15 changed files with 294 additions and 140 deletions
31
surfsense_web/atoms/ui/loading.atoms.ts
Normal file
31
surfsense_web/atoms/ui/loading.atoms.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { atom } from "jotai";
|
||||
|
||||
interface GlobalLoadingState {
|
||||
isLoading: boolean;
|
||||
message?: string;
|
||||
variant: "login" | "default";
|
||||
}
|
||||
|
||||
export const globalLoadingAtom = atom<GlobalLoadingState>({
|
||||
isLoading: false,
|
||||
message: undefined,
|
||||
variant: "default",
|
||||
});
|
||||
|
||||
// Helper atom for showing global loading
|
||||
export const showGlobalLoadingAtom = atom(
|
||||
null,
|
||||
(
|
||||
get,
|
||||
set,
|
||||
{ message, variant = "default" }: { message?: string; variant?: "login" | "default" }
|
||||
) => {
|
||||
set(globalLoadingAtom, { isLoading: true, message, variant });
|
||||
}
|
||||
);
|
||||
|
||||
// Helper atom for hiding global loading
|
||||
export const hideGlobalLoadingAtom = atom(null, (get, set) => {
|
||||
set(globalLoadingAtom, { isLoading: false, message: undefined, variant: "default" });
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue