record.subscription.id}
emptyClassName={loading ? 'py-8' : 'text-muted-foreground py-8'}
emptyContent={
loading ? t('Loading...') : t('No subscription records')
}
columns={[
{
id: 'id',
header: t('ID'),
cell: (record) => ,
},
{
id: 'plan',
header: t('Plan'),
cell: (record) => {
const sub = record.subscription
return (
{planTitleMap.get(sub.plan_id) || `#${sub.plan_id}`}
{t('Source')}: {sub.source || '-'}
)
},
},
{
id: 'status',
header: t('Status'),
cell: (record) => (
),
},
{
id: 'validity',
header: t('Validity'),
cell: (record) => {
const sub = record.subscription
return (
{t('Start')}: {formatTimestamp(sub.start_time)}
{t('End')}: {formatTimestamp(sub.end_time)}
)
},
},
{
id: 'quota',
header: t('Total Quota'),
cell: (record) => {
const sub = record.subscription
const total = Number(sub.amount_total || 0)
const used = Number(sub.amount_used || 0)
return total > 0
? `${formatQuota(used)}/${formatQuota(total)}`
: t('Unlimited')
},
},
{
id: 'actions',
header: t('Actions'),
className: 'text-right',
cellClassName: 'text-right',
cell: (record) => {
const sub = record.subscription
const now = Date.now() / 1000
const isExpired =
(sub.end_time || 0) > 0 && sub.end_time < now
const isActive = sub.status === 'active' && !isExpired
return (
)
},
},
]}
/>