import React from 'react'; import { View, Text, StyleSheet, ScrollView } from 'react-native'; import { Colors } from '../../ui/theme/colors'; import { FontSize, FontWeight, Radius, Spacing } from '../../ui/theme/layout'; import { safeStringify } from '../../utils/safeStringify'; import { CollapsibleSection } from '../../ui/shared/CollapsibleSection'; import { JsonView } from '../../ui/shared/JsonView'; import { CopyButton } from '../../ui/shared/CopyButton'; import { LogListScreen } from '../../ui/shared/LogListScreen'; import { LogRow } from '../../ui/shared/LogRow'; import type { DebugFeatureRenderProps, TrackLogEntry } from '../../types'; import { t } from '../../i18n'; export function renderTrackLogRow(item: TrackLogEntry) { return ( ● {Object.entries(item) .filter(([key]) => key !== 'id' && key !== 'eventName' && key !== 'timestamp') .slice(0, 2) .map(([key, value]) => ( {key} {String(value ?? '').slice(0, 25)} ))} )} trailingMetadata={( {new Date(item.timestamp).toLocaleTimeString()} )} /> ); } export const TrackLogTab: React.FC> = React.memo(({ snapshot }) => ( ( {item.eventName} )} renderDetailBody={(item) => { const extraProps = Object.entries(item).filter( ([k, v]) => k !== 'id' && k !== 'eventName' && k !== 'timestamp' && v !== undefined && v !== null, ); return ( {extraProps.map(([key, value]) => ( {key} {typeof value === 'object' ? safeStringify(value) : String(value ?? '')} ))} {t('common.time')} {new Date(item.timestamp).toLocaleString()} ); }} /> )); const s = StyleSheet.create({ eventIcon: { width: 24, height: 24, borderRadius: Radius.SM, backgroundColor: Colors.primaryGhost, alignItems: 'center', justifyContent: 'center', }, eventIconText: { color: Colors.primary, fontSize: FontSize.XXS }, eventName: { fontSize: FontSize.MD, fontWeight: FontWeight.semibold, color: Colors.text }, time: { fontSize: FontSize.XS, color: Colors.textSecondary }, previewChip: { backgroundColor: Colors.surfaceElevated, borderRadius: Radius.XS, paddingHorizontal: Spacing.SM, paddingVertical: 2 }, previewText: { fontSize: FontSize.XS, color: Colors.textSecondary, lineHeight: 16 }, previewKey: { fontWeight: FontWeight.semibold, color: Colors.text }, eventBadge: { backgroundColor: Colors.primary, paddingHorizontal: Spacing.MD, paddingVertical: Spacing.XXS, borderRadius: Radius.SM }, eventBadgeText: { color: Colors.textInverse, fontSize: FontSize.MD, fontWeight: FontWeight.bold }, detailBody: { flex: 1 }, detailBodyContent: { padding: Spacing.MD, paddingBottom: 40 }, sectionWithCopy: { gap: Spacing.SM }, propsGrid: { gap: Spacing.MD }, propRow: {}, propKey: { fontSize: FontSize.SM, fontWeight: FontWeight.semibold, color: Colors.textSecondary, marginBottom: 2 }, propValue: { fontSize: FontSize.MD, color: Colors.text, lineHeight: 20 }, timingCard: { backgroundColor: Colors.surface, borderRadius: Radius.LG, padding: Spacing.MD, flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginTop: Spacing.XXS, }, timingLabel: { fontSize: FontSize.SM, color: Colors.textSecondary, fontWeight: FontWeight.medium }, timingValue: { fontSize: FontSize.SM, color: Colors.text }, });