From a01a28997ed989bab60f69387846785dd334b4b4 Mon Sep 17 00:00:00 2001 From: NFish Date: Mon, 16 Dec 2024 17:54:48 +0800 Subject: [PATCH] fix: update datasource Step1 style --- .../create/file-preview/index.module.css | 2 +- .../datasets/create/step-one/index.module.css | 17 +- .../datasets/create/step-one/index.tsx | 302 +++++++++--------- .../datasets/create/stepper/index.tsx | 2 +- .../datasets/create/stepper/step.tsx | 13 +- .../datasets/create/top-bar/index.tsx | 4 +- web/i18n/en-US/app.ts | 2 +- web/i18n/en-US/dataset-creation.ts | 11 +- 8 files changed, 185 insertions(+), 168 deletions(-) diff --git a/web/app/components/datasets/create/file-preview/index.module.css b/web/app/components/datasets/create/file-preview/index.module.css index d87522e6d0..2ddc73160b 100644 --- a/web/app/components/datasets/create/file-preview/index.module.css +++ b/web/app/components/datasets/create/file-preview/index.module.css @@ -1,6 +1,6 @@ .filePreview { @apply flex flex-col border-l border-gray-200 shrink-0; - width: 528px; + width: 50%; background-color: #fcfcfd; } diff --git a/web/app/components/datasets/create/step-one/index.module.css b/web/app/components/datasets/create/step-one/index.module.css index a76e951d5d..811728315a 100644 --- a/web/app/components/datasets/create/step-one/index.module.css +++ b/web/app/components/datasets/create/step-one/index.module.css @@ -2,7 +2,7 @@ position: sticky; top: 0; left: 0; - padding: 42px 64px 12px; + padding: 42px 64px 12px 0; font-weight: 600; font-size: 18px; line-height: 28px; @@ -14,7 +14,7 @@ } .dataSourceItem { - @apply box-border relative shrink-0 flex items-center mr-3 p-3 h-14 bg-white rounded-xl cursor-pointer; + @apply box-border relative grow shrink-0 flex items-center p-3 h-14 bg-white rounded-xl cursor-pointer; border: 0.5px solid #EAECF0; box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05); font-weight: 500; @@ -22,27 +22,32 @@ line-height: 20px; color: #101828; } + .dataSourceItem:hover { background-color: #f5f8ff; border: 0.5px solid #B2CCFF; box-shadow: 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03); } + .dataSourceItem.active { background-color: #f5f8ff; border: 1.5px solid #528BFF; box-shadow: 0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 2px rgba(16, 24, 40, 0.06); } + .dataSourceItem.disabled { background-color: #f9fafb; border: 0.5px solid #EAECF0; box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05); cursor: default; } + .dataSourceItem.disabled:hover { background-color: #f9fafb; border: 0.5px solid #EAECF0; box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05); } + .comingTag { @apply flex justify-center items-center bg-white; position: absolute; @@ -57,6 +62,7 @@ line-height: 18px; color: #444CE7; } + .datasetIcon { @apply flex mr-2 w-8 h-8 rounded-lg bg-center bg-no-repeat; background-color: #F5FAFF; @@ -64,15 +70,18 @@ background-size: 16px; border: 0.5px solid #D1E9FF; } + .dataSourceItem:active .datasetIcon, .dataSourceItem:hover .datasetIcon { background-color: #F5F8FF; border: 0.5px solid #E0EAFF; } + .datasetIcon.notion { background-image: url(../assets/notion.svg); background-size: 20px; } + .datasetIcon.web { background-image: url(../assets/web.svg); } @@ -119,6 +128,7 @@ line-height: 24px; color: #374151; } + .notionConnectionTip .title::after { content: ''; position: absolute; @@ -129,6 +139,7 @@ background: center no-repeat url(../assets/Icon-3-dots.svg); background-size: contain; } + .notionConnectionTip .tip { margin-bottom: 20px; font-style: normal; @@ -136,4 +147,4 @@ font-size: 13px; line-height: 18px; color: #6B7280; -} +} \ No newline at end of file diff --git a/web/app/components/datasets/create/step-one/index.tsx b/web/app/components/datasets/create/step-one/index.tsx index 5c492c7902..7793fcfafc 100644 --- a/web/app/components/datasets/create/step-one/index.tsx +++ b/web/app/components/datasets/create/step-one/index.tsx @@ -127,161 +127,163 @@ const StepOne = ({ return (
-
- { - shouldShowDataSourceTypeList && ( -
{t('datasetCreation.steps.one')}
- ) - } -
- { - shouldShowDataSourceTypeList && ( -
-
{ - if (dataSourceTypeDisable) - return - changeType(DataSourceType.FILE) - hideFilePreview() - hideNotionPagePreview() - }} - > - - {t('datasetCreation.stepOne.dataSourceType.file')} -
-
{ - if (dataSourceTypeDisable) - return - changeType(DataSourceType.NOTION) - hideFilePreview() - hideNotionPagePreview() - }} - > - - {t('datasetCreation.stepOne.dataSourceType.notion')} -
-
changeType(DataSourceType.WEB)} - > - - {t('datasetCreation.stepOne.dataSourceType.web')} -
-
- ) - } - {dataSourceType === DataSourceType.FILE && ( - <> - - {isShowVectorSpaceFull && ( -
- -
- )} -
- {/* */} - -
- - )} - {dataSourceType === DataSourceType.NOTION && ( - <> - {!hasConnection && } - {hasConnection && ( - <> -
- page.page_id)} - onSelect={updateNotionPages} - onPreview={updateCurrentPage} - /> +
+
+
+ { + shouldShowDataSourceTypeList && ( +
{t('datasetCreation.steps.one')}
+ ) + } + { + shouldShowDataSourceTypeList && ( +
+
{ + if (dataSourceTypeDisable) + return + changeType(DataSourceType.FILE) + hideFilePreview() + hideNotionPagePreview() + }} + > + + {t('datasetCreation.stepOne.dataSourceType.file')}
- {isShowVectorSpaceFull && ( -
- -
- )} -
- {/* */} - +
{ + if (dataSourceTypeDisable) + return + changeType(DataSourceType.NOTION) + hideFilePreview() + hideNotionPagePreview() + }} + > + + {t('datasetCreation.stepOne.dataSourceType.notion')}
- - )} - - )} - {dataSourceType === DataSourceType.WEB && ( - <> -
- changeType(DataSourceType.WEB)} + > + + {t('datasetCreation.stepOne.dataSourceType.web')} +
+
+ ) + } + {dataSourceType === DataSourceType.FILE && ( + <> + -
- {isShowVectorSpaceFull && ( -
- + {isShowVectorSpaceFull && ( +
+ +
+ )} +
+ {/* */} +
- )} -
- {/* */} - -
- - )} - {!datasetId && ( - <> -
- - - {t('datasetCreation.stepOne.emptyDatasetCreation')} - - - )} + + )} + {dataSourceType === DataSourceType.NOTION && ( + <> + {!hasConnection && } + {hasConnection && ( + <> +
+ page.page_id)} + onSelect={updateNotionPages} + onPreview={updateCurrentPage} + /> +
+ {isShowVectorSpaceFull && ( +
+ +
+ )} +
+ {/* */} + +
+ + )} + + )} + {dataSourceType === DataSourceType.WEB && ( + <> +
+ +
+ {isShowVectorSpaceFull && ( +
+ +
+ )} +
+ {/* */} + +
+ + )} + {!datasetId && ( + <> +
+ + + {t('datasetCreation.stepOne.emptyDatasetCreation')} + + + )} +
+
-
{currentFile && } {currentNotionPage && } diff --git a/web/app/components/datasets/create/stepper/index.tsx b/web/app/components/datasets/create/stepper/index.tsx index 30cf9bd0e4..317c1a76ee 100644 --- a/web/app/components/datasets/create/stepper/index.tsx +++ b/web/app/components/datasets/create/stepper/index.tsx @@ -19,7 +19,7 @@ export const Stepper: FC = (props) => { activeIndex={activeIndex} index={index} /> - {!isLast &&
} + {!isLast &&
} ) })} diff --git a/web/app/components/datasets/create/stepper/step.tsx b/web/app/components/datasets/create/stepper/step.tsx index 69f524ea66..c230de1a6e 100644 --- a/web/app/components/datasets/create/stepper/step.tsx +++ b/web/app/components/datasets/create/stepper/step.tsx @@ -21,27 +21,26 @@ export const StepperStep: FC = (props) => { isActive ? 'bg-state-accent-solid' : !isDisabled - ? 'border border-text-tertiary' + ? 'border border-text-quaternary' : 'border border-divider-deep', )}>
{label}
-
{name}
} diff --git a/web/app/components/datasets/create/top-bar/index.tsx b/web/app/components/datasets/create/top-bar/index.tsx index 74be673efd..1488d57b8d 100644 --- a/web/app/components/datasets/create/top-bar/index.tsx +++ b/web/app/components/datasets/create/top-bar/index.tsx @@ -18,10 +18,10 @@ const STEP_T_MAP: Record = { export const Topbar: FC = (props) => { const { className, ...rest } = props const { t } = useTranslation() - return
+ return
-

+

{t('datasetCreation.steps.header.creation')}

diff --git a/web/i18n/en-US/app.ts b/web/i18n/en-US/app.ts index 704f37bf52..4978bed69b 100644 --- a/web/i18n/en-US/app.ts +++ b/web/i18n/en-US/app.ts @@ -98,7 +98,7 @@ const translation = { removeOriginal: 'Delete the original app', switchStart: 'Start switch', typeSelector: { - all: 'ALL Types', + all: 'All Types', chatbot: 'Chatbot', agent: 'Agent', workflow: 'Workflow', diff --git a/web/i18n/en-US/dataset-creation.ts b/web/i18n/en-US/dataset-creation.ts index a05a683d0f..1f6e257648 100644 --- a/web/i18n/en-US/dataset-creation.ts +++ b/web/i18n/en-US/dataset-creation.ts @@ -4,9 +4,9 @@ const translation = { creation: 'Create Knowledge', update: 'Add data', }, - one: 'Choose data source', - two: 'Text Preprocessing and Cleaning', - three: 'Execute and finish', + one: 'Data Source', + two: 'Document Processing', + three: 'Execute & Finish', }, error: { unavailable: 'This Knowledge is not available', @@ -190,6 +190,11 @@ const translation = { modelButtonConfirm: 'Confirm', modelButtonCancel: 'Cancel', }, + otherDataSource: { + title: 'Connect to other data sources?', + description: 'Currently, Dify\'s knowledge base only has limited data sources. Contributing a data source to the Dify knowledge base is a fantastic way to help enhance the platform\'s flexibility and power for all users. Our contribution guide makes it easy to get started. Please click on the link below to learn more.', + learnMore: 'Learn more', + }, } export default translation