From 169ae556351ad2906f8467c927b4b059d4eaa107 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 2 Jul 2025 15:52:43 +0800 Subject: [PATCH] chore: finish filter --- .../(commonLayout)/apps/check-legacy/page.tsx | 20 +++++++++++-------- web/app/components/base/chip/index.tsx | 2 +- web/i18n/en-US/app.ts | 5 +++++ web/i18n/zh-Hans/app.ts | 5 +++++ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/web/app/(commonLayout)/apps/check-legacy/page.tsx b/web/app/(commonLayout)/apps/check-legacy/page.tsx index d886a28eb9..a110c877f1 100644 --- a/web/app/(commonLayout)/apps/check-legacy/page.tsx +++ b/web/app/(commonLayout)/apps/check-legacy/page.tsx @@ -6,8 +6,11 @@ import useLegacyList from './use-legacy-list' import Chip from '@/app/components/base/chip' import { RiFilter3Line } from '@remixicon/react' import { useCallback } from 'react' +import { useTranslation } from 'react-i18next' +const i18nPrefix = 'app.checkLegacy' const Page = () => { + const { t } = useTranslation() const { sort_by, setOrderBy, @@ -22,13 +25,14 @@ const Page = () => { const renderTriggerContent = useCallback(() => { if(published === undefined) - return 'Published' + return t(`${i18nPrefix}.published`) return ( -
- Published {published === 1 ? 'Yes' : 'No'} +
+
{t(`${i18nPrefix}.published`)}
+ {published === 1 ? t(`${i18nPrefix}.yes`) : t(`${i18nPrefix}.no`)}
) - }, [published]) + }, [published, t]) return (
@@ -44,8 +48,8 @@ const Page = () => { onSelect={handleSelectPublished} onClear={clearPublished} items={[ - { value: 1, name: 'Yes' }, - { value: 0, name: 'No' }, + { value: 1, name: t(`${i18nPrefix}.yes`) }, + { value: 0, name: t(`${i18nPrefix}.no`) }, ]} />
@@ -54,8 +58,8 @@ const Page = () => { order={sort_by?.startsWith('-') ? '-' : ''} value={sort_by?.replace('-', '') || 'created_at'} items={[ - { value: 'created_at', name: 'Created At' }, - { value: 'last_request', name: 'Last request' }, + { value: 'created_at', name: t(`${i18nPrefix}.createAt`) }, + { value: 'last_request', name: t(`${i18nPrefix}.lastRequest`) }, ]} onSelect={setOrderBy} /> diff --git a/web/app/components/base/chip/index.tsx b/web/app/components/base/chip/index.tsx index b0b0e38fef..cb2e1c61c8 100644 --- a/web/app/components/base/chip/index.tsx +++ b/web/app/components/base/chip/index.tsx @@ -75,7 +75,7 @@ const Chip: FC = ({
{!value && } - {!!value && ( + {(!!value || value === 0) && (
{ e.stopPropagation() onClear() diff --git a/web/i18n/en-US/app.ts b/web/i18n/en-US/app.ts index 4cd551c0fd..2321c64e55 100644 --- a/web/i18n/en-US/app.ts +++ b/web/i18n/en-US/app.ts @@ -236,6 +236,11 @@ const translation = { checkLegacy: { title: 'Apps affected by image upload legacy', description: 'The current workspace has {{num}} applications affected, {{publishedNum}} of which have been published.', + published: 'Published', + yes: 'Yes', + no: 'No', + createAt: 'Created At', + lastRequest: 'Last Request', }, } diff --git a/web/i18n/zh-Hans/app.ts b/web/i18n/zh-Hans/app.ts index 5a12691480..8122f2d33d 100644 --- a/web/i18n/zh-Hans/app.ts +++ b/web/i18n/zh-Hans/app.ts @@ -237,6 +237,11 @@ const translation = { checkLegacy: { title: '受图像上传遗留问题影响的应用', description: '当前工作区有 {{num}} 个应用受图像上传遗留问题影响,其中 {{publishedNum}} 个已发布。', + published: '已发布', + yes: '是', + no: '否', + createAt: '创建时间', + lastRequest: '最后请求', }, }