From 80ad81471baab34bafdf51a1258747c44d424f2f Mon Sep 17 00:00:00 2001 From: twwu Date: Wed, 22 Jan 2025 14:30:14 +0800 Subject: [PATCH] refactor: remove unused CSS files and update translations for Firecrawl and Jina Reader --- .../(commonLayout)/datasets/DatasetCard.tsx | 2 +- .../base/notion-page-selector/base.module.css | 4 - .../base/notion-page-selector/base.tsx | 30 +++--- .../page-selector/index.module.css | 17 ---- .../page-selector/index.tsx | 30 +++--- .../search-input/index.module.css | 15 --- .../search-input/index.tsx | 12 +-- .../workspace-selector/index.module.css | 5 - .../workspace-selector/index.tsx | 7 +- .../base/tag-management/selector.tsx | 10 +- .../index.module.css | 9 +- .../datasets/create/file-uploader/index.tsx | 2 +- .../datasets/create/step-one/index.module.css | 92 ++----------------- .../datasets/create/step-one/index.tsx | 21 ++++- .../website/base/checkbox-with-label.tsx | 2 +- .../datasets/rename-modal/index.tsx | 8 +- web/i18n/en-US/dataset-creation.ts | 2 + web/i18n/zh-Hans/dataset-creation.ts | 2 + web/tailwind.config.js | 1 + 19 files changed, 88 insertions(+), 183 deletions(-) delete mode 100644 web/app/components/base/notion-page-selector/base.module.css delete mode 100644 web/app/components/base/notion-page-selector/page-selector/index.module.css delete mode 100644 web/app/components/base/notion-page-selector/search-input/index.module.css diff --git a/web/app/(commonLayout)/datasets/DatasetCard.tsx b/web/app/(commonLayout)/datasets/DatasetCard.tsx index ad83a41dff..5180350f3f 100644 --- a/web/app/(commonLayout)/datasets/DatasetCard.tsx +++ b/web/app/(commonLayout)/datasets/DatasetCard.tsx @@ -192,7 +192,7 @@ const DatasetCard = ({ /> -
+
} diff --git a/web/app/components/base/notion-page-selector/base.module.css b/web/app/components/base/notion-page-selector/base.module.css deleted file mode 100644 index d9aa9fe359..0000000000 --- a/web/app/components/base/notion-page-selector/base.module.css +++ /dev/null @@ -1,4 +0,0 @@ -.setting-icon { - background: url(./assets/setting.svg) center center no-repeat; - background-size: 14px 14px; -} \ No newline at end of file diff --git a/web/app/components/base/notion-page-selector/base.tsx b/web/app/components/base/notion-page-selector/base.tsx index e3b321b120..a16be24ce7 100644 --- a/web/app/components/base/notion-page-selector/base.tsx +++ b/web/app/components/base/notion-page-selector/base.tsx @@ -1,10 +1,9 @@ import { useCallback, useEffect, useMemo, useState } from 'react' import useSWR from 'swr' -import s from './base.module.css' +import { RiEqualizer2Line } from '@remixicon/react' import WorkspaceSelector from './workspace-selector' import SearchInput from './search-input' import PageSelector from './page-selector' -import cn from '@/utils/classnames' import { preImportNotionPages } from '@/service/datasets' import { NotionConnector } from '@/app/components/datasets/create/step-one' import type { DataSourceNotionPageMap, DataSourceNotionWorkspace, NotionPage } from '@/models/common' @@ -88,23 +87,24 @@ const NotionPageSelector = ({ }, [firstWorkspaceId]) return ( -
+
{ data?.notion_info?.length ? ( <> -
- -
-
setShowAccountSettingModal({ payload: 'data-source', onCancelCallback: mutate })} - /> -
+
+
+ +
+ setShowAccountSettingModal({ payload: 'data-source', onCancelCallback: mutate })} + /> +
handleToggle(index)} - /> + > + { + current.expand + ? + : + } +
) } if (current.parent_id === 'root' || !pagesMap[current.parent_id]) { @@ -112,14 +118,12 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{ return (
{ @@ -135,7 +139,7 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{ src={current.page_icon} />
{current.page_name} @@ -143,7 +147,9 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{ { canPreview && (
handlePreview(index)}> {t('common.dataSource.notion.selector.preview')}
@@ -152,7 +158,7 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{ { searchValue && (
{breadCrumbs.join(' / ')} @@ -278,7 +284,7 @@ const PageSelector = ({ if (!currentDataList.length) { return ( -
+
{t('common.dataSource.notion.selector.noSearchResult')}
) diff --git a/web/app/components/base/notion-page-selector/search-input/index.module.css b/web/app/components/base/notion-page-selector/search-input/index.module.css deleted file mode 100644 index a65b7d5390..0000000000 --- a/web/app/components/base/notion-page-selector/search-input/index.module.css +++ /dev/null @@ -1,15 +0,0 @@ -.search-icon { - background: url(../assets/search.svg) center center; - background-size: 14px 14px; -} - -.clear-icon { - background: url(../assets/clear.svg) center center; - background-size: contain; -} - -.input-wrapper { - flex-basis: 200px; - width: 0; - box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05); -} \ No newline at end of file diff --git a/web/app/components/base/notion-page-selector/search-input/index.tsx b/web/app/components/base/notion-page-selector/search-input/index.tsx index 8bf55273b7..665d0cca4f 100644 --- a/web/app/components/base/notion-page-selector/search-input/index.tsx +++ b/web/app/components/base/notion-page-selector/search-input/index.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react' import type { ChangeEvent } from 'react' import { useTranslation } from 'react-i18next' -import s from './index.module.css' +import { RiCloseCircleFill, RiSearchLine } from '@remixicon/react' import cn from '@/utils/classnames' type SearchInputProps = { @@ -19,18 +19,18 @@ const SearchInput = ({ }, [onChange]) return ( -
-
+
+ ) => onChange(e.target.value)} placeholder={t('common.dataSource.notion.selector.searchPages') || ''} /> { value && ( -
) diff --git a/web/app/components/base/notion-page-selector/workspace-selector/index.module.css b/web/app/components/base/notion-page-selector/workspace-selector/index.module.css index b68e1561e9..7939c14628 100644 --- a/web/app/components/base/notion-page-selector/workspace-selector/index.module.css +++ b/web/app/components/base/notion-page-selector/workspace-selector/index.module.css @@ -1,8 +1,3 @@ -.down-arrow { - background: url(../assets/down-arrow.svg) center center no-repeat; - background-size: cover; -} - .popup { box-shadow: 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03); z-index: 10; diff --git a/web/app/components/base/notion-page-selector/workspace-selector/index.tsx b/web/app/components/base/notion-page-selector/workspace-selector/index.tsx index 66227d4f4d..0d0619c693 100644 --- a/web/app/components/base/notion-page-selector/workspace-selector/index.tsx +++ b/web/app/components/base/notion-page-selector/workspace-selector/index.tsx @@ -2,6 +2,7 @@ import { useTranslation } from 'react-i18next' import { Fragment } from 'react' import { Menu, Transition } from '@headlessui/react' +import { RiArrowDownSLine } from '@remixicon/react' import NotionIcon from '../../notion-icon' import s from './index.module.css' import cn from '@/utils/classnames' @@ -31,9 +32,9 @@ export default function WorkspaceSelector({ src={currentWorkspace?.workspace_icon} name={currentWorkspace?.workspace_name} /> -
{currentWorkspace?.workspace_name}
-
{currentWorkspace?.pages.length}
-
+
{currentWorkspace?.workspace_name}
+
{currentWorkspace?.pages.length}
+ = ({ const Trigger = () => { return (
- -
+ +
{!triggerContent ? t('common.tag.addTag') : triggerContent}
@@ -260,8 +260,8 @@ const TagSelector: FC = ({ btnElement={} btnClassName={open => cn( - open ? '!bg-gray-100 !text-gray-700' : '!bg-transparent', - '!w-full !p-0 !border-0 !text-gray-500 hover:!bg-gray-100 hover:!text-gray-700', + open ? '!bg-components-input-bg-normal' : '!bg-transparent', + '!w-full !p-0 !border-0 hover:!bg-state-base-hover', ) } popupClassName='!w-full !ring-0' diff --git a/web/app/components/datasets/create/empty-dataset-creation-modal/index.module.css b/web/app/components/datasets/create/empty-dataset-creation-modal/index.module.css index 37f971eb9d..3131c9ee35 100644 --- a/web/app/components/datasets/create/empty-dataset-creation-modal/index.module.css +++ b/web/app/components/datasets/create/empty-dataset-creation-modal/index.module.css @@ -6,11 +6,10 @@ @apply flex items-center place-content-between h-8; } .modalHeader .title { - @apply grow; + @apply grow text-text-primary; font-weight: 600; font-size: 20px; line-height: 32px; - color: #101828; } .modalHeader .close { @apply shrink-0 h-4 w-4 bg-center bg-no-repeat cursor-pointer; @@ -19,20 +18,18 @@ } .modal .tip { - @apply mt-1 mb-8; + @apply mt-1 mb-8 text-text-tertiary; font-weight: 400; font-size: 13px; line-height: 18px; - color: #667085; } .form { @apply mb-8; } .form .label { - @apply mb-2; + @apply mb-2 text-text-primary; font-weight: 500; font-size: 14px; line-height: 20px; - color: #101828; } diff --git a/web/app/components/datasets/create/file-uploader/index.tsx b/web/app/components/datasets/create/file-uploader/index.tsx index e42a24cfef..0271e8e508 100644 --- a/web/app/components/datasets/create/file-uploader/index.tsx +++ b/web/app/components/datasets/create/file-uploader/index.tsx @@ -256,7 +256,7 @@ const FileUploader = ({ /> )} -
{t('datasetCreation.stepOne.uploader.title')}
+
{t('datasetCreation.stepOne.uploader.title')}
{!hideUpload && (
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 bb8dd9b895..9658724a89 100644 --- a/web/app/components/datasets/create/step-one/index.module.css +++ b/web/app/components/datasets/create/step-one/index.module.css @@ -3,9 +3,6 @@ top: 0; left: 0; padding: 42px 64px 12px 0; - font-weight: 600; - font-size: 18px; - line-height: 28px; } .form { @@ -14,38 +11,22 @@ } .dataSourceItem { - @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; - font-size: 14px; - line-height: 20px; - color: #101828; + @apply relative grow shrink-0 flex items-center p-3 h-14 bg-components-option-card-option-bg rounded-xl + cursor-pointer border border-components-option-card-option-border text-text-secondary; } .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); + @apply bg-components-option-card-option-bg-hover border border-components-option-card-option-border-hover shadow-xs shadow-shadow-shadow-3; } .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; + @apply bg-components-option-card-option-selected-bg border border-components-option-card-option-selected-border + shadow-emulate-border shadow-components-option-card-option-selected-border; } +.dataSourceItem.disabled, .dataSourceItem.disabled:hover { - background-color: #f9fafb; - border: 0.5px solid #EAECF0; - box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05); + @apply bg-components-option-card-option-bg border-[0.5px] border-components-option-card-option-border cursor-not-allowed text-text-disabled shadow-none; } .comingTag { @@ -64,17 +45,9 @@ } .datasetIcon { - @apply flex mr-2 w-8 h-8 rounded-lg bg-center bg-no-repeat; - background-color: #F5FAFF; + @apply flex mr-2 w-8 h-8 rounded-lg bg-center bg-no-repeat bg-text-primary-on-surface border-[0.5px] border-divider-regular backdrop-blur-sm; background-image: url(../assets/file.svg); background-size: 16px; - border: 0.5px solid #D1E9FF; -} - -.dataSourceItem:active .datasetIcon, -.dataSourceItem:hover .datasetIcon { - background-color: #F5F8FF; - border: 0.5px solid #E0EAFF; } .datasetIcon.notion { @@ -97,54 +70,7 @@ background-color: #eaecf0; } -.notionConnectionTip { - display: flex; - flex-direction: column; - align-items: flex-start; - padding: 24px; - width: 640px; - background: #F9FAFB; - border-radius: 16px; -} - .notionIcon { - display: flex; - padding: 12px; - width: 48px; - height: 48px; - background: #fff center no-repeat url(../assets/notion.svg); + background: var(--color-components-card-bg) center no-repeat url(../assets/notion.svg); background-size: 24px; - border: 0.5px solid #EAECF5; - box-shadow: 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03); - border-radius: 12px; -} - -.notionConnectionTip .title { - position: relative; - margin: 24px 0 4px; - font-style: normal; - font-weight: 600; - font-size: 16px; - line-height: 24px; - color: #374151; -} - -.notionConnectionTip .title::after { - content: ''; - position: absolute; - top: -6px; - right: -12px; - width: 16px; - height: 16px; - background: center no-repeat url(../assets/Icon-3-dots.svg); - background-size: contain; -} - -.notionConnectionTip .tip { - margin-bottom: 20px; - font-style: normal; - font-weight: 400; - 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 2cca003b39..c5c79d4b62 100644 --- a/web/app/components/datasets/create/step-one/index.tsx +++ b/web/app/components/datasets/create/step-one/index.tsx @@ -19,6 +19,7 @@ import { useDatasetDetailContext } from '@/context/dataset-detail' import { useProviderContext } from '@/context/provider-context' import VectorSpaceFull from '@/app/components/billing/vector-space-full' import classNames from '@/utils/classnames' +import { Icon3Dots } from '@/app/components/base/icons/src/vender/line/others' type IStepOneProps = { datasetId?: string @@ -48,10 +49,15 @@ export const NotionConnector = ({ onSetting }: NotionConnectorProps) => { const { t } = useTranslation() return ( -
- -
{t('datasetCreation.stepOne.notionSyncTitle')}
-
{t('datasetCreation.stepOne.notionSyncTip')}
+
+ +
+ + {t('datasetCreation.stepOne.notionSyncTitle')} + + +
{t('datasetCreation.stepOne.notionSyncTip')}
+
) @@ -132,7 +138,9 @@ const StepOne = ({
{ shouldShowDataSourceTypeList && ( -
{t('datasetCreation.steps.one')}
+
+ {t('datasetCreation.steps.one')} +
) } { @@ -141,6 +149,7 @@ const StepOne = ({
= ({ return (