Integrate wallet IFrame for payments #42

Merged
nabarun merged 27 commits from iv-integrate-frame into main 2024-11-13 13:32:28 +00:00
2 changed files with 69 additions and 68 deletions
Showing only changes of commit 1ab3a837f9 - Show all commits

View File

@ -581,11 +581,6 @@ const Configure = () => {
onAccountChange={onAccountChange} onAccountChange={onAccountChange}
isDataReceived={isAccountsDataReceived} isDataReceived={isAccountsDataReceived}
/> />
<IFrameModal
setAccounts={setAccounts}
setIsDataReceived={setIsAccountsDataReceived}
isVisible={isFrameVisible}
/>
{accounts.length > 0 && ( {accounts.length > 0 && (
<div> <div>
<Button <Button
@ -617,6 +612,12 @@ const Configure = () => {
)} )}
</form> </form>
</FormProvider> </FormProvider>
<IFrameModal
setAccounts={setAccounts}
setIsDataReceived={setIsAccountsDataReceived}
isVisible={isFrameVisible}
/>
</div> </div>
</div> </div>
); );

View File

@ -1,12 +1,14 @@
import { ComponentPropsWithoutRef } from 'react'; import { ComponentPropsWithoutRef } from 'react';
import { Link, Outlet, useParams } from 'react-router-dom'; import { Link, Outlet, useParams } from 'react-router-dom';
import { useMediaQuery } from 'usehooks-ts';
import * as Dialog from '@radix-ui/react-dialog';
import { Heading } from 'components/shared/Heading'; import { Heading } from 'components/shared/Heading';
import { WavyBorder } from 'components/shared/WavyBorder'; import { WavyBorder } from 'components/shared/WavyBorder';
import { Button } from 'components/shared/Button'; import { Button } from 'components/shared/Button';
import { CrossIcon } from 'components/shared/CustomIcon'; import { CrossIcon } from 'components/shared/CustomIcon';
import { cn } from 'utils/classnames'; import { cn } from 'utils/classnames';
import * as Dialog from '@radix-ui/react-dialog';
export interface CreateProjectLayoutProps export interface CreateProjectLayoutProps
extends ComponentPropsWithoutRef<'section'> {} extends ComponentPropsWithoutRef<'section'> {}
@ -16,6 +18,7 @@ export const CreateProjectLayout = ({
...props ...props
}: CreateProjectLayoutProps) => { }: CreateProjectLayoutProps) => {
const { orgSlug } = useParams(); const { orgSlug } = useParams();
const isDesktopView = useMediaQuery('(min-width: 720px)'); // md:
const closeBtnLink = `/${orgSlug}`; const closeBtnLink = `/${orgSlug}`;
@ -28,9 +31,8 @@ export const CreateProjectLayout = ({
</Heading> </Heading>
); );
return ( return isDesktopView ? (
<> // Desktop
{/* Desktop */}
<section <section
{...props} {...props}
className={cn( className={cn(
@ -54,14 +56,13 @@ export const CreateProjectLayout = ({
</div> </div>
<WavyBorder /> <WavyBorder />
</div> </div>
<section className="px-6 h-full flex-1 py-6 overflow-y-auto"> <section className="px-6 h-full flex-1 py-6 overflow-y-auto">
<Outlet /> <Outlet />
</section> </section>
</section> </section>
) : (
{/* Mobile */} // Mobile
{/* Setting modal={false} so even if modal is active on desktop, it doesn't block clicks */} // Setting modal={false} so even if modal is active on desktop, it doesn't block clicks
<Dialog.Root modal={false} open={true}> <Dialog.Root modal={false} open={true}>
<Dialog.Portal> <Dialog.Portal>
{/* Not using <Dialog.Overlay> since modal={false} disables it and its content will not show */} {/* Not using <Dialog.Overlay> since modal={false} disables it and its content will not show */}
@ -94,6 +95,5 @@ export const CreateProjectLayout = ({
</div> </div>
</Dialog.Portal> </Dialog.Portal>
</Dialog.Root> </Dialog.Root>
</>
); );
}; };