From 1ab3a837f96b75530c1eb40124ff1add45f8a866 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Tue, 12 Nov 2024 11:32:53 +0530 Subject: [PATCH] Fix duplicate component rendering in project create flow --- .../components/projects/create/Configure.tsx | 11 +- .../pages/org-slug/projects/create/layout.tsx | 126 +++++++++--------- 2 files changed, 69 insertions(+), 68 deletions(-) diff --git a/packages/frontend/src/components/projects/create/Configure.tsx b/packages/frontend/src/components/projects/create/Configure.tsx index 6c500d30..a179ba92 100644 --- a/packages/frontend/src/components/projects/create/Configure.tsx +++ b/packages/frontend/src/components/projects/create/Configure.tsx @@ -581,11 +581,6 @@ const Configure = () => { onAccountChange={onAccountChange} isDataReceived={isAccountsDataReceived} /> - {accounts.length > 0 && (
); diff --git a/packages/frontend/src/pages/org-slug/projects/create/layout.tsx b/packages/frontend/src/pages/org-slug/projects/create/layout.tsx index 32c13b78..ab63c951 100644 --- a/packages/frontend/src/pages/org-slug/projects/create/layout.tsx +++ b/packages/frontend/src/pages/org-slug/projects/create/layout.tsx @@ -1,12 +1,14 @@ import { ComponentPropsWithoutRef } from 'react'; 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 { WavyBorder } from 'components/shared/WavyBorder'; import { Button } from 'components/shared/Button'; import { CrossIcon } from 'components/shared/CustomIcon'; import { cn } from 'utils/classnames'; -import * as Dialog from '@radix-ui/react-dialog'; export interface CreateProjectLayoutProps extends ComponentPropsWithoutRef<'section'> {} @@ -16,6 +18,7 @@ export const CreateProjectLayout = ({ ...props }: CreateProjectLayoutProps) => { const { orgSlug } = useParams(); + const isDesktopView = useMediaQuery('(min-width: 720px)'); // md: const closeBtnLink = `/${orgSlug}`; @@ -28,72 +31,69 @@ export const CreateProjectLayout = ({ ); - return ( - <> - {/* Desktop */} - + ) : ( + // Mobile + // Setting modal={false} so even if modal is active on desktop, it doesn't block clicks + + + {/* Not using since modal={false} disables it and its content will not show */} +
+ + {/* Heading */} +
+ {heading} + + +
- {/* Mobile */} - {/* Setting modal={false} so even if modal is active on desktop, it doesn't block clicks */} - - - {/* Not using since modal={false} disables it and its content will not show */} -
- - {/* Heading */} -
- {heading} - - -
+ {/* Border */} + - {/* Border */} - - - {/* Page content */} -
- -
-
-
-
-
- + {/* Page content */} +
+ +
+
+
+
+
); };