diff --git a/apps/dashboard/src/components/events/event-field-value.tsx b/apps/dashboard/src/components/events/event-field-value.tsx new file mode 100644 index 00000000..7ee55d1e --- /dev/null +++ b/apps/dashboard/src/components/events/event-field-value.tsx @@ -0,0 +1,77 @@ +import { fancyMinutes } from '@/hooks/useNumerFormatter'; +import { formatDateTime, formatTime } from '@/utils/date'; +import type { IServiceEvent } from '@openpanel/db'; +import { isToday } from 'date-fns'; +import { SerieIcon } from '../report-chart/common/serie-icon'; + +export function EventFieldValue({ + key, + value, + event, +}: { + key: keyof IServiceEvent; + value: any; + event: IServiceEvent; +}) { + if (!value) { + return null; + } + + if (value instanceof Date) { + return isToday(value) ? formatTime(value) : formatDateTime(value); + } + + switch (key) { + case 'osVersion': + return ( +