From 0619c183afabadfde7276eb1e44a073ed7315dc3 Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Thu, 7 Apr 2022 12:20:04 +0800 Subject: [PATCH] chore(console): refactor connectors children components --- packages/console/src/pages/ConnectorDetails/index.tsx | 4 ++-- .../index.module.scss} | 0 .../{ConnectorName.tsx => ConnectorName/index.tsx} | 2 +- .../{ConnectorRow.tsx => ConnectorRow/index.tsx} | 2 +- .../index.module.scss} | 0 .../components/{SetupModal.tsx => CreateForm/index.tsx} | 7 ++++--- packages/console/src/pages/Connectors/index.tsx | 4 ++-- 7 files changed, 10 insertions(+), 9 deletions(-) rename packages/console/src/pages/Connectors/components/{ConnectorName.module.scss => ConnectorName/index.module.scss} (100%) rename packages/console/src/pages/Connectors/components/{ConnectorName.tsx => ConnectorName/index.tsx} (94%) rename packages/console/src/pages/Connectors/components/{ConnectorRow.tsx => ConnectorRow/index.tsx} (97%) rename packages/console/src/pages/Connectors/components/{SetupModal.module.scss => CreateForm/index.module.scss} (100%) rename packages/console/src/pages/Connectors/components/{SetupModal.tsx => CreateForm/index.tsx} (95%) diff --git a/packages/console/src/pages/ConnectorDetails/index.tsx b/packages/console/src/pages/ConnectorDetails/index.tsx index 5f34c8983..8ab8c4031 100644 --- a/packages/console/src/pages/ConnectorDetails/index.tsx +++ b/packages/console/src/pages/ConnectorDetails/index.tsx @@ -22,7 +22,7 @@ import More from '@/icons/More'; import Reset from '@/icons/Reset'; import * as detailsStyles from '@/scss/details.module.scss'; -import SetupModal from '../Connectors/components/SetupModal'; +import CreateForm from '../Connectors/components/CreateForm'; import SenderTester from './components/SenderTester'; import * as styles from './index.module.scss'; @@ -159,7 +159,7 @@ const ConnectorDetails = () => { {t('connector_details.options_delete')} - { diff --git a/packages/console/src/pages/Connectors/components/ConnectorName.module.scss b/packages/console/src/pages/Connectors/components/ConnectorName/index.module.scss similarity index 100% rename from packages/console/src/pages/Connectors/components/ConnectorName.module.scss rename to packages/console/src/pages/Connectors/components/ConnectorName/index.module.scss diff --git a/packages/console/src/pages/Connectors/components/ConnectorName.tsx b/packages/console/src/pages/Connectors/components/ConnectorName/index.tsx similarity index 94% rename from packages/console/src/pages/Connectors/components/ConnectorName.tsx rename to packages/console/src/pages/Connectors/components/ConnectorName/index.tsx index 15fe62738..8422a939c 100644 --- a/packages/console/src/pages/Connectors/components/ConnectorName.tsx +++ b/packages/console/src/pages/Connectors/components/ConnectorName/index.tsx @@ -6,7 +6,7 @@ import ImagePlaceholder from '@/components/ImagePlaceholder'; import ItemPreview from '@/components/ItemPreview'; import UnnamedTrans from '@/components/UnnamedTrans'; -import * as styles from './ConnectorName.module.scss'; +import * as styles from './index.module.scss'; type Props = { connector?: ConnectorDTO; diff --git a/packages/console/src/pages/Connectors/components/ConnectorRow.tsx b/packages/console/src/pages/Connectors/components/ConnectorRow/index.tsx similarity index 97% rename from packages/console/src/pages/Connectors/components/ConnectorRow.tsx rename to packages/console/src/pages/Connectors/components/ConnectorRow/index.tsx index 476afca37..cd6039796 100644 --- a/packages/console/src/pages/Connectors/components/ConnectorRow.tsx +++ b/packages/console/src/pages/Connectors/components/ConnectorRow/index.tsx @@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'; import Button from '@/components/Button'; import Status from '@/components/Status'; -import ConnectorName from './ConnectorName'; +import ConnectorName from '../ConnectorName'; type Props = { type: ConnectorType; diff --git a/packages/console/src/pages/Connectors/components/SetupModal.module.scss b/packages/console/src/pages/Connectors/components/CreateForm/index.module.scss similarity index 100% rename from packages/console/src/pages/Connectors/components/SetupModal.module.scss rename to packages/console/src/pages/Connectors/components/CreateForm/index.module.scss diff --git a/packages/console/src/pages/Connectors/components/SetupModal.tsx b/packages/console/src/pages/Connectors/components/CreateForm/index.tsx similarity index 95% rename from packages/console/src/pages/Connectors/components/SetupModal.tsx rename to packages/console/src/pages/Connectors/components/CreateForm/index.tsx index d77740271..71449c7a7 100644 --- a/packages/console/src/pages/Connectors/components/SetupModal.tsx +++ b/packages/console/src/pages/Connectors/components/CreateForm/index.tsx @@ -11,7 +11,7 @@ import UnnamedTrans from '@/components/UnnamedTrans'; import { RequestError } from '@/hooks/use-api'; import * as modalStyles from '@/scss/modal.module.scss'; -import * as styles from './SetupModal.module.scss'; +import * as styles from './index.module.scss'; type Props = { isOpen: boolean; @@ -19,7 +19,7 @@ type Props = { type?: ConnectorType; }; -const SetupModal = ({ isOpen, onClose, type }: Props) => { +const CreateForm = ({ isOpen, onClose, type }: Props) => { const [connectorId, setConnectorId] = useState(''); const { data, error } = useSWR('/api/connectors'); const isLoading = !data && !error; @@ -66,6 +66,7 @@ const SetupModal = ({ isOpen, onClose, type }: Props) => { /> } className={styles.body} + size="large" onClose={onClose} > {isLoading && 'Loading...'} @@ -103,4 +104,4 @@ const SetupModal = ({ isOpen, onClose, type }: Props) => { ); }; -export default SetupModal; +export default CreateForm; diff --git a/packages/console/src/pages/Connectors/index.tsx b/packages/console/src/pages/Connectors/index.tsx index d2efd4f1a..a12c6baff 100644 --- a/packages/console/src/pages/Connectors/index.tsx +++ b/packages/console/src/pages/Connectors/index.tsx @@ -16,7 +16,7 @@ import { RequestError } from '@/hooks/use-api'; import * as tableStyles from '@/scss/table.module.scss'; import ConnectorRow from './components/ConnectorRow'; -import SetupModal from './components/SetupModal'; +import CreateForm from './components/CreateForm'; import * as styles from './index.module.scss'; const Connectors = () => { @@ -124,7 +124,7 @@ const Connectors = () => { {data && ( - {