♻️ 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

View File

@ -45,7 +45,7 @@ English
> **Article 19.**
> Everyone has the right to freedom of opinion and expression; this right includes freedom to hold opinions without interference and to seek, receive and impart information and ideas through any media and regardless of frontiers.
>
> *Source: [United Nations Universal Declaration of Human Rights (UN.org)](https://www.un.org/sites/un2.un.org/files/2021/03/udhr.pdf)*
> _Source: [United Nations Universal Declaration of Human Rights (UN.org)](https://www.un.org/sites/un2.un.org/files/2021/03/udhr.pdf)_
## 📦 Application List

View File

@ -36,16 +36,16 @@
> **第一条**
> 人人生而自由,在尊严与权利上一律平等。
> 他们赋有理性与良知,应当以兄弟般的精神彼此相待。
> 他们赋有理性与良知,应当以兄弟般的精神彼此相待。
>
> **第十二条**
> 任何人的隐私、家庭、住宅和通信不得任意干涉,其名誉与荣誉不得加以攻击。
> 人人有权受到法律的保护,以免遭受这种干涉或攻击。
> 人人有权受到法律的保护,以免遭受这种干涉或攻击。
>
> **第十九条**
> 人人有思想与表达的自由;此项自由包括持有主张而不受干预,以及通过任何媒介、无论国界,自由寻求、接受和传播信息与思想。
> 人人有思想与表达的自由;此项自由包括持有主张而不受干预,以及通过任何媒介、无论国界,自由寻求、接受和传播信息与思想。
>
> *来源: [United Nations Universal Declaration of Human Rights (UN.org)](https://www.un.org/sites/un2.un.org/files/2021/03/udhr.pdf)*
> _来源: [United Nations Universal Declaration of Human Rights (UN.org)](https://www.un.org/sites/un2.un.org/files/2021/03/udhr.pdf)_
## 📦 Application List

View File

@ -6,6 +6,7 @@ import { OrderLink } from '@/components/order-link';
import { ProTable } from '@/components/pro-table';
import { filterBalanceLog } 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';
@ -55,7 +56,7 @@ export default function BalanceLogPage() {
{
accessorKey: 'type',
header: t('column.type'),
cell: ({ row }) => getBalanceTypeText(row.original.type),
cell: ({ row }) => <Badge>{getBalanceTypeText(row.original.type)}</Badge>,
},
{
accessorKey: 'timestamp',

View File

@ -6,6 +6,7 @@ import { OrderLink } from '@/components/order-link';
import { ProTable } from '@/components/pro-table';
import { filterCommissionLog } 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';
@ -50,7 +51,7 @@ export default function CommissionLogPage() {
{
accessorKey: 'type',
header: t('column.type'),
cell: ({ row }) => getCommissionTypeText(row.original.type),
cell: ({ row }) => <Badge>{getCommissionTypeText(row.original.type)}</Badge>,
},
{
accessorKey: 'timestamp',

View File

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

View File

@ -33,13 +33,14 @@ export default function LoginLogPage() {
{
accessorKey: 'user',
header: t('column.user'),
cell: ({ row }) => <UserDetail id={Number(row.original.user_id)} />,
},
{
accessorKey: 'method',
header: t('column.method'),
cell: ({ row }) => <span className='capitalize'>{row.original.method}</span>,
cell: ({ row }) => (
<div>
<Badge className='capitalize'>{row.original.method}</Badge>{' '}
<UserDetail id={Number(row.original.user_id)} />
</div>
),
},
{
accessorKey: 'login_ip',
header: t('column.ip'),

View File

@ -5,6 +5,7 @@ import { IpLink } from '@/components/ip-link';
import { ProTable } from '@/components/pro-table';
import { filterRegisterLog } from '@/services/admin/log';
import { formatDate } from '@/utils/common';
import { Badge } from '@workspace/ui/components/badge';
import {
Tooltip,
TooltipContent,
@ -36,10 +37,14 @@ export default function RegisterLogPage() {
},
{
accessorKey: 'auth_method',
header: t('column.method'),
cell: ({ row }) => <span className='capitalize'>{row.original.auth_method}</span>,
header: t('column.identifier'),
cell: ({ row }) => (
<div className='flex items-center'>
<Badge className='capitalize'>{row.original.auth_method}</Badge>
<span className='ml-1 text-sm'>{row.original.identifier}</span>
</div>
),
},
{ accessorKey: 'identifier', header: t('column.identifier') },
{
accessorKey: 'register_ip',
header: t('column.ip'),

View File

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

View File

@ -146,13 +146,15 @@ export function UserDetail({ id }: { id: number }) {
if (!id) return '--';
const identifier =
data?.auth_methods.find((m) => m.auth_type === 'email')?.auth_identifier ||
data?.auth_methods[0]?.auth_identifier;
return (
<HoverCard>
<HoverCardTrigger asChild>
<Button variant='link' className='p-0' asChild>
<Link href={`/dashboard/user?user_id=${id}`}>
{data?.auth_methods[0]?.auth_identifier || t('loading')}
</Link>
<Link href={`/dashboard/user?user_id=${id}`}>{identifier || t('loading')}</Link>
</Button>
</HoverCardTrigger>
<HoverCardContent>

View File

@ -64,12 +64,19 @@
"trafficDetails": "Podrobnosti o provozu"
},
"type": {
"1": "Dobití",
"2": "Výběr",
"3": "Nákup",
"4": "Vrácení",
"5": "Odměna",
"6": "Provize"
"231": "Automatické resetování",
"232": "Předčasné resetování",
"233": "Placené resetování",
"321": "Dobití",
"322": "Výběr",
"323": "Platba",
"324": "Vrácení",
"325": "Odměna",
"331": "Nákup",
"332": "Obnovení",
"333": "Vrácení",
"341": "Zvýšení",
"342": "Snížení"
},
"unknown": "Neznámý"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Verkehrsdetails"
},
"type": {
"1": "Aufladen",
"2": "Abheben",
"3": "Kauf",
"4": "Rückerstattung",
"5": "Belohnung",
"6": "Provision"
"231": "Automatisches Zurücksetzen",
"232": "Vorzeitiges Zurücksetzen",
"233": "Bezahltes Zurücksetzen",
"321": "Aufladen",
"322": "Abheben",
"323": "Zahlung",
"324": "Rückerstattung",
"325": "Belohnung",
"331": "Kauf",
"332": "Verlängerung",
"333": "Rückerstattung",
"341": "Erhöhen",
"342": "Reduzieren"
},
"unknown": "Unbekannt"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Traffic Details"
},
"type": {
"1": "Recharge",
"2": "Withdraw",
"3": "Purchase",
"4": "Refund",
"5": "Reward",
"6": "Commission"
"231": "Auto Reset",
"232": "Advance Reset",
"233": "Paid Reset",
"321": "Recharge",
"322": "Withdraw",
"323": "Payment",
"324": "Refund",
"325": "Reward",
"331": "Purchase",
"332": "Renewal",
"333": "Refund",
"341": "Increase",
"342": "Reduce"
},
"unknown": "Unknown"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Detalles del Tráfico"
},
"type": {
"1": "Recarga",
"2": "Retiro",
"3": "Compra",
"4": "Reembolso",
"5": "Recompensa",
"6": "Comisión"
"231": "Restablecimiento Automático",
"232": "Restablecimiento Adelantado",
"233": "Restablecimiento Pagado",
"321": "Recarga",
"322": "Retiro",
"323": "Pago",
"324": "Reembolso",
"325": "Recompensa",
"331": "Compra",
"332": "Renovación",
"333": "Reembolso",
"341": "Aumentar",
"342": "Reducir"
},
"unknown": "Desconocido"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Detalles del Tráfico"
},
"type": {
"1": "Recarga",
"2": "Retiro",
"3": "Compra",
"4": "Reembolso",
"5": "Recompensa",
"6": "Comisión"
"231": "Restablecimiento automático",
"232": "Restablecimiento temprano",
"233": "Restablecimiento pagado",
"321": "Recarga",
"322": "Retiro",
"323": "Pago",
"324": "Reembolso",
"325": "Recompensa",
"331": "Compra",
"332": "Renovación",
"333": "Reembolso",
"341": "Aumento",
"342": "Reducción"
},
"unknown": "Desconocido"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "جزئیات ترافیک"
},
"type": {
"1": "شارژ",
"2": "برداشت",
"3": "خرید",
"4": "بازگشت",
"5": "پاداش",
"6": "کمیسیون"
"231": "بازنشانی خودکار",
"232": "بازنشانی زودهنگام",
"233": "بازنشانی پرداختی",
"321": "شارژ",
"322": "برداشت",
"323": "پرداخت",
"324": "بازگشت",
"325": "پاداش",
"331": "خرید",
"332": "تمدید",
"333": "بازگشت",
"341": "افزایش",
"342": "کاهش"
},
"unknown": "ناشناخته"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Liikennetiedot"
},
"type": {
"1": "Lataus",
"2": "Nosto",
"3": "Osto",
"4": "Hyvitys",
"5": "Palkinto",
"6": "Komissio"
"231": "Automaattinen nollaus",
"232": "Ennenaikainen nollaus",
"233": "Maksettu nollaus",
"321": "Lataus",
"322": "Nosto",
"323": "Maksu",
"324": "Hyvitys",
"325": "Palkinto",
"331": "Osto",
"332": "Uusiminen",
"333": "Hyvitys",
"341": "Lisäys",
"342": "Vähennys"
},
"unknown": "Tuntematon"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Détails du Trafic"
},
"type": {
"1": "Recharge",
"2": "Retrait",
"3": "Achat",
"4": "Remboursement",
"5": "Récompense",
"6": "Commission"
"231": "Réinitialisation Automatique",
"232": "Réinitialisation Anticipée",
"233": "Réinitialisation Payée",
"321": "Recharge",
"322": "Retrait",
"323": "Paiement",
"324": "Remboursement",
"325": "Récompense",
"331": "Achat",
"332": "Renouvellement",
"333": "Remboursement",
"341": "Augmenter",
"342": "Réduire"
},
"unknown": "Inconnu"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "ट्रैफ़िक विवरण"
},
"type": {
"1": "रिचार्ज",
"2": "निकासी",
"3": "खरीद",
"4": "वापसी",
"5": "इनाम",
"6": "आयोग"
"231": "स्वचालित रीसेट",
"232": "जल्दी रीसेट",
"233": "भुगतान रीसेट",
"321": "रिचार्ज",
"322": "निकासी",
"323": "भुगतान",
"324": "वापसी",
"325": "इनाम",
"331": "खरीद",
"332": "नवीनीकरण",
"333": "वापसी",
"341": "वृद्धि",
"342": "कमी"
},
"unknown": "अज्ञात"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Forgalmi részletek"
},
"type": {
"1": "Újratöltés",
"2": "Kivét",
"3": "Vásárlás",
"4": "Visszatérítés",
"5": "Jutalom",
"6": "Jutalék"
"231": "Automatikus visszaállítás",
"232": "Korai visszaállítás",
"233": "Fizetett visszaállítás",
"321": "Újratöltés",
"322": "Kivét",
"323": "Fizetés",
"324": "Visszatérítés",
"325": "Jutalom",
"331": "Vásárlás",
"332": "Megújítás",
"333": "Visszatérítés",
"341": "Növelés",
"342": "Csökkentés"
},
"unknown": "Ismeretlen"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "トラフィック詳細"
},
"type": {
"1": "チャージ",
"2": "引き出し",
"3": "購入",
"4": "返金",
"5": "報酬",
"6": "手数料"
"231": "自動リセット",
"232": "前倒しリセット",
"233": "有料リセット",
"321": "チャージ",
"322": "引き出し",
"323": "支払い",
"324": "返金",
"325": "報酬",
"331": "購入",
"332": "更新",
"333": "返金",
"341": "増加",
"342": "減少"
},
"unknown": "不明"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "트래픽 세부정보"
},
"type": {
"1": "충전",
"2": "출금",
"3": "구매",
"4": "환불",
"5": "보상",
"6": "수수료"
"231": "자동 재설정",
"232": "선제 재설정",
"233": "유료 재설정",
"321": "충전",
"322": "출금",
"323": "결제",
"324": "환불",
"325": "보상",
"331": "구매",
"332": "갱신",
"333": "환불",
"341": "증가",
"342": "감소"
},
"unknown": "알 수 없음"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Trafikkdetaljer"
},
"type": {
"1": "Opplading",
"2": "Uttak",
"3": "Kjøp",
"4": "Refusjon",
"5": "Belønning",
"6": "Kommisjon"
"231": "Automatisk tilbakestilling",
"232": "Tidlig tilbakestilling",
"233": "Betalt tilbakestilling",
"321": "Opplading",
"322": "Uttak",
"323": "Betaling",
"324": "Refusjon",
"325": "Belønning",
"331": "Kjøp",
"332": "Fornyelse",
"333": "Refusjon",
"341": "Økning",
"342": "Reduksjon"
},
"unknown": "Ukjent"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Szczegóły Ruchu"
},
"type": {
"1": "Doładowanie",
"2": "Wypłata",
"3": "Zakup",
"4": "Zwrót",
"5": "Nagroda",
"6": "Prowizja"
"231": "Automatyczne Resetowanie",
"232": "Przedwczesne Resetowanie",
"233": "Płatne Resetowanie",
"321": "Doładowanie",
"322": "Wypłata",
"323": "Płatność",
"324": "Zwrot",
"325": "Nagroda",
"331": "Zakup",
"332": "Odnowienie",
"333": "Zwrot",
"341": "Zwiększenie",
"342": "Zmniejszenie"
},
"unknown": "Nieznane"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Detalhes do Tráfego"
},
"type": {
"1": "Recarga",
"2": "Retirada",
"3": "Compra",
"4": "Reembolso",
"5": "Recompensa",
"6": "Comissão"
"231": "Reinício Automático",
"232": "Reinício Antecipado",
"233": "Reinício Pago",
"321": "Recarga",
"322": "Retirada",
"323": "Pagamento",
"324": "Reembolso",
"325": "Recompensa",
"331": "Compra",
"332": "Renovação",
"333": "Reembolso",
"341": "Aumentar",
"342": "Reduzir"
},
"unknown": "Desconhecido"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Detalii Trafic"
},
"type": {
"1": "Reîncărcare",
"2": "Retragere",
"3": "Achiziție",
"4": "Rambursare",
"5": "Recompensă",
"6": "Comision"
"231": "Resetare automată",
"232": "Resetare timpurie",
"233": "Resetare plătită",
"321": "Reîncărcare",
"322": "Retragere",
"323": "Plată",
"324": "Rambursare",
"325": "Recompensă",
"331": "Achiziție",
"332": "Reînnoire",
"333": "Rambursare",
"341": "Creștere",
"342": "Scădere"
},
"unknown": "Necunoscut"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Детали трафика"
},
"type": {
"1": "Пополнение",
"2": "Вывод",
"3": "Покупка",
"4": "Возврат",
"5": "Награда",
"6": "Комиссия"
"231": "Автоматический сброс",
"232": "Досрочный сброс",
"233": "Платный сброс",
"321": "Пополнение",
"322": "Вывод",
"323": "Платеж",
"324": "Возврат",
"325": "Награда",
"331": "Покупка",
"332": "Продление",
"333": "Возврат",
"341": "Увеличение",
"342": "Уменьшение"
},
"unknown": "Неизвестно"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "รายละเอียดการจราจร"
},
"type": {
"1": "เติมเงิน",
"2": "ถอนเงิน",
"3": "ซื้อ",
"4": "คืนเงิน",
"5": "รางวัล",
"6": "ค่าคอมมิชชั่น"
"231": "รีเซ็ตอัตโนมัติ",
"232": "รีเซ็ตล่วงหน้า",
"233": "รีเซ็ตแบบชำระเงิน",
"321": "เติมเงิน",
"322": "ถอนเงิน",
"323": "การชำระเงิน",
"324": "คืนเงิน",
"325": "รางวัล",
"331": "ซื้อ",
"332": "ต่ออายุ",
"333": "คืนเงิน",
"341": "เพิ่ม",
"342": "ลด"
},
"unknown": "ไม่ทราบ"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Trafik Detayları"
},
"type": {
"1": "Yükleme",
"2": "Çekim",
"3": "Alım",
"4": "İade",
"5": "Ödül",
"6": "Komisyon"
"231": "Otomatik sıfırlama",
"232": "Erken sıfırlama",
"233": "Ücretli sıfırlama",
"321": "Yükleme",
"322": "Çekim",
"323": "Ödeme",
"324": "İade",
"325": "Ödül",
"331": "Alım",
"332": "Yenileme",
"333": "İade",
"341": "Artış",
"342": "Azalış"
},
"unknown": "Bilinmiyor"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Деталі трафіку"
},
"type": {
"1": "Поповнення",
"2": "Виведення",
"3": "Покупка",
"4": "Повернення",
"5": "Нагорода",
"6": "Комісія"
"231": "Автоматичне скидання",
"232": "Раннє скидання",
"233": "Платне скидання",
"321": "Поповнення",
"322": "Виведення",
"323": "Платіж",
"324": "Повернення",
"325": "Нагорода",
"331": "Покупка",
"332": "Поновлення",
"333": "Повернення",
"341": "Збільшення",
"342": "Зменшення"
},
"unknown": "Невідомо"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "Chi tiết Lưu lượng"
},
"type": {
"1": "Nạp tiền",
"2": "Rút tiền",
"3": "Mua hàng",
"4": "Hoàn tiền",
"5": "Phần thưởng",
"6": "Hoa hồng"
"231": "Đặt lại Tự động",
"232": "Đặt lại Sớm",
"233": "Đặt lại Trả phí",
"321": "Nạp tiền",
"322": "Rút tiền",
"323": "Thanh toán",
"324": "Hoàn tiền",
"325": "Phần thưởng",
"331": "Mua hàng",
"332": "Gia hạn",
"333": "Hoàn tiền",
"341": "Tăng",
"342": "Giảm"
},
"unknown": "Không xác định"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "流量明细"
},
"type": {
"1": "充值",
"2": "提取",
"3": "购买",
"4": "退款",
"5": "奖励",
"6": "佣金"
"231": "自动重置",
"232": "提前重置",
"233": "付费重置",
"321": "充值",
"322": "提现",
"323": "支付",
"324": "退款",
"325": "奖励",
"331": "购买",
"332": "续费",
"333": "退款",
"341": "增加",
"342": "减少"
},
"unknown": "未知"
}

View File

@ -64,12 +64,19 @@
"trafficDetails": "流量詳情"
},
"type": {
"1": "充值",
"2": "提現",
"3": "購買",
"4": "退款",
"5": "獎勵",
"6": "佣金"
"231": "自動重置",
"232": "提前重置",
"233": "付費重置",
"321": "充值",
"322": "提現",
"323": "付款",
"324": "退款",
"325": "獎勵",
"331": "購買",
"332": "續費",
"333": "退款",
"341": "增加",
"342": "減少"
},
"unknown": "未知"
}