diff --git a/packages/modal/src/ui/components/BottomSheet/BottomSheet.tsx b/packages/modal/src/ui/components/BottomSheet/BottomSheet.tsx index ab37aa60a..a5010c528 100644 --- a/packages/modal/src/ui/components/BottomSheet/BottomSheet.tsx +++ b/packages/modal/src/ui/components/BottomSheet/BottomSheet.tsx @@ -6,6 +6,11 @@ import { BottomSheetProps } from "./BottomSheet.type"; */ function BottomSheet({ isShown, onClose, children, uiConfig, sheetClassName, showCloseButton = true }: BottomSheetProps) { const { borderRadiusType = "large" } = uiConfig; + + const handleClose = (e: React.MouseEvent) => { + e.stopPropagation(); + if (onClose) onClose(); + }; return ( <> {/* Backdrop */} @@ -15,14 +20,14 @@ function BottomSheet({ isShown, onClose, children, uiConfig, sheetClassName, sho "w3a--rounded-2xl": borderRadiusType === "medium", "w3a--rounded-none": borderRadiusType === "small", })} - onClick={onClose} + onClick={handleClose} aria-hidden="true" role="button" /> {/* Bottom Sheet */}
{ + const hideBackButton = useMemo(() => { // If wallet is selected, show the back button if (selectedWallet) return false; // Otherwise, if external wallet mode only, login screen is skipped so back button is not needed @@ -257,7 +258,13 @@ function ConnectWallet(props: ConnectWalletProps) { return (
{/* Header */} - + {/* Body */} {selectedWallet ? ( ) : (
diff --git a/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.type.ts b/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.type.ts index 108d72215..a3a284abc 100644 --- a/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.type.ts +++ b/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.type.ts @@ -18,4 +18,5 @@ export interface ConnectWalletProps { onBackClick?: (flag: boolean) => void; handleExternalWalletClick: (params: { connector: string; chainNamespace?: ChainNamespaceType }) => void; handleWalletDetailsHeight: () => void; + disableBackButton?: boolean; } diff --git a/packages/modal/src/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.tsx b/packages/modal/src/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.tsx index 2a86afd80..1901a0610 100644 --- a/packages/modal/src/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.tsx +++ b/packages/modal/src/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.tsx @@ -5,28 +5,29 @@ import i18n from "../../../localeImport"; import { ConnectWalletHeaderProps } from "./ConnectWalletHeader.type"; function ConnectWalletHeader(props: ConnectWalletHeaderProps) { - const { disableBackButton, onBackClick, currentPage, selectedButton } = props; + const { hideBackButton, disableBackButton, onBackClick, currentPage, selectedButton } = props; const [t] = useTranslation(undefined, { i18n }); const handleBack = () => { - if (onBackClick) { + if (onBackClick && !disableBackButton) { onBackClick(); } }; return (
- {!disableBackButton ? ( + {!hideBackButton ? (
)} -
-

- {t("modal.external.dont-have")} {selectedButton?.displayName}? -

- -
+

+ {t("modal.external.dont-have")} {selectedButton?.displayName}? +

+ +
+ )}
); } diff --git a/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.type.ts b/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.type.ts index 0e2c28fbb..0f0622558 100644 --- a/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.type.ts +++ b/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.type.ts @@ -1,4 +1,4 @@ -import { type ExternalButton } from "../../../interfaces"; +import { type ExternalButton, platform } from "../../../interfaces"; export interface ConnectWalletQrCodeProps { qrCodeValue: string; @@ -6,4 +6,5 @@ export interface ConnectWalletQrCodeProps { selectedButton: ExternalButton; logoImage?: string; primaryColor?: string; + platform: platform; } diff --git a/packages/modal/src/ui/components/Root/Root.tsx b/packages/modal/src/ui/components/Root/Root.tsx index 17b6bde87..c134e381f 100644 --- a/packages/modal/src/ui/components/Root/Root.tsx +++ b/packages/modal/src/ui/components/Root/Root.tsx @@ -469,6 +469,7 @@ function Root(props: RootProps) { selectedButton={bodyState.metamaskQrCode.wallet} primaryColor={bodyState.metamaskQrCode.wallet.walletRegistryItem?.primaryColor} logoImage={`https://images.web3auth.io/login-${bodyState.metamaskQrCode.wallet.name}.${bodyState.metamaskQrCode.wallet.imgExtension}`} + platform={deviceDetails.platform} />
) : ( @@ -522,6 +523,7 @@ function Root(props: RootProps) { isExternalWalletModeOnly={isExternalWalletModeOnly} onBackClick={onBackClick} handleExternalWalletClick={preHandleExternalWalletClick} + disableBackButton={bodyState.installLinks?.show || bodyState.multiChainSelector?.show} /> )}