From 6ae04251d2dcdcdde36516493ebb00123331deb5 Mon Sep 17 00:00:00 2001 From: Vivian Phung Date: Mon, 13 May 2024 17:28:37 -0400 Subject: [PATCH] cleanup dialogs --- .../project/settings/AddMemberDialog.tsx | 110 ++++++-------- .../projects/project/settings/DomainCard.tsx | 7 +- .../project/settings/EditDomainDialog.tsx | 137 ++++++++---------- .../settings/ProjectSettingContainer.tsx | 5 +- .../Project/Settings/General.stories.tsx | 30 ++++ 5 files changed, 146 insertions(+), 143 deletions(-) create mode 100644 packages/frontend/src/stories/Project/Settings/General.stories.tsx diff --git a/packages/frontend/src/components/projects/project/settings/AddMemberDialog.tsx b/packages/frontend/src/components/projects/project/settings/AddMemberDialog.tsx index 3f8372c..6c85705 100644 --- a/packages/frontend/src/components/projects/project/settings/AddMemberDialog.tsx +++ b/packages/frontend/src/components/projects/project/settings/AddMemberDialog.tsx @@ -2,16 +2,12 @@ import { useCallback } from 'react'; import { useForm } from 'react-hook-form'; import { AddProjectMemberInput, Permission } from 'gql-client'; -import { - Button, - Dialog, - DialogHeader, - DialogBody, - DialogFooter, - Input, - Typography, - Checkbox, -} from '@snowballtools/material-tailwind-react-fork'; +import { Typography } from '@snowballtools/material-tailwind-react-fork'; + +import { Button } from 'components/shared/Button'; +import { Modal } from 'components/shared/Modal'; +import { Input } from 'components/shared/Input'; +import { Checkbox } from 'components/shared/Checkbox'; interface AddMemberDialogProp { open: boolean; @@ -61,59 +57,47 @@ const AddMemberDialog = ({ }, []); return ( - - -
Add member
- -
-
- - - We will send an invitation link to this email address. - - Email address - - Permissions - - You can change this later if required. - - - - - - - - -
-
+ + + Add member +
+ + + We will send an invitation link to this email address. + + Email address + + Permissions + + You can change this later if required. + + + + + + + + +
+
+
); }; diff --git a/packages/frontend/src/components/projects/project/settings/DomainCard.tsx b/packages/frontend/src/components/projects/project/settings/DomainCard.tsx index 01de9d0..9524707 100644 --- a/packages/frontend/src/components/projects/project/settings/DomainCard.tsx +++ b/packages/frontend/src/components/projects/project/settings/DomainCard.tsx @@ -115,13 +115,13 @@ const DomainCard = ({ setEditDialogOpen((preVal) => !preVal); }} > - ^ Edit domain + Edit Domain setDeleteDialogOpen((preVal) => !preVal)} > - ^ Delete domain + Delete domain @@ -141,7 +141,7 @@ const DomainCard = ({ Production {domain.status === DomainStatus.Pending && ( - + {refreshStatus === RefreshStatus.IDLE ? ( ^ Add these records to your domain and refresh to check @@ -152,7 +152,6 @@ const DomainCard = ({ ) : (
-
^
Failed to verify records. DNS propagation can take up to 48 hours. Please ensure you added the correct records and refresh. diff --git a/packages/frontend/src/components/projects/project/settings/EditDomainDialog.tsx b/packages/frontend/src/components/projects/project/settings/EditDomainDialog.tsx index 113b10a..44a285b 100644 --- a/packages/frontend/src/components/projects/project/settings/EditDomainDialog.tsx +++ b/packages/frontend/src/components/projects/project/settings/EditDomainDialog.tsx @@ -4,18 +4,15 @@ import toast from 'react-hot-toast'; import { Domain } from 'gql-client'; import { - Button, - Dialog, - DialogHeader, - DialogBody, - DialogFooter, - Input, Typography, Select, Option, } from '@snowballtools/material-tailwind-react-fork'; import { useGQLClient } from '../../../../context/GQLClientContext'; +import { Modal } from 'components/shared/Modal'; +import { Button } from 'components/shared/Button'; +import { Input } from 'components/shared/Input'; const DEFAULT_REDIRECT_OPTIONS = ['none']; @@ -122,77 +119,67 @@ const EditDomainDialog = ({ }, [domain]); return ( - - -
Edit domain
- -
-
- - Domain name - - Redirect to - ( - + + + Edit domain + + + Domain name + + Redirect to + ( + + )} + /> + {isDisableDropdown && ( +
+
^
+ + Domain “ + {domainRedirectedFrom ? domainRedirectedFrom.name : ''}” + redirects to this domain so you can not redirect this doman + further. + +
)} - /> - {isDisableDropdown && ( -
-
^
- - Domain “{domainRedirectedFrom ? domainRedirectedFrom.name : ''}” - redirects to this domain so you can not redirect this doman - further. + Git branch + + Boolean(branches.length) ? branches.includes(value) : true, + })} + disabled={ + !Boolean(branches.length) || + watch('redirectedTo') !== DEFAULT_REDIRECT_OPTIONS[0] + } + /> + {!isValid && ( + + We couldn't find this branch in the connected Git + repository. -
- )} - Git branch - - Boolean(branches.length) ? branches.includes(value) : true, - })} - disabled={ - !Boolean(branches.length) || - watch('redirectedTo') !== DEFAULT_REDIRECT_OPTIONS[0] - } - /> - {!isValid && ( - - We couldn't find this branch in the connected Git repository. - - )} -
- - - - -
-
+ )} + + + + + + + + ); }; diff --git a/packages/frontend/src/components/projects/project/settings/ProjectSettingContainer.tsx b/packages/frontend/src/components/projects/project/settings/ProjectSettingContainer.tsx index 4d2ae09..f48675b 100644 --- a/packages/frontend/src/components/projects/project/settings/ProjectSettingContainer.tsx +++ b/packages/frontend/src/components/projects/project/settings/ProjectSettingContainer.tsx @@ -18,7 +18,10 @@ const ProjectSettingContainer: React.FC = ({ ...props }: ProjectSettingContainerProps) => { return ( -
+
= { + title: 'Project/Settings/AddEnvironmentVariableRow', + component: AddEnvironmentVariableRow, + tags: ['autodocs'], + decorators: [withRouter], + parameters: { + reactRouter: reactRouterParameters({ + location: { + pathParams: { userId: 'me' }, + }, + routing: { + path: '/snowball-tools-1/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings', + }, + }), + }, +} as Meta; + +export default meta; + +type Story = StoryObj; + +export const Default: Story = {};