From 1148d930dd40cfeb9c0c4e6725cffde45c49eb6d Mon Sep 17 00:00:00 2001 From: Matthew Pereira Date: Tue, 26 Nov 2024 19:58:56 -0800 Subject: [PATCH] improve reset modal ux --- .../app/v3/_components/PoolConfiguration.tsx | 20 +------ .../v3/_components/PoolCreationManager.tsx | 2 +- packages/nextjs/app/v3/page.tsx | 29 +++++++++- .../components/common/PoolStateResetModal.tsx | 55 ++++++++----------- 4 files changed, 54 insertions(+), 52 deletions(-) diff --git a/packages/nextjs/app/v3/_components/PoolConfiguration.tsx b/packages/nextjs/app/v3/_components/PoolConfiguration.tsx index f1d52ad..489a025 100644 --- a/packages/nextjs/app/v3/_components/PoolConfiguration.tsx +++ b/packages/nextjs/app/v3/_components/PoolConfiguration.tsx @@ -3,14 +3,13 @@ import { useEffect, useState } from "react"; import { ChooseInfo, ChooseParameters, ChooseTokens, ChooseType, PoolCreationManager } from "./"; import { ArrowLeftIcon, ArrowRightIcon } from "@heroicons/react/24/outline"; -import { PoolStateResetModal, TransactionButton } from "~~/components/common"; +import { TransactionButton } from "~~/components/common"; import { TABS, type TabType, usePoolCreationStore, useValidatePoolCreationInput } from "~~/hooks/v3"; import { bgBeigeGradient } from "~~/utils"; export function PoolConfiguration() { - const { selectedTab, updatePool, clearPoolStore, step } = usePoolCreationStore(); + const { selectedTab, updatePool, step } = usePoolCreationStore(); const [isPoolCreationModalOpen, setIsPoolCreationModalOpen] = useState(false); - const [isResetModalOpen, setIsResetModalOpen] = useState(false); const { prev, next } = getAdjacentTabs(selectedTab); const { isParametersValid, isTypeValid, isInfoValid, isTokensValid, isPoolCreationInputValid } = useValidatePoolCreationInput(); @@ -100,23 +99,8 @@ export function PoolConfiguration() { ) : null} -
-
setIsResetModalOpen(true)} className="text-center underline cursor-pointer text-lg mt-2"> - Reset progress -
-
- {isResetModalOpen && ( - { - clearPoolStore(); - updatePool({ selectedTab: "Type" }); - }} - /> - )} - {isPoolCreationModalOpen && } ); diff --git a/packages/nextjs/app/v3/_components/PoolCreationManager.tsx b/packages/nextjs/app/v3/_components/PoolCreationManager.tsx index 1c3cace..60116bc 100644 --- a/packages/nextjs/app/v3/_components/PoolCreationManager.tsx +++ b/packages/nextjs/app/v3/_components/PoolCreationManager.tsx @@ -125,7 +125,7 @@ export function PoolCreationManager({ setIsModalOpen }: { setIsModalOpen: (isOpe {step <= poolCreationSteps.length ? poolCreationSteps[step - 1].component : }
setIsResetModalOpen(true)} className="text-center underline cursor-pointer text-lg"> - Having trouble? + Want help?
diff --git a/packages/nextjs/app/v3/page.tsx b/packages/nextjs/app/v3/page.tsx index df35d1b..6234724 100644 --- a/packages/nextjs/app/v3/page.tsx +++ b/packages/nextjs/app/v3/page.tsx @@ -1,15 +1,20 @@ "use client"; +import { useState } from "react"; import { PoolConfiguration, PoolDetails } from "./_components"; import type { NextPage } from "next"; import { ArrowUpRightIcon } from "@heroicons/react/24/outline"; import { BalancerLogo } from "~~/components/assets/BalancerLogo"; -import { Alert } from "~~/components/common"; -import { usePoolStoreDebug, useValidateNetwork } from "~~/hooks/v3"; +import { Alert, PoolStateResetModal } from "~~/components/common"; +import { usePoolCreationStore, usePoolStoreDebug, useValidateNetwork } from "~~/hooks/v3"; const BalancerV3: NextPage = () => { + const [isResetModalOpen, setIsResetModalOpen] = useState(false); + usePoolStoreDebug(); const { isWrongNetwork, isWalletConnected } = useValidateNetwork(); + const { updatePool, clearPoolStore, selectedTab } = usePoolCreationStore(); + return (
@@ -45,9 +50,20 @@ const BalancerV3: NextPage = () => { <>
+
Pool Preview
+ {selectedTab !== "Type" && ( +
+
setIsResetModalOpen(true)} + className="text-center underline cursor-pointer text-lg mt-2" + > + Want help? +
+
+ )}
@@ -60,6 +76,15 @@ const BalancerV3: NextPage = () => { )}
+ {isResetModalOpen && ( + { + clearPoolStore(); + updatePool({ selectedTab: "Type" }); + }} + /> + )} ); }; diff --git a/packages/nextjs/components/common/PoolStateResetModal.tsx b/packages/nextjs/components/common/PoolStateResetModal.tsx index 0af04bc..f766f71 100644 --- a/packages/nextjs/components/common/PoolStateResetModal.tsx +++ b/packages/nextjs/components/common/PoolStateResetModal.tsx @@ -1,5 +1,5 @@ import Link from "next/link"; -import { ArrowTopRightOnSquareIcon, XMarkIcon } from "@heroicons/react/24/outline"; +import { XMarkIcon } from "@heroicons/react/24/outline"; interface PoolStateResetModalProps { setIsModalOpen: (isOpen: boolean) => void; @@ -7,43 +7,36 @@ interface PoolStateResetModalProps { etherscanURL?: string | undefined; } -export const PoolStateResetModal = ({ setIsModalOpen, clearState, etherscanURL }: PoolStateResetModalProps) => { +export const PoolStateResetModal = ({ setIsModalOpen, clearState }: PoolStateResetModalProps) => { return (
setIsModalOpen(false)} />
-
Troubleshooting Tips
- +
Need Assistance?
setIsModalOpen(false)} />
-
    -
  1. - window.location.reload()}> - Refresh the page - {" "} - after a transaction has been finalized -
  2. -
  3. - Reach out for assistance on{" "} - - discord{" "} - - -
  4. - {etherscanURL && ( -
  5. - View the pool on a{" "} - - block explorer{" "} - - -
  6. - )} -
  7. Or to start over, click the reset button below
  8. -
+
+ If you have encountered any issues or want help deciding on pool configuration, please reach out to us on{" "} + + discord{" "} + {" "} + or create an issue on{" "} + + github + +
+
+ Or to reset all pool configuration and creation progress, click the red button below +
+
-