forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalytics.ts
More file actions
96 lines (75 loc) · 2.66 KB
/
Copy pathanalytics.ts
File metadata and controls
96 lines (75 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Core category types used across the dashboard
export type GistCategory =
| 'Events'
| 'Food'
| 'Safety'
| 'Tips'
| 'News'
| 'Transit'
| 'Markets'
| 'Other';
export type ScatterCategory = 'Tech' | 'Finance' | 'AI' | 'Web3';
// ── Summary stats (top-of-dashboard KPIs) ────────────────────────────────────
export interface LocationData {
location: string;
count: number;
trend: number[]; // 7-day daily gist counts
}
export interface GistStats {
totalGists: number;
todayGists: number;
activeUsers: number;
topLocations: LocationData[];
}
// ── User growth (area chart, 90-day window) ───────────────────────────────────
export interface UserGrowthPoint {
date: string; // display label, e.g. "1 Jan"
newUsers: number;
returning: number;
}
export interface UserGrowthData {
days: UserGrowthPoint[];
}
// ── Category distribution (pie chart) ────────────────────────────────────────
export interface CategoryStat {
label: GistCategory;
count: number;
}
export interface CategoryDistribution {
categories: CategoryStat[];
total: number;
}
// ── Platform usage (radar chart) ─────────────────────────────────────────────
export interface PlatformMetric {
label: string;
thisMonth: number;
lastMonth: number;
}
export interface PlatformUsage {
metrics: PlatformMetric[];
}
// ── Scatter data (age vs engagement) ─────────────────────────────────────────
export interface ScatterPoint {
id: string;
age: number; // days since posting
engagement: number; // interaction count
category: ScatterCategory;
}
// ── Live activity feed ────────────────────────────────────────────────────────
export interface RecentGistActivity {
id: string;
location: string;
category: GistCategory;
timestamp: number; // Unix ms
}
// ── API response wrapper ──────────────────────────────────────────────────────
export interface ApiResponse<T> {
data: T;
ok: true;
}
export interface ApiError {
ok: false;
error: string;
status?: number;
}
export type ApiResult<T> = ApiResponse<T> | ApiError;