diff --git a/web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx b/web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx index 4a6eb0eb7..88962b674 100644 --- a/web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx +++ b/web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx @@ -16,11 +16,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { - flexRender, - type Cell, - type Table, -} from '@tanstack/react-table' +import { flexRender, type Cell, type Table } from '@tanstack/react-table' import { Database } from 'lucide-react' import { useTranslation } from 'react-i18next' import { formatTimestampToDate } from '@/lib/format' @@ -33,14 +29,20 @@ import { EmptyTitle, } from '@/components/ui/empty' import { Skeleton } from '@/components/ui/skeleton' -import { dotColorMap, textColorMap, type StatusVariant } from '@/components/status-badge' -import type { LogCategory } from '../types' +import { + dotColorMap, + textColorMap, + type StatusVariant, +} from '@/components/status-badge' import { LOG_TYPE_ENUM } from '../constants' import { getLogTypeConfig } from '../lib/utils' +import type { LogCategory } from '../types' const logTypeRowTint: Record = { - [LOG_TYPE_ENUM.ERROR]: 'bg-rose-50/40 dark:bg-rose-950/20 border-rose-200/50 dark:border-rose-900/30', - [LOG_TYPE_ENUM.REFUND]: 'bg-blue-50/30 dark:bg-blue-950/15 border-blue-200/50 dark:border-blue-900/30', + [LOG_TYPE_ENUM.ERROR]: + 'bg-rose-50/40 dark:bg-rose-950/20 border-rose-200/50 dark:border-rose-900/30', + [LOG_TYPE_ENUM.REFUND]: + 'bg-blue-50/30 dark:bg-blue-950/15 border-blue-200/50 dark:border-blue-900/30', } interface UsageLogsMobileListProps { @@ -53,11 +55,11 @@ interface UsageLogsMobileListProps { function UsageLogsMobileSkeleton() { return ( -
+
{[1, 2, 3].map((i) => (
@@ -93,7 +95,7 @@ function CompactCell({ className={cn( 'min-w-0 overflow-hidden leading-tight [&_button]:max-w-full [&_span]:max-w-full', primaryOnly && - '[&_.flex-col>*:not(:first-child)]:hidden [&_.flex-col]:min-w-0', + '[&_.flex-col]:min-w-0 [&_.flex-col>*:not(:first-child)]:hidden', className )} > @@ -123,10 +125,7 @@ function SummaryField({ return (
{label} @@ -174,6 +173,19 @@ function MobileLogTimeStatus({ ) } +function getCellOriginalField( + cell: Cell | undefined, + field: string +): unknown { + const original = cell?.row.original + + if (!original || typeof original !== 'object') { + return undefined + } + + return (original as Record)[field] +} + function CommonLogsCard({ cells, }: { @@ -183,6 +195,7 @@ function CommonLogsCard({ const modelCell = cells.get('model_name') const quotaCell = cells.get('quota') + const createdAtCell = cells.get('created_at') return (
@@ -195,13 +208,13 @@ function CommonLogsCard({
-
+
{t('Time')}
({
- - + + ({
- + - + - + ({ if (!rows || rows.length === 0) { return ( -
- +
+ - - + + {resolvedEmptyTitle} {resolvedEmptyDescription} @@ -366,7 +363,7 @@ export function UsageLogsMobileList({ } return ( -
+
{rows.map((row) => { const cells = new Map( row.getVisibleCells().map((cell) => [cell.column.id, cell]) @@ -381,19 +378,13 @@ export function UsageLogsMobileList({
- {logCategory === 'common' && ( - - )} - {logCategory === 'task' && ( - - )} - {logCategory === 'drawing' && ( - - )} + {logCategory === 'common' && } + {logCategory === 'task' && } + {logCategory === 'drawing' && }
) })}