From 4757db1b6be2436568c1d2efe70797c081676919 Mon Sep 17 00:00:00 2001 From: AkaraChen Date: Tue, 26 Nov 2024 14:18:42 +0800 Subject: [PATCH] refactor: use css var --- .../common/retrieval-method-config/index.tsx | 3 ++- .../common/retrieval-method-info/index.tsx | 2 +- web/app/components/datasets/create/index.tsx | 2 +- .../datasets/create/step-two/index.tsx | 14 +++++------ .../datasets/create/step-two/inputs.tsx | 2 +- .../datasets/create/step-two/option-card.tsx | 8 +++---- .../datasets/create/stepper/index.tsx | 8 +++---- .../datasets/create/stepper/step.tsx | 24 +++++++++++++++---- .../detail/batch-modal/csv-downloader.tsx | 2 +- .../documents/detail/metadata/index.tsx | 2 +- .../documents/detail/segment-add/index.tsx | 4 ++-- .../hit-testing/modify-retrieval-modal.tsx | 2 +- .../datasets/settings/form/index.tsx | 2 +- 13 files changed, 45 insertions(+), 30 deletions(-) diff --git a/web/app/components/datasets/common/retrieval-method-config/index.tsx b/web/app/components/datasets/common/retrieval-method-config/index.tsx index 5a17b73569..6509ed995c 100644 --- a/web/app/components/datasets/common/retrieval-method-config/index.tsx +++ b/web/app/components/datasets/common/retrieval-method-config/index.tsx @@ -17,6 +17,7 @@ import { RerankingModeEnum, WeightedScoreEnum, } from '@/models/datasets' +import Badge from '@/app/components/base/badge' type Props = { value: RetrievalConfig @@ -103,7 +104,7 @@ const RetrievalMethodConfig: FC = ({ title={
{t('dataset.retrieval.hybrid_search.title')}
-
{t('dataset.retrieval.hybrid_search.recommend')}
+
} description={t('dataset.retrieval.hybrid_search.description')} isActive={ diff --git a/web/app/components/datasets/common/retrieval-method-info/index.tsx b/web/app/components/datasets/common/retrieval-method-info/index.tsx index 7d9b999c53..5b30675652 100644 --- a/web/app/components/datasets/common/retrieval-method-info/index.tsx +++ b/web/app/components/datasets/common/retrieval-method-info/index.tsx @@ -32,7 +32,7 @@ const EconomicalRetrievalMethodConfig: FC = ({ return (
} + icon={} title={t(`dataset.retrieval.${type}.title`)} description={t(`dataset.retrieval.${type}.description`)} noRadio diff --git a/web/app/components/datasets/create/index.tsx b/web/app/components/datasets/create/index.tsx index 3829abe27b..f2f869b704 100644 --- a/web/app/components/datasets/create/index.tsx +++ b/web/app/components/datasets/create/index.tsx @@ -124,7 +124,7 @@ const DatasetUpdateForm = ({ datasetId }: DatasetUpdateFormProps) => { return (
- +
= (props) => { - return + return } const FormField: FC> = (props) => { @@ -779,7 +779,7 @@ const StepTwo = ({ {t('datasetCreation.stepTwo.childChunkForRetrieval')} -
+
setParentChildConfig({ @@ -841,7 +841,7 @@ const StepTwo = ({ setIndexType(IndexingType.QUALIFIED) }} > -
+
Gold Icon
{!hasSetIndexType && } @@ -872,7 +872,7 @@ const StepTwo = ({ )} onClick={changeToEconomicalType} > -
+
Economical Icon
{!hasSetIndexType && } @@ -886,7 +886,7 @@ const StepTwo = ({ {hasSetIndexType && indexType === IndexingType.ECONOMICAL && (
{t('datasetCreation.stepTwo.indexSettingTip')} - {t('datasetCreation.stepTwo.datasetSettingLink')} + {t('datasetCreation.stepTwo.datasetSettingLink')}
)} {IS_CE_EDITION && indexType === IndexingType.QUALIFIED && ( @@ -931,7 +931,7 @@ const StepTwo = ({ {!!datasetId && (
{t('datasetCreation.stepTwo.indexSettingTip')} - {t('datasetCreation.stepTwo.datasetSettingLink')} + {t('datasetCreation.stepTwo.datasetSettingLink')}
)}
@@ -943,7 +943,7 @@ const StepTwo = ({
{t('datasetSettings.form.retrievalSetting.title')}
diff --git a/web/app/components/datasets/create/step-two/inputs.tsx b/web/app/components/datasets/create/step-two/inputs.tsx index 899f5b120c..7a35db9153 100644 --- a/web/app/components/datasets/create/step-two/inputs.tsx +++ b/web/app/components/datasets/create/step-two/inputs.tsx @@ -7,7 +7,7 @@ import type { InputNumberProps } from '@/app/components/base/input-number' import { InputNumber } from '@/app/components/base/input-number' const TextLabel: FC = (props) => { - return + return } const FormField: FC> = (props) => { diff --git a/web/app/components/datasets/create/step-two/option-card.tsx b/web/app/components/datasets/create/step-two/option-card.tsx index 96263d51a0..5aa398f0f2 100644 --- a/web/app/components/datasets/create/step-two/option-card.tsx +++ b/web/app/components/datasets/create/step-two/option-card.tsx @@ -27,7 +27,7 @@ export const OptionCardHeader: FC = (props) => { )}>
{isActive && } -
+
{icon || {description}}
@@ -35,8 +35,8 @@ export const OptionCardHeader: FC = (props) => { className='absolute left-4 -bottom-1.5' />
-
{title}
-
{description}
+
{title}
+
{description}
} @@ -57,7 +57,7 @@ export const OptionCard: FC = (props) => { return
(array: T[], sep: R): Array { @@ -17,18 +17,18 @@ function join(array: T[], sep: R): Array { } export const Stepper: FC = (props) => { - const { steps, activeStepIndex } = props + const { steps, activeIndex } = props return
{join( steps.map((step, index) => ( )), -
, +
, )}
} diff --git a/web/app/components/datasets/create/stepper/step.tsx b/web/app/components/datasets/create/stepper/step.tsx index 8ab77650d5..ff0dd066ab 100644 --- a/web/app/components/datasets/create/stepper/step.tsx +++ b/web/app/components/datasets/create/stepper/step.tsx @@ -7,27 +7,41 @@ export type Step = { export type StepperStepProps = Step & { index: number - isActive: boolean + activeIndex: number } export const StepperStep: FC = (props) => { - const { name, isActive, index } = props + const { name, activeIndex, index } = props + const isActive = index === activeIndex + const isDisabled = activeIndex < index const label = isActive ? `STEP ${index + 1}` : `${index + 1}` return
{label}
{name}
} diff --git a/web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx b/web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx index 36216aa7c8..d340f90deb 100644 --- a/web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx +++ b/web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx @@ -97,7 +97,7 @@ const CSVDownload: FC<{ docForm: DocForm }> = ({ docForm }) => { bom={true} data={getTemplate()} > -
+
{t('datasetDocuments.list.batchModal.template')}
diff --git a/web/app/components/datasets/documents/detail/metadata/index.tsx b/web/app/components/datasets/documents/detail/metadata/index.tsx index 27b1c27db6..6c1d749a28 100644 --- a/web/app/components/datasets/documents/detail/metadata/index.tsx +++ b/web/app/components/datasets/documents/detail/metadata/index.tsx @@ -352,7 +352,7 @@ const Metadata: FC = ({ docDetail, loading, onUpdate }) => { ยท
{ setShowDocTypes(true) }} - className='cursor-pointer hover:text-[#155EEF]' + className='cursor-pointer hover:text-text-accent' > {t('common.operation.change')}
diff --git a/web/app/components/datasets/documents/detail/segment-add/index.tsx b/web/app/components/datasets/documents/detail/segment-add/index.tsx index 486154e859..c1cb0629ed 100644 --- a/web/app/components/datasets/documents/detail/segment-add/index.tsx +++ b/web/app/components/datasets/documents/detail/segment-add/index.tsx @@ -50,14 +50,14 @@ const SegmentAdd: FC = ({
{t('datasetDocuments.list.batchModal.completed')} - {t('datasetDocuments.list.batchModal.ok')} + {t('datasetDocuments.list.batchModal.ok')}
)} {importStatus === ProcessStatus.ERROR && (
{t('datasetDocuments.list.batchModal.error')} - {t('datasetDocuments.list.batchModal.ok')} + {t('datasetDocuments.list.batchModal.ok')}
)} diff --git a/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx b/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx index 1fc5b68d67..f4f1d05598 100644 --- a/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx +++ b/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx @@ -77,7 +77,7 @@ const ModifyRetrievalModal: FC = ({
{t('datasetSettings.form.retrievalSetting.title')}
diff --git a/web/app/components/datasets/settings/form/index.tsx b/web/app/components/datasets/settings/form/index.tsx index b93ebd0115..7ce31986c1 100644 --- a/web/app/components/datasets/settings/form/index.tsx +++ b/web/app/components/datasets/settings/form/index.tsx @@ -305,7 +305,7 @@ const Form = () => {
{t('datasetSettings.form.retrievalSetting.title')}