From 69bf914fd83b803e930a418b29b01736549fa492 Mon Sep 17 00:00:00 2001 From: Karolina Kosiorowska Date: Thu, 14 Nov 2024 08:12:08 +0100 Subject: [PATCH 1/8] Fix grammatical error in text --- dapp/src/utils/forms.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dapp/src/utils/forms.ts b/dapp/src/utils/forms.ts index 71c903140..b66523703 100644 --- a/dapp/src/utils/forms.ts +++ b/dapp/src/utils/forms.ts @@ -52,7 +52,7 @@ export function validateTokenAmount( if (isMaximumValueExceeded) return ERRORS_BY_ACTION_TYPE.EXCEEDED_VALUE if (!isMinimumValueFulfilled) return ERRORS_BY_ACTION_TYPE.INSUFFICIENT_VALUE( - actionType === ACTION_FLOW_TYPES.STAKE ? "deposit" : "withdraw", + actionType === ACTION_FLOW_TYPES.STAKE ? "deposit" : "withdrawal", fixedPointNumberToString(minValue, decimals), ) From 402bcc46d2efb82e633c851633bca62ea3526112 Mon Sep 17 00:00:00 2001 From: Karolina Kosiorowska Date: Thu, 14 Nov 2024 10:03:20 +0100 Subject: [PATCH 2/8] Remove the unneeded component `ActivitiesList` --- .../shared/ActivitiesList/ActivitiesList.tsx | 59 ------------- .../ActivitiesList/ActivitiesListItem.tsx | 85 ------------------- .../components/shared/ActivitiesList/index.ts | 1 - .../src/pages/DashboardPage/DashboardCard.tsx | 2 - 4 files changed, 147 deletions(-) delete mode 100644 dapp/src/components/shared/ActivitiesList/ActivitiesList.tsx delete mode 100644 dapp/src/components/shared/ActivitiesList/ActivitiesListItem.tsx delete mode 100644 dapp/src/components/shared/ActivitiesList/index.ts diff --git a/dapp/src/components/shared/ActivitiesList/ActivitiesList.tsx b/dapp/src/components/shared/ActivitiesList/ActivitiesList.tsx deleted file mode 100644 index aae2c762b..000000000 --- a/dapp/src/components/shared/ActivitiesList/ActivitiesList.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import React from "react" -import { List, ListItem, ListProps } from "@chakra-ui/react" -import { AnimatePresence, Variants, motion } from "framer-motion" -import { - useAppDispatch, - useLatestCompletedActivities, - useIsFetchedWalletData, -} from "#/hooks" -import { deleteLatestActivity } from "#/store/wallet" -import ActivitiesListItem from "./ActivitiesListItem" - -const MotionList = motion(List) -const MotionListItem = motion(ListItem) - -const listItemVariants: Variants = { - mounted: { opacity: 1, x: 0 }, - dismissed: { opacity: 0, x: -48 }, -} - -function ActivitiesList(props: ListProps) { - const dispatch = useAppDispatch() - const activities = useLatestCompletedActivities() - const isFetchedWalletData = useIsFetchedWalletData() - - const handleItemDismiss = (activityId: string) => { - dispatch(deleteLatestActivity(activityId)) - } - - if (!isFetchedWalletData || activities.length === 0) return null - - return ( - - - {activities.map(({ id, amount, status, type, txHash }) => ( - - handleItemDismiss(id)} - /> - - ))} - - - ) -} - -export default ActivitiesList diff --git a/dapp/src/components/shared/ActivitiesList/ActivitiesListItem.tsx b/dapp/src/components/shared/ActivitiesList/ActivitiesListItem.tsx deleted file mode 100644 index 84e498e5a..000000000 --- a/dapp/src/components/shared/ActivitiesList/ActivitiesListItem.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import React from "react" -import { ArrowUpRight, LoadingSpinnerSuccessIcon } from "#/assets/icons" -import { Activity as ActivityType } from "#/types" -import { convertActivityTypeToLabel } from "#/utils" -import { Button, HStack, VStack, VisuallyHidden } from "@chakra-ui/react" -import { CurrencyBalance } from "../CurrencyBalance" -import BlockExplorerLink from "../BlockExplorerLink" -import { - Alert, - AlertDescription, - AlertIcon, - AlertProps, - AlertTitle, -} from "../Alert" -import { TextMd } from "../Typography" - -type ActivitiesListItemProps = Omit & - Omit & { - handleDismiss?: () => void - } - -function ActivitiesListItem(props: ActivitiesListItemProps) { - const { amount, status, txHash, type, handleDismiss, ...restProps } = props - - const isCompleted = status === "completed" - - return ( - - {isCompleted ? ( - - ) : ( - - )} - - - - - {isCompleted - ? `${convertActivityTypeToLabel(type)} completed` - : `${convertActivityTypeToLabel(type)}...`} - - - - - - - {isCompleted ? ( - - ) : ( - // TODO: To implement. Estimated activity time is not in scope of MVP. - // eslint-disable-next-line react/jsx-no-useless-fragment - <> - {/* Est. time remaining - - {new Date(estimatedTime).getHours()}h - */} - - )} - - {txHash && status === "pending" && ( - - - View transaction details - - )} - - - - ) -} - -export default ActivitiesListItem diff --git a/dapp/src/components/shared/ActivitiesList/index.ts b/dapp/src/components/shared/ActivitiesList/index.ts deleted file mode 100644 index 30619d084..000000000 --- a/dapp/src/components/shared/ActivitiesList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as ActivitiesList } from "./ActivitiesList" diff --git a/dapp/src/pages/DashboardPage/DashboardCard.tsx b/dapp/src/pages/DashboardPage/DashboardCard.tsx index ef1055de9..bdfbb90da 100644 --- a/dapp/src/pages/DashboardPage/DashboardCard.tsx +++ b/dapp/src/pages/DashboardPage/DashboardCard.tsx @@ -1,6 +1,5 @@ import React from "react" import { Card, CardBody, CardProps, VStack } from "@chakra-ui/react" -import { ActivitiesList } from "#/components/shared/ActivitiesList" import TransactionHistory from "./TransactionHistory" import PositionDetails from "./PositionDetails" @@ -8,7 +7,6 @@ export default function DashboardCard(props: CardProps) { return ( - From c3a6b3e07f0e668306935c1cff499726918fc073 Mon Sep 17 00:00:00 2001 From: Karolina Kosiorowska Date: Thu, 14 Nov 2024 10:33:31 +0100 Subject: [PATCH 3/8] Remove unneeded code for `latestActivities` We no longer need this logic because we have removed the notifications. --- dapp/src/hooks/store/index.ts | 1 - .../store/useLatestCompletedActivities.ts | 6 -- dapp/src/store/tests/walletSlice.test.ts | 51 +------------ dapp/src/store/wallet/walletSelector.ts | 13 +--- dapp/src/store/wallet/walletSlice.ts | 76 +------------------ dapp/src/theme/Alert.ts | 23 ------ dapp/src/types/activity.ts | 4 - dapp/src/utils/activities.ts | 3 - 8 files changed, 5 insertions(+), 172 deletions(-) delete mode 100644 dapp/src/hooks/store/useLatestCompletedActivities.ts diff --git a/dapp/src/hooks/store/index.ts b/dapp/src/hooks/store/index.ts index aafdf9918..07b9a19c0 100644 --- a/dapp/src/hooks/store/index.ts +++ b/dapp/src/hooks/store/index.ts @@ -11,4 +11,3 @@ export * from "./useActionFlowPause" export * from "./useIsSignedMessage" export { default as useHasFetchedActivities } from "./useHasFetchedActivities" export { default as useActivities } from "./useActivities" -export { default as useLatestCompletedActivities } from "./useLatestCompletedActivities" diff --git a/dapp/src/hooks/store/useLatestCompletedActivities.ts b/dapp/src/hooks/store/useLatestCompletedActivities.ts deleted file mode 100644 index 1fc1178f8..000000000 --- a/dapp/src/hooks/store/useLatestCompletedActivities.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { selectLatestCompletedActivities } from "#/store/wallet" -import { useAppSelector } from "./useAppSelector" - -export default function useLatestCompletedActivities() { - return useAppSelector(selectLatestCompletedActivities) -} diff --git a/dapp/src/store/tests/walletSlice.test.ts b/dapp/src/store/tests/walletSlice.test.ts index efbafdbef..b29009f60 100644 --- a/dapp/src/store/tests/walletSlice.test.ts +++ b/dapp/src/store/tests/walletSlice.test.ts @@ -2,11 +2,7 @@ import { beforeEach, describe, expect, it } from "vitest" import { createActivity } from "#/tests/factories" import { Activity } from "#/types" import { WalletState } from "../wallet" -import reducer, { - deleteLatestActivity, - initialState, - setActivities, -} from "../wallet/walletSlice" +import reducer, { initialState, setActivities } from "../wallet/walletSlice" const isSignedMessage = false const hasFetchedActivities = true @@ -16,10 +12,6 @@ const pendingActivity = createActivity({ status: "pending", }) -const latestActivities = { - [pendingActivityId]: pendingActivity, -} - const activities = [ pendingActivity, createActivity({ id: "1" }), @@ -34,22 +26,11 @@ describe("Wallet redux slice", () => { state = { ...initialState, activities, - latestActivities, isSignedMessage, hasFetchedActivities, } }) - it("should delete latest activity", () => { - expect(reducer(state, deleteLatestActivity(pendingActivityId))).toEqual({ - ...initialState, - activities, - latestActivities: {}, - isSignedMessage, - hasFetchedActivities, - }) - }) - it("should update activities when the status of item changes", () => { const newActivities = [...activities] const completedActivity: Activity = { @@ -60,14 +41,10 @@ describe("Wallet redux slice", () => { ({ id }) => id === pendingActivityId, ) newActivities[foundIndex] = completedActivity - const newLatestActivities = { - [pendingActivityId]: completedActivity, - } expect(reducer(state, setActivities(newActivities))).toEqual({ ...initialState, activities: newActivities, - latestActivities: newLatestActivities, isSignedMessage, hasFetchedActivities, }) @@ -102,12 +79,6 @@ describe("Wallet redux slice", () => { }), ] - // A user made a new withdrawal and the dapp saved the pending activity in - // the store. - const currentLatestActivities = { - [pendingWithdrawRedemptionKey]: pendingWithdrawActivity, - } - describe("when withdrawal is still pending", () => { // This is our pending withdrawal but with the full id with the `-` // suffix returned by backend. @@ -122,19 +93,10 @@ describe("Wallet redux slice", () => { pendingWithdrawActivityWithFullId, ] - // We should replace the pending activity with the activity from the - // backend that contains the full id (`-`) and still - // keep it in the `latestActivities` map. - const expectedLatestActivities = { - [pendingWithdrawActivityWithFullId.id]: - pendingWithdrawActivityWithFullId, - } - beforeEach(() => { state = { ...initialState, activities: currentActivities, - latestActivities: currentLatestActivities, isSignedMessage, hasFetchedActivities, } @@ -144,7 +106,6 @@ describe("Wallet redux slice", () => { expect(reducer(state, setActivities(newActivities))).toEqual({ ...initialState, activities: newActivities, - latestActivities: expectedLatestActivities, isSignedMessage, hasFetchedActivities, }) @@ -164,26 +125,18 @@ describe("Wallet redux slice", () => { // redemption key). const newActivities = [...currentActivities, withdrawActivityCompleted] - // The dapp should update the state to `completed` and save this activity - // in the latest activity map. - const expectedLatestActivities = { - [withdrawActivityCompleted.id]: withdrawActivityCompleted, - } - beforeEach(() => { state = { ...initialState, activities: currentActivities, - latestActivities: currentLatestActivities, isSignedMessage, } }) - it("should mark the latest pending withdraw activity as completed and save as latest activity", () => { + it("should mark the latest pending withdraw activity as completed", () => { expect(reducer(state, setActivities(newActivities))).toEqual({ ...initialState, activities: newActivities, - latestActivities: expectedLatestActivities, isSignedMessage, hasFetchedActivities, }) diff --git a/dapp/src/store/wallet/walletSelector.ts b/dapp/src/store/wallet/walletSelector.ts index e97ac2001..db8194cd6 100644 --- a/dapp/src/store/wallet/walletSelector.ts +++ b/dapp/src/store/wallet/walletSelector.ts @@ -1,5 +1,5 @@ import { createSelector } from "@reduxjs/toolkit" -import { filterCompletedActivities, sortActivitiesByTimestamp } from "#/utils" +import { sortActivitiesByTimestamp } from "#/utils" import { RootState } from ".." export const selectEstimatedBtcBalance = (state: RootState): bigint => @@ -18,17 +18,6 @@ export const selectAllActivitiesCount = createSelector( (activities) => activities.length, ) -export const selectLatestActivities = createSelector( - (state: RootState) => state.wallet.latestActivities, - (latestActivities) => - sortActivitiesByTimestamp(Object.values(latestActivities)), -) - -export const selectLatestCompletedActivities = createSelector( - selectLatestActivities, - (latestActivities) => filterCompletedActivities(latestActivities), -) - export const selectIsSignedMessage = (state: RootState): boolean => state.wallet.isSignedMessage diff --git a/dapp/src/store/wallet/walletSlice.ts b/dapp/src/store/wallet/walletSlice.ts index fc8dc986d..fb0296445 100644 --- a/dapp/src/store/wallet/walletSlice.ts +++ b/dapp/src/store/wallet/walletSlice.ts @@ -1,12 +1,10 @@ -import { ActivitiesByIds, Activity } from "#/types" -import { isActivityCompleted } from "#/utils" +import { Activity } from "#/types" import { PayloadAction, createSlice } from "@reduxjs/toolkit" export type WalletState = { estimatedBtcBalance: bigint sharesBalance: bigint isSignedMessage: boolean - latestActivities: ActivitiesByIds activities: Activity[] hasFetchedActivities: boolean address: string | undefined @@ -16,7 +14,6 @@ export const initialState: WalletState = { estimatedBtcBalance: 0n, sharesBalance: 0n, isSignedMessage: false, - latestActivities: {}, activities: [], hasFetchedActivities: false, address: undefined, @@ -36,80 +33,12 @@ export const walletSlice = createSlice({ state.isSignedMessage = action.payload }, setActivities(state, action: PayloadAction) { - const allActivities = action.payload - - const pendingActivities = allActivities.reduce<[string, Activity][]>( - (acc, activity) => { - if (!isActivityCompleted(activity)) acc.push([activity.id, activity]) - - return acc - }, - [], - ) - const pendingActivitiesByIds = Object.fromEntries(pendingActivities) - const pendingActivitiesIds = Object.keys(pendingActivities) - - const { latestActivities } = state - - const completedActivitiesByIds = Object.values( - latestActivities, - ).reduce((acc, latestActivity) => { - if ( - latestActivity.type === "deposit" && - !pendingActivitiesIds.includes(latestActivity.id) - ) { - acc[latestActivity.id] = { ...latestActivity, status: "completed" } - return acc - } - - const pendingActivityIdWithSameRedemptionKey = - pendingActivitiesIds.find((id) => latestActivity.id.includes(id)) - - const completedWithdrawalsWithSameRedemptionKey = allActivities - .filter( - (activity) => - activity.id.includes(latestActivity.id) && - isActivityCompleted(activity), - ) - .sort((first, second) => { - // The withdraw id is: `-` - const [, firstCount] = first.id.split("-") - const [, secondCount] = second.id.split("-") - - return Number(secondCount) - Number(firstCount) - }) - - const latestCompletedWithdraw = - completedWithdrawalsWithSameRedemptionKey[0] - - if ( - !pendingActivityIdWithSameRedemptionKey && - latestCompletedWithdraw - ) { - acc[latestCompletedWithdraw.id] = latestCompletedWithdraw - } - - return acc - }, {}) - - state.activities = allActivities - state.latestActivities = Object.assign( - completedActivitiesByIds, - pendingActivitiesByIds, - ) + state.activities = action.payload state.hasFetchedActivities = true }, - deleteLatestActivity(state, action: PayloadAction) { - const activityId = action.payload - delete state.latestActivities[activityId] - }, resetState: (state) => ({ ...initialState, address: state.address }), activityInitialized(state, action: PayloadAction) { const activity = action.payload - state.latestActivities = { - ...state.latestActivities, - [activity.id]: activity, - } state.activities = [...state.activities, activity] }, setAddress(state, action: PayloadAction) { @@ -123,7 +52,6 @@ export const { setEstimatedBtcBalance, setIsSignedMessage, setActivities, - deleteLatestActivity, resetState, activityInitialized, setAddress, diff --git a/dapp/src/theme/Alert.ts b/dapp/src/theme/Alert.ts index 67c5d8a87..8b4aa91f9 100644 --- a/dapp/src/theme/Alert.ts +++ b/dapp/src/theme/Alert.ts @@ -54,31 +54,8 @@ const variantElevated = multiStyleConfig.definePartsStyle(({ colorScheme }) => { } }) -const variantProcess = multiStyleConfig.definePartsStyle({ - container: { - px: 6, - py: 4, - bg: "gold.300", - borderWidth: 1, - borderColor: "gold.100", - alignItems: "flex-start", - [$foregroundColor.variable]: "colors.brand.400", - }, - icon: { - mr: 4, - boxSize: 12, - }, - title: { - color: "grey.700", - fontWeight: "bold", - m: 0, - }, - description: { color: "grey.500", fontWeight: "medium" }, -}) - const variants = { subtle: variantSubtle, - process: variantProcess, elevated: variantElevated, } diff --git a/dapp/src/types/activity.ts b/dapp/src/types/activity.ts index 7d92168f1..27efaecda 100644 --- a/dapp/src/types/activity.ts +++ b/dapp/src/types/activity.ts @@ -19,7 +19,3 @@ type ConditionalActivityData = export type ActivityType = ConditionalActivityData["type"] export type Activity = CommonActivityData & ConditionalActivityData - -export type ActivitiesByIds = { - [id: string]: Activity -} diff --git a/dapp/src/utils/activities.ts b/dapp/src/utils/activities.ts index 44812948e..9197ff98e 100644 --- a/dapp/src/utils/activities.ts +++ b/dapp/src/utils/activities.ts @@ -15,9 +15,6 @@ export const sortActivitiesByTimestamp = (activities: Activity[]): Activity[] => getActivityTimestamp(activity2) - getActivityTimestamp(activity1), ) -export const filterCompletedActivities = (activities: Activity[]): Activity[] => - activities.filter((activity) => isActivityCompleted(activity)) - export const isWithdrawType = (type: ActivityType) => type === "withdraw" export function getEstimatedDuration( From d6f43ac822d9e3ea7b5379479db57f901e8e333e Mon Sep 17 00:00:00 2001 From: Rafal Czajkowski Date: Thu, 14 Nov 2024 13:43:43 +0100 Subject: [PATCH 4/8] Update copy in Welcome component Add missing comma and remove unnecessary `everyone` word in sentence. --- dapp/src/components/WelcomeModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dapp/src/components/WelcomeModal.tsx b/dapp/src/components/WelcomeModal.tsx index add9c7fe0..282e94e7b 100644 --- a/dapp/src/components/WelcomeModal.tsx +++ b/dapp/src/components/WelcomeModal.tsx @@ -34,7 +34,7 @@ const dappModeToContent: Record ReactElement> = { "ledger-live": () => ( Acre makes earning rewards with your BTC simple and secure. Tailored for - Ledger Live everyone, it's fun and easy to use. No advanced knowledge + Ledger Live, it's fun and easy to use. No advanced knowledge required. ), @@ -79,7 +79,7 @@ const steps = [ id: 2, title: (

- One dashboard{" "} + One dashboard,{" "} endless rewards From aac8946128ec3fd56152db67943ea1cfb42940c2 Mon Sep 17 00:00:00 2001 From: Rafal Czajkowski Date: Thu, 14 Nov 2024 13:47:15 +0100 Subject: [PATCH 5/8] Remove the close button in the Welcome component --- dapp/src/components/WelcomeModal.tsx | 94 +++++++++++++--------------- dapp/src/pages/WelcomePage/index.tsx | 1 + 2 files changed, 46 insertions(+), 49 deletions(-) diff --git a/dapp/src/components/WelcomeModal.tsx b/dapp/src/components/WelcomeModal.tsx index 282e94e7b..714a3fd55 100644 --- a/dapp/src/components/WelcomeModal.tsx +++ b/dapp/src/components/WelcomeModal.tsx @@ -4,7 +4,6 @@ import { ModalBody, ModalHeader, Box, - ModalCloseButton, Stepper, Step, StepIndicator, @@ -141,55 +140,52 @@ function WelcomeModalBase({ closeModal }: BaseModalProps) { const activeStepData = steps[activeStep] return ( - <> - - - - - - Welcome to Acre, - - {activeStepData.title} - - - {activeStepData.content(embeddedApp)} - - + + + + Welcome to Acre, + + {activeStepData.title} + + + {activeStepData.content(embeddedApp)} + + + + {steps.map((step) => ( + setActiveStep(step.id)}> + + + ))} + + - - - - - + {isLastStep ? "Get started" : "Skip"} + + + + + ) } diff --git a/dapp/src/pages/WelcomePage/index.tsx b/dapp/src/pages/WelcomePage/index.tsx index f1ef5dd23..fef5bf2bf 100644 --- a/dapp/src/pages/WelcomePage/index.tsx +++ b/dapp/src/pages/WelcomePage/index.tsx @@ -12,6 +12,7 @@ function WelcomePage() { return ( { setShouldDisplayWelcomeModal(false) navigate("/dashboard") From 420f528dca38debf4ede54b54a65cb2a5f0c753e Mon Sep 17 00:00:00 2001 From: Rafal Czajkowski Date: Thu, 14 Nov 2024 13:49:52 +0100 Subject: [PATCH 6/8] Update button text in welcome modal `Skip` -> `Next` --- dapp/src/components/WelcomeModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dapp/src/components/WelcomeModal.tsx b/dapp/src/components/WelcomeModal.tsx index 714a3fd55..3097750d6 100644 --- a/dapp/src/components/WelcomeModal.tsx +++ b/dapp/src/components/WelcomeModal.tsx @@ -168,7 +168,7 @@ function WelcomeModalBase({ closeModal }: BaseModalProps) { variant={isLastStep ? undefined : "outline"} onClick={isLastStep ? closeModal : goToNext} > - {isLastStep ? "Get started" : "Skip"} + {isLastStep ? "Get started" : "Next"} From 5b163f7da56b7d76a2060a7b60c4e3d3fd3d3031 Mon Sep 17 00:00:00 2001 From: Rafal Czajkowski Date: Thu, 14 Nov 2024 13:57:33 +0100 Subject: [PATCH 7/8] Simplify the stepper component in welcome modal Display a simple dot for an active step - the dot should only change color in an active state. --- dapp/src/components/WelcomeModal.tsx | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/dapp/src/components/WelcomeModal.tsx b/dapp/src/components/WelcomeModal.tsx index 3097750d6..d40d0bc75 100644 --- a/dapp/src/components/WelcomeModal.tsx +++ b/dapp/src/components/WelcomeModal.tsx @@ -99,18 +99,6 @@ const stepIndicatorStyleProps: StepIndicatorProps = { sx: { "[data-status=active] &": { opacity: 1, - w: "4", - rounded: "6", - _after: { - content: '""', - position: "absolute", - opacity: "0.15", - w: "4", - h: "2.5", - rounded: "5", - left: "1.5", - bgColor: "orange.50", - }, }, "&[data-status=complete], [data-status=incomplete] &": { bgColor: "orange.50", @@ -121,7 +109,6 @@ const stepIndicatorStyleProps: StepIndicatorProps = { h: "2.5", rounded: "50%", bgColor: "orange.50", - position: "relative", opacity: "0.15", _hover: { cursor: "pointer", From 01afd03e418cf94cf72bcf765a4dcc69cc9372fa Mon Sep 17 00:00:00 2001 From: Rafal Czajkowski Date: Thu, 14 Nov 2024 14:18:30 +0100 Subject: [PATCH 8/8] Disable `Connect account/wallet` button This button should only be enabled on the dashboard page. --- dapp/src/components/Header/ConnectWallet.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dapp/src/components/Header/ConnectWallet.tsx b/dapp/src/components/Header/ConnectWallet.tsx index 11bcdcea3..e3424ed1d 100644 --- a/dapp/src/components/Header/ConnectWallet.tsx +++ b/dapp/src/components/Header/ConnectWallet.tsx @@ -23,6 +23,7 @@ import { IconWallet, IconUserCode, } from "@tabler/icons-react" +import { useMatch } from "react-router-dom" function isChangeAccountFeatureSupported(embeddedApp: string | undefined) { return referralProgram.isEmbedApp(embeddedApp) @@ -37,6 +38,7 @@ export default function ConnectWallet() { variant: "card", size: "lg", }) + const isDashboardPage = useMatch("/dashboard") const handleConnectWallet = (isReconnecting: boolean = false) => { openModal(MODAL_TYPES.CONNECT_WALLET, { isReconnecting }) @@ -54,6 +56,7 @@ export default function ConnectWallet() { isOpenGlobalErrorModal) && { pointerEvents: "none", })} + isDisabled={!isDashboardPage} > {`Connect ${isEmbed ? "account" : "wallet"}`}