♻️ 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
@@ -5,6 +5,7 @@ import { OrderLink } from '@/components/order-link';
import { ProTable } from '@/components/pro-table';
import { filterResetSubscribeLog } 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';
@@ -14,6 +15,14 @@ export default function ResetSubscribeLogPage() {
const today = new Date().toISOString().split('T')[0];
const getResetSubscribeTypeText = (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_subscribe_id: sp.get('user_subscribe_id')
@@ -37,7 +46,11 @@ export default function ResetSubscribeLogPage() {
<UserSubscribeDetail id={Number(row.original.user_subscribe_id)} enabled hoverCard />
),
},
{ accessorKey: 'type', header: t('column.type') },
{
accessorKey: 'type',
header: t('column.type'),
cell: ({ row }) => <Badge>{getResetSubscribeTypeText(row.original.type)}</Badge>,
},
{
accessorKey: 'order_no',
header: t('column.orderNo'),