Skip to content

Commit

Permalink
fix: modal states
Browse files Browse the repository at this point in the history
  • Loading branch information
simodrws committed Oct 26, 2023
1 parent fc298f3 commit 309b582
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/ui/components/modals/authenticate/authenticate.tsx
Expand Up @@ -26,7 +26,6 @@ export const Authenticate = ({
disconnect,
openConnectModal,
isLoadingSigner,
hasAddress,
} = useWallet();

const [copied, setCopied] = useState(false);
Expand All @@ -51,6 +50,7 @@ export const Authenticate = ({
needsWalletConnection,
showAuthenticateView,
showSwitchWalletButton,
showConnectedView,
} = useAuthenticateModal({
onAuthenticateError,
onAuthenticateSuccess,
Expand All @@ -62,7 +62,7 @@ export const Authenticate = ({
}

let timeout: NodeJS.Timeout;
if (modal.visible && !isAuthenticating && hasAddress) {
if (modal.visible && !isAuthenticating && showConnectedView) {
timeout = setTimeout(() => {
modal.remove();
// onClose?.();
Expand All @@ -75,7 +75,7 @@ export const Authenticate = ({
}, [
needsWalletConnection,
modal,
hasAddress,
showConnectedView,
isAuthenticating,
openConnectModal,
]);
Expand Down
Expand Up @@ -29,6 +29,11 @@ export const useAuthenticateModal = ({
[isConnected, hasSession, signer, hasAddress, isLoadingSession]
);

const showConnectedView = useMemo(
() => hasSession && hasAddress,
[hasSession, hasAddress]
);

const successMessage = useMemo(() => {
switch (company) {
case 'Masa': {
Expand Down Expand Up @@ -80,7 +85,7 @@ export const useAuthenticateModal = ({
needsWalletConnection,
showAuthenticateView,
successMessage,

showConnectedView,
isAuthenticating,
onAuthenticateStart,
showSwitchWalletButton,
Expand Down

0 comments on commit 309b582

Please sign in to comment.