refactor(ui): Improve usage log filter responsiveness and mobile UX

Refactor the usage log filter toolbar into a shared reusable component for common, drawing, and task logs. Optimize desktop filters with a responsive grid, move secondary filters into a mobile drawer, standardize filter typography, remove redundant filter icons, and add the missing i18n translations for the new drawer description.
This commit is contained in:
t0ng7u
2026-05-25 05:35:44 +08:00
parent b302be30e3
commit 583da45296
79 changed files with 1879 additions and 1262 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ function RootComponent() {
<ThemeCustomizationProvider>
<NavigationProgress />
<Outlet />
<Toaster duration={5000} />
<Toaster closeButton duration={5000} position='top-center' richColors />
{import.meta.env.MODE === 'development' && (
<>
<ReactQueryDevtools buttonPosition='bottom-left' />
@@ -25,11 +25,20 @@ import {
} from '@/features/usage-logs/section-registry'
const logTypeValues = ['0', '1', '2', '3', '4', '5', '6'] as const
const logTypeSearchSchema = z
.preprocess(
(value) => {
if (value == null || value === '') return undefined
return Array.isArray(value) ? value : [value]
},
z.array(z.enum(logTypeValues)).optional()
)
.catch([])
const usageLogsSearchSchema = z.object({
page: z.number().optional().catch(1),
pageSize: z.number().optional().catch(undefined),
type: z.array(z.enum(logTypeValues)).optional().catch([]),
type: logTypeSearchSchema,
filter: z.string().optional().catch(''),
model: z.string().optional().catch(''),
token: z.string().optional().catch(''),
@@ -51,11 +60,10 @@ export const Route = createFileRoute('/_authenticated/usage-logs/$section')({
})
}
// type 仅 common 使用,非 common 时清掉 URL 里的 type
if (
params.section !== 'common' &&
Array.isArray(search?.type) &&
(search?.type?.length ?? 0) > 0
) {
const hasTypeSearch = Array.isArray(search?.type)
? search.type.length > 0
: search?.type != null && search.type !== ''
if (params.section !== 'common' && hasTypeSearch) {
throw redirect({
to: '/usage-logs/$section',
params: { section: params.section },