From fcf2678913f4a84e8696a464f8ec6b37781ac43f Mon Sep 17 00:00:00 2001 From: YuvRaj6392 <74025229+YuvRaj6392@users.noreply.github.com> Date: Wed, 25 Sep 2024 20:20:41 +0530 Subject: [PATCH] added --- frontend/app/zap/create/page.tsx | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/frontend/app/zap/create/page.tsx b/frontend/app/zap/create/page.tsx index 68922d9..f519326 100644 --- a/frontend/app/zap/create/page.tsx +++ b/frontend/app/zap/create/page.tsx @@ -48,7 +48,7 @@ export default function Page() { const [selectedModalIndex, setSelectedModalIndex] = useState(null) - const router=useRouter(); + const router = useRouter(); return (
@@ -152,6 +152,12 @@ export default function Page() { } function Modal({ index, onSelect, availableItems }: { index: number, onSelect: (props: null | { name: string, id: string }) => void, availableItems: { id: string, name: string, image: string }[] }) { + const [step, setStep] = useState(0) + const [selectedAction, setSelectedAction] = useState({}) + const isTrigger = index != 1; + + + return (
@@ -180,20 +186,32 @@ function Modal({ index, onSelect, availableItems }: { index: number, onSelect: (
{/* Modal content */} +
- {availableItems.map(({ id, name, image }) => { + {step === 1 && selectedAction === "email" && } + {step === 1 && selectedAction === "send-sol" && } + {step === 0 &&
{availableItems.map(({ id, name, image }) => { return
{ - onSelect({ - id, - name - }) + if (isTrigger) { + onSelect({ + id, + name + }) + } else { + setStep(s => s + 1) + setSelectedAction({ + id, + name + }) + } + }} className='flex border p-4 cursor-pointer hover:bg-slate-100'>
{name}
- })} + })}
}