feat: implement advanced analytics for mobile admin dashboard
This commit includes: - Backend EventAnalyticsService and Controller - API endpoint for event analytics - Frontend EventAnalyticsPage with custom bar charts and top contributor lists - Analytics shortcut on the dashboard - Feature-lock upsell UI for non-premium users
This commit is contained in:
@@ -2856,6 +2856,35 @@ export async function removeEventMember(eventIdentifier: number | string, member
|
||||
throw new Error('Failed to remove member');
|
||||
}
|
||||
}
|
||||
export type AnalyticsTimelinePoint = {
|
||||
timestamp: string;
|
||||
count: number;
|
||||
};
|
||||
|
||||
export type AnalyticsContributor = {
|
||||
name: string;
|
||||
count: number;
|
||||
likes: number;
|
||||
};
|
||||
|
||||
export type AnalyticsTaskStat = {
|
||||
task_id: number;
|
||||
task_name: string;
|
||||
count: number;
|
||||
};
|
||||
|
||||
export type EventAnalytics = {
|
||||
timeline: AnalyticsTimelinePoint[];
|
||||
contributors: AnalyticsContributor[];
|
||||
tasks: AnalyticsTaskStat[];
|
||||
};
|
||||
|
||||
export async function getEventAnalytics(slug: string): Promise<EventAnalytics> {
|
||||
const response = await authorizedFetch(`${eventEndpoint(slug)}/analytics`);
|
||||
const data = await jsonOrThrow<EventAnalytics>(response, 'Failed to load analytics');
|
||||
return data;
|
||||
}
|
||||
|
||||
type CacheEntry<T> = {
|
||||
value?: T;
|
||||
expiresAt: number;
|
||||
|
||||
Reference in New Issue
Block a user