From ae330d672710f6205a26a2a963df9925ce3c8d76 Mon Sep 17 00:00:00 2001 From: Nick Koukis Date: Sat, 14 Oct 2023 13:39:51 +0300 Subject: [PATCH] info toasts --- .../components/LandingPage/LandingPage.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/views/Home/components/LandingPage/LandingPage.tsx b/src/views/Home/components/LandingPage/LandingPage.tsx index ec0651d..6a7b185 100644 --- a/src/views/Home/components/LandingPage/LandingPage.tsx +++ b/src/views/Home/components/LandingPage/LandingPage.tsx @@ -9,6 +9,7 @@ import { IconButton } from '@chakra-ui/react' import CreateWalletModal from '../NewUserForm/CreateWalletModal'; import ExistingUserModal from '../ExistingUser/ExistingUserModal'; import { useGetUserInfo } from "@/views/Home/hooks/hooks"; +import { useToast } from '@chakra-ui/react' interface FeatureCardProps { icon: React.ComponentType; // Specify the type for the 'icon' prop @@ -18,6 +19,7 @@ interface FeatureCardProps { export default function LandingPage() { + const toast = useToast() const { data: session } = useSession(); const [showCreateWallet, setshowCreateWallet] = useState(false); const [showExistingUser, setshowExistingUsert] = useState(false); @@ -42,7 +44,6 @@ export default function LandingPage() { userExists = true; } - function handleSetshowCreateWallet() { loggedInUser ? ( setshowCreateWallet(true) @@ -51,6 +52,20 @@ export default function LandingPage() { ); } + function handleSetshowExistingUser() { + userExists ? ( + setshowExistingUsert(true) + ) : ( + toast({ + title: 'You haven\'t create account yet.', + description: "Try creating an account and you will be able to access your account information.", + status: 'info', + duration: 5000, + isClosable: true, + }) + ); + } + const particlesInit = useCallback(async (engine: Engine) => { await loadSlim(engine); }, []); @@ -264,7 +279,7 @@ export default function LandingPage() { ml={3} // Add margin to the right of the button colorScheme="teal" variant="outline" - onClick={() => setshowExistingUsert(true)} + onClick={() => handleSetshowExistingUser()} > Access Existing