import { Alert, Badge, Center, Loader, Stack, Table, Text } from '@mantine/core' import { useChannelReadings, type MeterSourceChannelResponse } from './hooks' import { formatLocalDateTime } from '../utils/datetime' export function SourceReadings({ sourceUuid, channel }: { sourceUuid: string; channel: MeterSourceChannelResponse }) { const query = useChannelReadings(sourceUuid, channel.uuid) return {channel.label} — latest {channel.latest_value ?? '—'} {channel.unit} Quality: {channel.latest_quality ?? 'unknown'} {channel.latest_quality === 'unverifiable' && This reading is unverifiable: it is shown for review, not marked verified.} {query.isLoading ?
: query.isError || !query.data ? Failed to load channel history. : query.data.items.length === 0 ? No channel history yet. : RecordedValueQuality{query.data.items.map((row) => {formatLocalDateTime(row.recorded_at)}{row.value ?? '—'}{row.quality ?? 'unknown'})}
}
}