diff --git a/src/context/Chain.context.tsx b/src/context/Chain.context.tsx index 5861bc1..c89f9a6 100644 --- a/src/context/Chain.context.tsx +++ b/src/context/Chain.context.tsx @@ -28,10 +28,10 @@ const Context = createContext(defaultState); export function ChainProvider({ children, context, config }: PropsWithChildren) { const [connectors, setConnectors] = useState(defaultState); - const { addChain, displayLoading, displayTermsOfService } = useAppState(); + const { addChain, displayLoader, displayTermsOfService } = useAppState(); const init = useCallback(async () => { - displayLoading?.(); + displayLoader?.(); const metadataArr = Object.values(metadata); const connectorArr = await Promise.all(metadataArr.map((data) => WalletConnector.create(data, context, config))); @@ -40,9 +40,9 @@ export function ChainProvider({ children, context, config }: PropsWithChildren

{ - if (!displayLoading || !addChain || !setConnectors || !displayTermsOfService) return; + if (!displayLoader || !addChain || !setConnectors || !displayTermsOfService) return; - displayLoading(); + displayLoader(); init().then((connectors) => { setConnectors(connectors); @@ -53,7 +53,7 @@ export function ChainProvider({ children, context, config }: PropsWithChildren

{children}; } diff --git a/src/state/state.d.ts b/src/state/state.d.ts index 2eb61fc..85cba8a 100644 --- a/src/state/state.d.ts +++ b/src/state/state.d.ts @@ -6,7 +6,7 @@ type Screen = { }; type Screens = - | Screen<"LOADING"> + | Screen<"LOADER"> | Screen<"TERMS_OF_SERVICE"> | Screen<"CHAINS"> | Screen<"WALLETS"> @@ -22,7 +22,7 @@ export interface State { export interface Actions { open?: () => void; close?: () => void; - displayLoading?: () => void; + displayLoader?: () => void; displayChains?: () => void; displayWallets?: (chain: string) => void; displayInscriptions?: () => void; diff --git a/src/state/state.tsx b/src/state/state.tsx index d5c7f95..e0fa3a0 100644 --- a/src/state/state.tsx +++ b/src/state/state.tsx @@ -15,10 +15,6 @@ const StateContext = createContext(defaultState); export function StateProvider({ children }: PropsWithChildren) { const [state, setState] = useState(defaultState); - // useEffect(() => { - // console.log(state); - // }, [state]); - const actions: Actions = useMemo( () => ({ open: () => { @@ -29,8 +25,8 @@ export function StateProvider({ children }: PropsWithChildren) { setState((state) => ({ ...state, visible: false })); }, - displayLoading: () => { - setState((state) => ({ ...state, screen: { type: "LOADING" } })); + displayLoader: () => { + setState((state) => ({ ...state, screen: { type: "LOADER" } })); }, displayTermsOfService: () => { diff --git a/src/widgets/WalletProvider/components/WalletDialog.tsx b/src/widgets/WalletProvider/components/WalletDialog.tsx index 457f336..3158b82 100644 --- a/src/widgets/WalletProvider/components/WalletDialog.tsx +++ b/src/widgets/WalletProvider/components/WalletDialog.tsx @@ -9,13 +9,13 @@ import type { IChain, IWallet } from "@/core/types"; import { Screen } from "./Screen"; export function WalletDialog() { - const { visible, screen, close, selectWallet, displayLoading, displayChains, displayInscriptions } = useAppState(); + const { visible, screen, close, selectWallet, displayLoader, displayChains, displayInscriptions } = useAppState(); const { showAgain, toggleShowAgain, toggleLockInscriptions } = useInscriptionProvider(); const connectors = useChainProviders(); const handleSelectWallet = useCallback( async (chain: IChain, wallet: IWallet) => { - displayLoading?.(); + displayLoader?.(); const connector = connectors[chain.id]; const connectedWallet = await connector?.connect(wallet.id); @@ -30,7 +30,7 @@ export function WalletDialog() { displayChains?.(); } }, - [displayLoading, selectWallet, displayInscriptions, connectors, showAgain], + [displayLoader, selectWallet, displayInscriptions, connectors, showAgain], ); const handleToggleInscriptions = useCallback(