2026-10-23 19:56:38 -07:00
|
|
|
'use client';
|
|
|
|
|
|
2026-11-17 00:24:33 +06:00
|
|
|
import { PageShell } from '@/components/layout/PageShell';
|
2026-11-21 00:06:55 +06:00
|
|
|
import { useVconRole } from '@/components/layout/VconShell';
|
2026-10-23 19:56:38 -07:00
|
|
|
import { Button } from '@/components/ui/Button';
|
|
|
|
|
import { ClientList, type ClientListItem } from '@/components/ui/ClientList';
|
|
|
|
|
import { Panel } from '@/components/ui/Panel';
|
2026-11-16 23:10:44 +06:00
|
|
|
import { StatStrip } from '@/components/ui/StatStrip';
|
2026-10-23 19:56:38 -07:00
|
|
|
import {
|
2026-11-17 00:24:33 +06:00
|
|
|
Table,
|
|
|
|
|
TableBody,
|
|
|
|
|
TableCell,
|
2026-11-18 05:18:55 +06:00
|
|
|
TableEmpty,
|
2026-11-17 00:24:33 +06:00
|
|
|
TableHead,
|
|
|
|
|
TableHeader,
|
|
|
|
|
TableRow,
|
|
|
|
|
TableWrap,
|
2026-10-23 19:56:38 -07:00
|
|
|
} from '@/components/ui/Table';
|
2026-11-19 20:22:01 +06:00
|
|
|
import { useToast } from '@/components/ui/Toast';
|
2026-11-16 23:10:44 +06:00
|
|
|
import { getCached, setCached } from '@/lib/vconCache';
|
2026-11-19 20:22:01 +06:00
|
|
|
import {
|
|
|
|
|
countMatchingBufferedEvents,
|
|
|
|
|
extractContentDispositionFilename,
|
|
|
|
|
formatEventTimeLabel,
|
2026-11-21 00:06:55 +06:00
|
|
|
getVconRoleCapabilities,
|
|
|
|
|
isUiClientExpired,
|
2026-11-19 20:22:01 +06:00
|
|
|
type BufferedSummary,
|
|
|
|
|
} from '@/lib/vconUiHelpers';
|
2026-10-23 19:56:38 -07:00
|
|
|
import Link from 'next/link';
|
|
|
|
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
|
|
|
|
|
|
|
|
type EventItem = {
|
|
|
|
|
eventId: string;
|
|
|
|
|
clientId: string;
|
|
|
|
|
timestamp: string;
|
|
|
|
|
payload: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type DashboardMetrics = {
|
2026-11-18 05:18:55 +06:00
|
|
|
activeSockets?: number;
|
2026-10-23 19:56:38 -07:00
|
|
|
activeClients: number;
|
2026-11-21 00:06:55 +06:00
|
|
|
expiredClients?: number;
|
2026-10-23 19:56:38 -07:00
|
|
|
totalClients: number;
|
|
|
|
|
bufferStats: {
|
|
|
|
|
currentBufferSize: number;
|
|
|
|
|
totalFlushed: number;
|
|
|
|
|
};
|
|
|
|
|
storageStats: {
|
|
|
|
|
totalMB: string;
|
|
|
|
|
totalBytes: number;
|
|
|
|
|
totalFiles: number;
|
|
|
|
|
totalRows: number;
|
|
|
|
|
};
|
2026-11-19 20:22:01 +06:00
|
|
|
runtime?: {
|
|
|
|
|
ingestionBridgeStatus?: 'online' | 'auth_error' | 'error' | 'offline';
|
|
|
|
|
ingestionBridgeError?: string;
|
|
|
|
|
serverPort?: number;
|
|
|
|
|
webPort?: number;
|
|
|
|
|
};
|
2026-10-23 19:56:38 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type StorageFile = {
|
|
|
|
|
clientId: string;
|
|
|
|
|
date: string;
|
|
|
|
|
filename: string;
|
|
|
|
|
sizeBytes: number;
|
|
|
|
|
linesCount: number;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const DashboardOverview: React.FC = () => {
|
2026-11-19 20:22:01 +06:00
|
|
|
const { error, info } = useToast();
|
2026-11-21 00:06:55 +06:00
|
|
|
const currentRole = useVconRole();
|
|
|
|
|
const { canOperate } = getVconRoleCapabilities(currentRole);
|
2026-11-17 00:24:33 +06:00
|
|
|
const [metrics, setMetrics] = useState<DashboardMetrics | null>(() =>
|
|
|
|
|
getCached<DashboardMetrics | null>('vcon:metrics', null)
|
|
|
|
|
);
|
|
|
|
|
const [events, setEvents] = useState<EventItem[]>(() =>
|
|
|
|
|
getCached<EventItem[]>('vcon:dashboard-events', [])
|
|
|
|
|
);
|
|
|
|
|
const [clients, setClients] = useState<ClientListItem[]>(() =>
|
|
|
|
|
getCached<ClientListItem[]>('vcon:clients', [])
|
|
|
|
|
);
|
|
|
|
|
const [files, setFiles] = useState<StorageFile[]>(() =>
|
|
|
|
|
getCached<StorageFile[]>('vcon:storage-files', [])
|
|
|
|
|
);
|
2026-11-19 20:22:01 +06:00
|
|
|
const [bufferedSummary, setBufferedSummary] = useState<BufferedSummary | null>(() =>
|
|
|
|
|
getCached<BufferedSummary | null>('vcon:buffered-summary', null)
|
|
|
|
|
);
|
2026-10-23 19:56:38 -07:00
|
|
|
const [isRefreshing, setIsRefreshing] = useState(false);
|
2026-11-19 20:22:01 +06:00
|
|
|
const [isExporting, setIsExporting] = useState(false);
|
2026-11-18 05:18:55 +06:00
|
|
|
const [fetchError, setFetchError] = useState('');
|
2026-10-23 19:56:38 -07:00
|
|
|
|
|
|
|
|
const refresh = useCallback(async () => {
|
|
|
|
|
setIsRefreshing(true);
|
|
|
|
|
try {
|
2026-11-17 00:24:33 +06:00
|
|
|
const [metricsResponse, eventsResponse, storageResponse, clientsResponse] =
|
|
|
|
|
await Promise.all([
|
|
|
|
|
fetch('/api/metrics', { cache: 'no-store' }),
|
2026-11-19 20:22:01 +06:00
|
|
|
fetch('/api/events?limit=8&includeBufferedSummary=true', { cache: 'no-store' }),
|
2026-11-17 00:24:33 +06:00
|
|
|
fetch('/api/storage', { cache: 'no-store' }),
|
|
|
|
|
fetch('/api/clients', { cache: 'no-store' }),
|
|
|
|
|
]);
|
2026-10-23 19:56:38 -07:00
|
|
|
|
2026-11-18 05:18:55 +06:00
|
|
|
if (
|
|
|
|
|
metricsResponse.status === 401 ||
|
|
|
|
|
eventsResponse.status === 401 ||
|
|
|
|
|
storageResponse.status === 401 ||
|
|
|
|
|
clientsResponse.status === 401
|
|
|
|
|
) {
|
|
|
|
|
window.location.assign('/vcon/login');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const errors: string[] = [];
|
|
|
|
|
|
2026-11-16 23:10:44 +06:00
|
|
|
if (metricsResponse.ok) {
|
|
|
|
|
const nextMetrics = await metricsResponse.json();
|
|
|
|
|
setMetrics(setCached('vcon:metrics', nextMetrics));
|
2026-11-18 05:18:55 +06:00
|
|
|
} else {
|
|
|
|
|
errors.push('metrics');
|
2026-11-16 23:10:44 +06:00
|
|
|
}
|
2026-11-18 05:18:55 +06:00
|
|
|
|
2026-10-23 19:56:38 -07:00
|
|
|
if (eventsResponse.ok) {
|
|
|
|
|
const data = await eventsResponse.json();
|
2026-11-16 23:10:44 +06:00
|
|
|
setEvents(setCached('vcon:dashboard-events', data.events ?? []));
|
2026-11-19 20:22:01 +06:00
|
|
|
if (data.bufferedSummary) {
|
|
|
|
|
setBufferedSummary(setCached('vcon:buffered-summary', data.bufferedSummary));
|
|
|
|
|
}
|
2026-11-18 05:18:55 +06:00
|
|
|
} else {
|
|
|
|
|
errors.push('events');
|
2026-10-23 19:56:38 -07:00
|
|
|
}
|
2026-11-18 05:18:55 +06:00
|
|
|
|
2026-10-23 19:56:38 -07:00
|
|
|
if (storageResponse.ok) {
|
|
|
|
|
const data = await storageResponse.json();
|
2026-11-16 23:10:44 +06:00
|
|
|
setFiles(setCached('vcon:storage-files', data.files ?? []));
|
|
|
|
|
if (data.stats) setCached('vcon:storage-stats', data.stats);
|
2026-11-18 05:18:55 +06:00
|
|
|
} else {
|
|
|
|
|
errors.push('storage');
|
2026-10-23 19:56:38 -07:00
|
|
|
}
|
2026-11-18 05:18:55 +06:00
|
|
|
|
2026-10-23 19:56:38 -07:00
|
|
|
if (clientsResponse.ok) {
|
|
|
|
|
const data = await clientsResponse.json();
|
2026-11-16 23:10:44 +06:00
|
|
|
setClients(setCached('vcon:clients', data.clients ?? []));
|
2026-11-18 05:18:55 +06:00
|
|
|
} else {
|
|
|
|
|
errors.push('clients');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (errors.length > 0) {
|
|
|
|
|
setFetchError(
|
|
|
|
|
`Partial telemetry refresh failed (${errors.join(', ')}). Showing last available snapshot.`
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
setFetchError('');
|
2026-10-23 19:56:38 -07:00
|
|
|
}
|
|
|
|
|
} catch {
|
2026-11-18 05:18:55 +06:00
|
|
|
setFetchError(
|
|
|
|
|
'Unable to reach telemetry endpoints. Showing last available snapshot.'
|
|
|
|
|
);
|
2026-10-23 19:56:38 -07:00
|
|
|
} finally {
|
|
|
|
|
setIsRefreshing(false);
|
|
|
|
|
}
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
void refresh();
|
|
|
|
|
const interval = window.setInterval(() => void refresh(), 5000);
|
|
|
|
|
return () => window.clearInterval(interval);
|
|
|
|
|
}, [refresh]);
|
|
|
|
|
|
|
|
|
|
const today = new Date().toISOString().slice(0, 10);
|
|
|
|
|
const storedRecordsToday = files
|
|
|
|
|
.filter((file) => file.date === today)
|
|
|
|
|
.reduce((total, file) => total + file.linesCount, 0);
|
2026-11-18 05:18:55 +06:00
|
|
|
const bufferedCount = metrics?.bufferStats.currentBufferSize ?? 0;
|
2026-11-19 20:22:01 +06:00
|
|
|
const bufferedTodayRaw = bufferedSummary
|
|
|
|
|
? countMatchingBufferedEvents(bufferedSummary, {
|
|
|
|
|
clientId: 'all',
|
|
|
|
|
fromDate: today,
|
|
|
|
|
toDate: today,
|
|
|
|
|
}).matchingCount
|
|
|
|
|
: 0;
|
|
|
|
|
const bufferedTodayCount = metrics
|
|
|
|
|
? Math.min(bufferedTodayRaw, bufferedCount)
|
|
|
|
|
: bufferedTodayRaw;
|
|
|
|
|
const eventsToday = storedRecordsToday + bufferedTodayCount;
|
2026-11-17 00:24:33 +06:00
|
|
|
const activeClients =
|
|
|
|
|
metrics?.activeClients ??
|
2026-11-21 00:06:55 +06:00
|
|
|
clients.filter(
|
|
|
|
|
(client) =>
|
|
|
|
|
client.status === 'active' &&
|
|
|
|
|
!isUiClientExpired(
|
|
|
|
|
(client as ClientListItem & { expiresAt?: string | null }).expiresAt,
|
|
|
|
|
),
|
|
|
|
|
).length;
|
2026-10-23 19:56:38 -07:00
|
|
|
const totalClients = metrics?.totalClients ?? clients.length;
|
2026-11-18 05:18:55 +06:00
|
|
|
const activeSockets = metrics?.activeSockets ?? 0;
|
2026-11-19 20:22:01 +06:00
|
|
|
const bridgeStatus = metrics?.runtime?.ingestionBridgeStatus;
|
|
|
|
|
const bridgeAuthError = bridgeStatus === 'auth_error';
|
|
|
|
|
const socketSuffix =
|
|
|
|
|
bridgeStatus === 'auth_error'
|
|
|
|
|
? `${activeSockets} ws · auth err`
|
|
|
|
|
: bridgeStatus === 'offline'
|
|
|
|
|
? `${activeSockets} ws · offline`
|
|
|
|
|
: `${activeSockets} ws`;
|
2026-10-23 19:56:38 -07:00
|
|
|
const totalStorage = metrics?.storageStats.totalMB ?? '0.00';
|
|
|
|
|
const totalStorageBytes = metrics?.storageStats.totalBytes ?? 0;
|
2026-11-17 00:24:33 +06:00
|
|
|
const storageValue =
|
2026-11-18 05:18:55 +06:00
|
|
|
totalStorageBytes === 0
|
|
|
|
|
? '0'
|
|
|
|
|
: totalStorageBytes < 1024 * 1024
|
|
|
|
|
? String(Math.max(1, Math.round(totalStorageBytes / 1024)))
|
|
|
|
|
: totalStorage;
|
2026-10-23 19:56:38 -07:00
|
|
|
const storageUnit = totalStorageBytes < 1024 * 1024 ? 'KB' : 'MB';
|
|
|
|
|
const totalFiles = metrics?.storageStats.totalFiles ?? files.length;
|
2026-11-17 00:24:33 +06:00
|
|
|
const totalRows =
|
|
|
|
|
metrics?.storageStats.totalRows ??
|
|
|
|
|
files.reduce((sum, file) => sum + file.linesCount, 0);
|
2026-10-23 19:56:38 -07:00
|
|
|
|
2026-11-19 20:22:01 +06:00
|
|
|
const handleQuickExport = async () => {
|
|
|
|
|
setIsExporting(true);
|
|
|
|
|
try {
|
|
|
|
|
const res = await fetch('/api/export?clientId=all', { cache: 'no-store' });
|
|
|
|
|
if (res.status === 401) {
|
|
|
|
|
window.location.assign('/vcon/login');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!res.ok) {
|
|
|
|
|
const errJson = await res.json().catch(() => ({}));
|
|
|
|
|
error('Export failed', errJson.error || `Export failed with HTTP ${res.status}.`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const blob = await res.blob();
|
|
|
|
|
const filename = extractContentDispositionFilename(
|
|
|
|
|
res.headers.get('content-disposition'),
|
|
|
|
|
`datastack_export_all_${new Date().toISOString().slice(0, 10)}.csv`
|
|
|
|
|
);
|
|
|
|
|
const objectUrl = URL.createObjectURL(blob);
|
|
|
|
|
const a = document.createElement('a');
|
|
|
|
|
a.href = objectUrl;
|
|
|
|
|
a.download = filename;
|
|
|
|
|
document.body.appendChild(a);
|
|
|
|
|
a.click();
|
|
|
|
|
document.body.removeChild(a);
|
|
|
|
|
URL.revokeObjectURL(objectUrl);
|
|
|
|
|
info('Export downloaded', `${filename} downloaded.`);
|
|
|
|
|
await refresh();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
error('Export failed', err instanceof Error ? err.message : 'Unable to export dataset.');
|
|
|
|
|
} finally {
|
|
|
|
|
setIsExporting(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-10-23 19:56:38 -07:00
|
|
|
return (
|
2026-11-17 00:24:33 +06:00
|
|
|
<PageShell
|
|
|
|
|
title="Dashboard"
|
|
|
|
|
actions={
|
|
|
|
|
<>
|
|
|
|
|
<Button
|
|
|
|
|
size="icon"
|
|
|
|
|
variant="secondary"
|
|
|
|
|
icon="RefreshCw"
|
|
|
|
|
aria-label="Refresh dashboard"
|
|
|
|
|
title="Refresh dashboard"
|
|
|
|
|
loading={isRefreshing}
|
|
|
|
|
onClick={() => void refresh()}
|
|
|
|
|
/>
|
2026-11-19 20:22:01 +06:00
|
|
|
<Button
|
|
|
|
|
size="xs"
|
|
|
|
|
variant="secondary"
|
|
|
|
|
icon="Download"
|
|
|
|
|
loading={isExporting}
|
|
|
|
|
disabled={isExporting}
|
|
|
|
|
onClick={() => void handleQuickExport()}
|
|
|
|
|
>
|
|
|
|
|
Export
|
|
|
|
|
</Button>
|
2026-11-21 00:06:55 +06:00
|
|
|
{canOperate && (
|
|
|
|
|
<Link href="/vcon/clients">
|
|
|
|
|
<Button size="xs" variant="primary" icon="Plus">
|
|
|
|
|
New client
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
)}
|
2026-11-17 00:24:33 +06:00
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
>
|
2026-11-19 20:22:01 +06:00
|
|
|
{(fetchError || bridgeAuthError) && (
|
2026-11-18 05:18:55 +06:00
|
|
|
<div
|
|
|
|
|
role="alert"
|
|
|
|
|
className="mb-3 border border-[var(--danger)] bg-[var(--danger-soft)] px-3 py-2 text-[11.5px] text-[var(--text)]"
|
|
|
|
|
>
|
2026-11-19 20:22:01 +06:00
|
|
|
{bridgeAuthError
|
|
|
|
|
? `Ingestion bridge authentication mismatch (${metrics?.runtime?.ingestionBridgeError || '401'}). Check DATASTACK_INTERNAL_SECRET parity.`
|
|
|
|
|
: fetchError}
|
2026-11-18 05:18:55 +06:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-11-16 23:10:44 +06:00
|
|
|
<StatStrip
|
|
|
|
|
items={[
|
|
|
|
|
{ label: 'Events today', value: eventsToday.toLocaleString() },
|
2026-11-17 00:24:33 +06:00
|
|
|
{
|
2026-11-18 05:18:55 +06:00
|
|
|
label: 'Active clients · Sockets',
|
2026-11-19 20:22:01 +06:00
|
|
|
value: `${activeClients} / ${totalClients} · ${socketSuffix}`,
|
|
|
|
|
dot:
|
|
|
|
|
bridgeAuthError
|
|
|
|
|
? 'off'
|
|
|
|
|
: activeSockets > 0 || (activeClients > 0 && bridgeStatus === 'online')
|
|
|
|
|
? 'ok'
|
|
|
|
|
: 'off',
|
2026-11-17 00:24:33 +06:00
|
|
|
},
|
2026-11-16 23:10:44 +06:00
|
|
|
{ label: 'Storage used', value: `${storageValue} ${storageUnit}` },
|
|
|
|
|
{ label: 'Stored rows', value: totalRows.toLocaleString() },
|
|
|
|
|
]}
|
|
|
|
|
/>
|
2026-10-23 19:56:38 -07:00
|
|
|
|
2026-11-17 00:24:33 +06:00
|
|
|
<div className="grid min-w-0 grid-cols-1 gap-3 lg:grid-cols-[minmax(0,1.85fr)_minmax(0,1fr)]">
|
2026-10-23 19:56:38 -07:00
|
|
|
<Panel
|
2026-11-16 21:58:18 +06:00
|
|
|
title="Recent events"
|
2026-11-18 05:18:55 +06:00
|
|
|
meta={
|
|
|
|
|
bufferedCount > 0
|
|
|
|
|
? `${events.length} · ${bufferedCount} buffered`
|
|
|
|
|
: `${events.length}`
|
|
|
|
|
}
|
2026-11-17 00:24:33 +06:00
|
|
|
action={
|
|
|
|
|
<Link
|
|
|
|
|
href="/vcon/data"
|
|
|
|
|
className="text-[11px] text-[var(--text-muted)] hover:text-[var(--text)]"
|
|
|
|
|
>
|
|
|
|
|
View all →
|
|
|
|
|
</Link>
|
|
|
|
|
}
|
2026-10-23 19:56:38 -07:00
|
|
|
>
|
|
|
|
|
<TableWrap className="border-0 bg-transparent">
|
2026-11-17 00:24:33 +06:00
|
|
|
<Table>
|
2026-10-23 19:56:38 -07:00
|
|
|
<TableHeader>
|
|
|
|
|
<TableRow>
|
|
|
|
|
<TableHead>Time</TableHead>
|
|
|
|
|
<TableHead>Client</TableHead>
|
|
|
|
|
<TableHead>Payload</TableHead>
|
|
|
|
|
<TableHead className="text-right">Size</TableHead>
|
|
|
|
|
</TableRow>
|
|
|
|
|
</TableHeader>
|
|
|
|
|
<TableBody>
|
2026-11-18 05:18:55 +06:00
|
|
|
{events.length === 0 ? (
|
|
|
|
|
<TableEmpty colSpan={4} message="No recent events" />
|
|
|
|
|
) : (
|
|
|
|
|
events.map((event) => (
|
|
|
|
|
<TableRow key={event.eventId}>
|
|
|
|
|
<TableCell className="font-mono tabular-nums text-[var(--text-faint)]">
|
2026-11-19 20:22:01 +06:00
|
|
|
{formatEventTimeLabel(event.timestamp)}
|
2026-11-18 05:18:55 +06:00
|
|
|
</TableCell>
|
|
|
|
|
<TableCell className="font-mono text-[var(--accent)]">
|
|
|
|
|
{event.clientId}
|
|
|
|
|
</TableCell>
|
|
|
|
|
<TableCell className="max-w-[380px] truncate font-mono text-[var(--text)]">
|
|
|
|
|
{event.payload}
|
|
|
|
|
</TableCell>
|
|
|
|
|
<TableCell className="text-right font-mono tabular-nums text-[var(--text-faint)]">
|
|
|
|
|
{new TextEncoder().encode(event.payload).length} B
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
))
|
|
|
|
|
)}
|
2026-10-23 19:56:38 -07:00
|
|
|
</TableBody>
|
|
|
|
|
</Table>
|
|
|
|
|
</TableWrap>
|
|
|
|
|
</Panel>
|
|
|
|
|
|
2026-11-17 00:24:33 +06:00
|
|
|
<div className="flex min-w-0 flex-col gap-3">
|
2026-10-23 19:56:38 -07:00
|
|
|
<Panel
|
2026-11-16 21:58:18 +06:00
|
|
|
title="Clients"
|
2026-11-17 00:24:33 +06:00
|
|
|
action={
|
|
|
|
|
<Link
|
|
|
|
|
href="/vcon/clients"
|
|
|
|
|
className="text-[11px] text-[var(--text-muted)] hover:text-[var(--text)]"
|
|
|
|
|
>
|
|
|
|
|
All →
|
|
|
|
|
</Link>
|
|
|
|
|
}
|
2026-10-23 19:56:38 -07:00
|
|
|
>
|
|
|
|
|
<ClientList clients={clients} limit={4} />
|
|
|
|
|
</Panel>
|
|
|
|
|
|
|
|
|
|
<Panel
|
|
|
|
|
title="Storage"
|
2026-11-16 21:58:18 +06:00
|
|
|
meta={`${totalFiles}`}
|
2026-11-17 00:24:33 +06:00
|
|
|
action={
|
2026-11-19 20:22:01 +06:00
|
|
|
<Link
|
|
|
|
|
href="/vcon/storage"
|
2026-11-17 00:24:33 +06:00
|
|
|
className="text-[11px] text-[var(--text-muted)] hover:text-[var(--text)]"
|
|
|
|
|
>
|
2026-11-19 20:22:01 +06:00
|
|
|
Files →
|
|
|
|
|
</Link>
|
2026-11-17 00:24:33 +06:00
|
|
|
}
|
2026-10-23 19:56:38 -07:00
|
|
|
>
|
|
|
|
|
<div className="divide-y divide-[var(--border)]">
|
|
|
|
|
{files.slice(0, 3).map((file) => (
|
2026-11-17 00:24:33 +06:00
|
|
|
<div
|
|
|
|
|
key={`${file.clientId}/${file.filename}`}
|
|
|
|
|
className="flex items-center justify-between gap-2.5 px-3 py-1.5"
|
|
|
|
|
>
|
2026-10-23 19:56:38 -07:00
|
|
|
<div className="min-w-0">
|
2026-11-17 00:24:33 +06:00
|
|
|
<p className="truncate text-[11.5px] text-[var(--text)]">
|
|
|
|
|
{file.filename}
|
|
|
|
|
</p>
|
|
|
|
|
<p className="truncate font-mono text-[10px] text-[var(--text-faint)]">
|
|
|
|
|
{file.clientId}
|
|
|
|
|
</p>
|
2026-10-23 19:56:38 -07:00
|
|
|
</div>
|
2026-11-16 21:58:18 +06:00
|
|
|
<span className="shrink-0 font-mono text-[10.5px] tabular-nums text-[var(--text-muted)]">
|
2026-10-23 19:56:38 -07:00
|
|
|
{(file.sizeBytes / 1024).toFixed(1)} KB
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
{files.length === 0 && (
|
2026-11-17 00:24:33 +06:00
|
|
|
<p className="px-3 py-4 text-[11px] text-[var(--text-faint)]">
|
|
|
|
|
No CSV files
|
|
|
|
|
</p>
|
2026-10-23 19:56:38 -07:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</Panel>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-11-17 00:24:33 +06:00
|
|
|
</PageShell>
|
2026-10-23 19:56:38 -07:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default DashboardOverview;
|