♻️ refactor: Enhance log pages with Badge component and update translations

This commit is contained in:
web
2025-09-05 07:14:57 -07:00
parent d7f8b3b707
commit a4de9df1fc
32 changed files with 356 additions and 158 deletions
@@ -6,6 +6,7 @@ import { OrderLink } from '@/components/order-link';
import { ProTable } from '@/components/pro-table';
import { filterGiftLog } from '@/services/admin/log';
import { formatDate } from '@/utils/common';
import { Badge } from '@workspace/ui/components/badge';
import { useTranslations } from 'next-intl';
import { useSearchParams } from 'next/navigation';
@@ -16,6 +17,14 @@ export default function GiftLogPage() {
// 获取今日日期作为默认值
const today = new Date().toISOString().split('T')[0];
const getGiftTypeText = (type: number) => {
const typeText = t(`type.${type}`);
if (typeText === `log.type.${type}`) {
return `${t('unknown')} (${type})`;
}
return typeText;
};
const initialFilters = {
date: sp.get('date') || today,
user_id: sp.get('user_id') ? Number(sp.get('user_id')) : undefined,
@@ -52,6 +61,11 @@ export default function GiftLogPage() {
header: t('column.balance'),
cell: ({ row }) => <Display type='currency' value={row.original.balance} />,
},
{
accessorKey: 'type',
header: t('column.type'),
cell: ({ row }) => <Badge>{getGiftTypeText(row.original.type)}</Badge>,
},
{ accessorKey: 'remark', header: t('column.remark') },
{
accessorKey: 'timestamp',