diff --git a/dashboard/app/components/stats/Filter.tsx b/dashboard/app/components/stats/Filter.tsx index e8746c6..94f321a 100644 --- a/dashboard/app/components/stats/Filter.tsx +++ b/dashboard/app/components/stats/Filter.tsx @@ -92,6 +92,10 @@ const FILTER_OPTIONS: FilterOptions = { label: 'Language', placeholder: 'e.g. English', }, + property: { + label: 'Property', + placeholder: 'e.g. logged_in', + }, }; // Add this type guard function diff --git a/dashboard/app/components/stats/StatsTable.tsx b/dashboard/app/components/stats/StatsTable.tsx index 39fb6a0..50ed0a4 100644 --- a/dashboard/app/components/stats/StatsTable.tsx +++ b/dashboard/app/components/stats/StatsTable.tsx @@ -50,6 +50,7 @@ const LABEL_MAP: Record = { devices: 'Devices', countries: 'Countries', languages: 'Languages', + properties: 'Properties', } as const; const ACCESSOR_MAP: Record = { @@ -64,6 +65,7 @@ const ACCESSOR_MAP: Record = { devices: 'device', countries: 'country', languages: 'language', + properties: 'property', } as const; const FILTER_MAP: Record = { @@ -78,6 +80,7 @@ const FILTER_MAP: Record = { devices: 'device', countries: 'country', languages: 'language', + properties: 'property', } as const; const PAGE_SIZES = [10, 25, 50, 100] as const; @@ -415,6 +418,16 @@ const getColumnsForQuery = ( PRESET_COLUMNS.bounce_percentage, PRESET_COLUMNS.duration, ]; + case 'properties': + return [ + { + accessor: ACCESSOR_MAP[query], + title: 'Property', + width: '100%', + render: (record) => record.property || 'Unknown', + }, + PRESET_COLUMNS.visitors, + ]; default: throw new Error(`Invalid query: ${query}`); } diff --git a/dashboard/app/components/stats/types.ts b/dashboard/app/components/stats/types.ts index b3483bf..1bdf5b7 100644 --- a/dashboard/app/components/stats/types.ts +++ b/dashboard/app/components/stats/types.ts @@ -93,6 +93,7 @@ const FILTERS = [ 'device', 'country', 'language', + 'property', ] as const; type Filter = (typeof FILTERS)[number]; diff --git a/dashboard/app/utils/stats.ts b/dashboard/app/utils/stats.ts index 3721a7f..830ed43 100644 --- a/dashboard/app/utils/stats.ts +++ b/dashboard/app/utils/stats.ts @@ -21,7 +21,7 @@ import { generateFilters } from './filters'; const DataSetWithSummary = [...DATASETS, 'summary'] as const; type DatasetItem = (typeof DataSetWithSummary)[number]; -type Datasets = readonly Dataset[]; +type Datasets = readonly DatasetItem[]; interface FetchStatsOptions { dataset?: Datasets;