chore: finish filter

This commit is contained in:
Joel 2025-07-02 15:52:43 +08:00
parent 015ce09593
commit 169ae55635
4 changed files with 23 additions and 9 deletions

View File

@ -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 (
<div>
Published <span>{published === 1 ? 'Yes' : 'No'}</span>
<div className='flex space-x-1'>
<div>{t(`${i18nPrefix}.published`)}</div>
<span className='system-sm-medium text-text-secondary'>{published === 1 ? t(`${i18nPrefix}.yes`) : t(`${i18nPrefix}.no`)}</span>
</div>
)
}, [published])
}, [published, t])
return (
<div className='h-full rounded-t-2xl border-t border-effects-highlight bg-background-default-subtle px-6 pt-4'>
@ -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`) },
]}
/>
<div className='h-3.5 w-px bg-divider-regular'></div>
@ -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}
/>

View File

@ -75,7 +75,7 @@ const Chip: FC<Props> = ({
</div>
</div>
{!value && <RiArrowDownSLine className='h-4 w-4 text-text-tertiary' />}
{!!value && (
{(!!value || value === 0) && (
<div className='group/clear cursor-pointer p-[1px]' onClick={(e) => {
e.stopPropagation()
onClear()

View File

@ -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',
},
}

View File

@ -237,6 +237,11 @@ const translation = {
checkLegacy: {
title: '受图像上传遗留问题影响的应用',
description: '当前工作区有 {{num}} 个应用受图像上传遗留问题影响,其中 {{publishedNum}} 个已发布。',
published: '已发布',
yes: '是',
no: '否',
createAt: '创建时间',
lastRequest: '最后请求',
},
}