fix: remove message from loading UI

This commit is contained in:
Anish Sarkar 2026-01-27 15:28:30 +05:30
parent 2434e64093
commit ba304be977
13 changed files with 34 additions and 110 deletions

View file

@ -2,29 +2,18 @@ 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 });
}
);
export const showGlobalLoadingAtom = atom(null, (get, set) => {
set(globalLoadingAtom, { isLoading: true });
});
// Helper atom for hiding global loading
export const hideGlobalLoadingAtom = atom(null, (get, set) => {
set(globalLoadingAtom, { isLoading: false, message: undefined, variant: "default" });
set(globalLoadingAtom, { isLoading: false });
});