From b272a69c691b7c44617c0d995a7577a65529ffd9 Mon Sep 17 00:00:00 2001 From: chavda-bhavik Date: Sat, 19 Oct 2024 13:32:01 +0530 Subject: [PATCH] feat: Made Imports Page protected and respected DOM elements order in list --- apps/web/components/List/List.styles.tsx | 3 +-- apps/web/components/List/List.tsx | 4 ++-- .../ManageProject/ManageProjectModal.tsx | 4 ++-- apps/web/pages/imports/[id].tsx | 23 ++++++++++++++++--- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/apps/web/components/List/List.styles.tsx b/apps/web/components/List/List.styles.tsx index 58fa9d33..2cc05357 100644 --- a/apps/web/components/List/List.styles.tsx +++ b/apps/web/components/List/List.styles.tsx @@ -9,11 +9,10 @@ export const getListStyles = createStyles((theme) => ({ }, row: { borderBottom: `1px solid ${theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`, - cursor: 'pointer', }, td: { - padding: theme.spacing.sm, textAlign: 'left', + padding: `${theme.spacing.sm} !important`, }, th: { textAlign: 'left', diff --git a/apps/web/components/List/List.tsx b/apps/web/components/List/List.tsx index 34907db0..959b57e0 100644 --- a/apps/web/components/List/List.tsx +++ b/apps/web/components/List/List.tsx @@ -61,7 +61,7 @@ export function List(props: IListProps) { ); return ( - <> + {data.map((item: T) => ( (props: IListProps) { ))} ))} - + ); }; diff --git a/apps/web/components/ManageProject/ManageProjectModal.tsx b/apps/web/components/ManageProject/ManageProjectModal.tsx index e230f185..f23863a7 100644 --- a/apps/web/components/ManageProject/ManageProjectModal.tsx +++ b/apps/web/components/ManageProject/ManageProjectModal.tsx @@ -99,8 +99,8 @@ export function ManageProjectModal() { - - You will be switched to the project once created. + + You will be switched to the project once created. diff --git a/apps/web/pages/imports/[id].tsx b/apps/web/pages/imports/[id].tsx index 97168579..954701d4 100644 --- a/apps/web/pages/imports/[id].tsx +++ b/apps/web/pages/imports/[id].tsx @@ -7,12 +7,13 @@ import { ActionIcon, Flex, Group, LoadingOverlay, Title, useMantineTheme, Select import { track } from '@libs/amplitude'; import { useImpler } from '@impler/react'; import { TemplateModeEnum } from '@impler/shared'; -import { IMPORT_MODES, ROUTES, colors } from '@config'; +import { IMPORT_MODES, ROUTES, SubjectsEnum, colors } from '@config'; import { useImportDetails } from '@hooks/useImportDetails'; import { Tabs } from '@ui/Tabs'; import { Button } from '@ui/button'; import { Schema } from '@components/imports/schema'; +import { withProtectedResource } from '@components/hoc'; import { Destination } from '@components/imports/destination'; import { AppLayout } from '@layouts/AppLayout'; @@ -28,7 +29,7 @@ const Validator = dynamic(() => import('@components/imports/validator').then((mo ssr: false, }); -export default function ImportDetails({}) { +function ImportDetails() { const router = useRouter(); const [activeTab, setActiveTab] = useState<'schema' | 'destination' | 'snippet' | 'validator' | 'output'>(); const { colorScheme } = useMantineTheme(); @@ -145,4 +146,20 @@ export default function ImportDetails({}) { ); } -ImportDetails.Layout = AppLayout; +const EnhancedImportDetails = withProtectedResource(ImportDetails, { + subject: SubjectsEnum.IMPORTS, +}); + +export default function ImportDetailsPage() { + return ; +} + +ImportDetailsPage.Layout = AppLayout; + +export async function getServerSideProps() { + return { + props: { + title: 'Import Details', + }, + }; +}