-
Notifications
You must be signed in to change notification settings - Fork 262
Feat: blocked user #2490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feat: blocked user #2490
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| import { WALLET_CONNECTOR_TYPE } from "@web3auth/no-modal"; | ||
| import { log, WALLET_CONNECTOR_TYPE } from "@web3auth/no-modal"; | ||
| import { useEffect, useMemo, useState } from "react"; | ||
| import { useTranslation } from "react-i18next"; | ||
|
|
||
| import { MODAL_STATUS } from "../../interfaces"; | ||
| import i18n from "../../localeImport"; | ||
| import Image from "../Image"; | ||
| import SpinnerLoader from "../SpinnerLoader"; | ||
| import { AuthorizingStatusType, ConnectedStatusType, ConnectingStatusType, ErroredStatusType, LoaderProps } from "./Loader.type"; | ||
| import { AuthorizingStatusType, BlockedStatusType, ConnectedStatusType, ConnectingStatusType, ErroredStatusType, LoaderProps } from "./Loader.type"; | ||
|
|
||
| /** | ||
| * ConnectingStatus component | ||
|
|
@@ -83,6 +83,37 @@ function ErroredStatus(props: ErroredStatusType) { | |
| ); | ||
| } | ||
|
|
||
| function BlockedStatus(props: BlockedStatusType) { | ||
| const { primaryMessage, secondaryMessage, buttonMessage } = props; | ||
|
|
||
| const handleChangeWallet = () => { | ||
| // TODO: wire up real action in a follow-up commit | ||
| log.info("change wallet"); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="w3a--flex w3a--flex-col w3a--items-center w3a--gap-y-4"> | ||
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20" className="w3a--error-logo"> | ||
| <path | ||
| fill="currentColor" | ||
| fillRule="evenodd" | ||
| d="M18 10a8 8 0 1 1-16.001 0A8 8 0 0 1 18 10m-7 4a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-1-9a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0V6a1 1 0 0 0-1-1" | ||
| clipRule="evenodd" | ||
| /> | ||
| </svg> | ||
| <p className="w3a--text-center w3a--text-base w3a--font-semibold w3a--text-app-gray-900 dark:w3a--text-app-white">{primaryMessage}</p> | ||
| <p className="w3a--text-center w3a--text-sm w3a--text-app-gray-500 dark:w3a--text-app-gray-400">{secondaryMessage}</p> | ||
| <button | ||
| type="button" | ||
| onClick={handleChangeWallet} | ||
| className="w3a--rounded-xl w3a--bg-app-primary-600 w3a--px-6 w3a--py-3 w3a--text-center w3a--text-sm w3a--font-medium w3a--text-app-white hover:w3a--bg-app-primary-700" | ||
| > | ||
| {buttonMessage} | ||
| </button> | ||
| </div> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong CSS class prefix breaks BlockedStatus stylingHigh Severity The Reviewed by Cursor Bugbot for commit 2583007. Configure here. |
||
| ); | ||
| } | ||
|
|
||
| function AuthorizingStatus(props: AuthorizingStatusType) { | ||
| const [t] = useTranslation(undefined, { i18n }); | ||
| const { connector, externalWalletsConfig, handleMobileVerifyConnect } = props; | ||
|
|
@@ -213,6 +244,7 @@ function Loader(props: LoaderProps) { | |
| externalWalletsConfig, | ||
| handleMobileVerifyConnect, | ||
| hideSuccessScreen = false, | ||
| blockedUserConfig, | ||
| onAcceptConsent, | ||
| onDeclineConsent, | ||
| privacyPolicy, | ||
|
|
@@ -255,6 +287,14 @@ function Loader(props: LoaderProps) { | |
|
|
||
| {modalStatus === MODAL_STATUS.ERRORED && <ErroredStatus message={message} />} | ||
|
|
||
| {modalStatus === MODAL_STATUS.BLOCKED && blockedUserConfig && ( | ||
| <BlockedStatus | ||
| primaryMessage={blockedUserConfig.primaryMessage} | ||
| secondaryMessage={blockedUserConfig.secondaryMessage} | ||
| buttonMessage={blockedUserConfig.buttonMessage} | ||
| /> | ||
| )} | ||
|
|
||
| {modalStatus === MODAL_STATUS.AUTHORIZING && ( | ||
| <AuthorizingStatus | ||
| connector={connector} | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocked user button has no functional action
High Severity
The
handleChangeWalletcallback inBlockedStatusonly callslog.info("change wallet")and performs no actual action. This button is rendered prominently to blocked users (with default text "Change wallet") but clicking it does nothing. Combined with the fact thatonCloseLoaderforBLOCKEDstatus hides the modal without resetting status toINITIALIZED, the user is left in a dead-end state with no functional escape path other than a full page reload.Reviewed by Cursor Bugbot for commit e27d7d9. Configure here.