diff --git a/frontend/src/views/admin/AnalyticsView.vue b/frontend/src/views/admin/AnalyticsView.vue index e7481b8..5033608 100644 --- a/frontend/src/views/admin/AnalyticsView.vue +++ b/frontend/src/views/admin/AnalyticsView.vue @@ -5,11 +5,13 @@ import * as echarts from 'echarts' import type { ECharts } from 'echarts' import { useApi } from '@/composables/useApi' import { useAuthStore } from '@/stores/auth' +import { useToastStore } from '@/stores/toast' import type { AnalyticsSummary, TimeseriesData } from '@/types' import { safeFixed } from '@/utils/formatters' const api = useApi() const authStore = useAuthStore() +const toast = useToastStore() const timeRange = ref<'24h' | '7d' | '30d'>('7d') const loading = ref(true) @@ -45,8 +47,8 @@ const loadAnalytics = async () => { await nextTick() renderCharts() - } catch (error) { - console.error('Failed to load analytics:', error) + } catch { + toast.error('Failed to load analytics data') } finally { loading.value = false } @@ -206,8 +208,8 @@ const downloadCSV = async () => { a.download = `server_stats_${timeRange.value}.csv` a.click() window.URL.revokeObjectURL(url) - } catch (error) { - console.error('Failed to download CSV:', error) + } catch { + toast.error('Failed to download analytics export') } } @@ -304,12 +306,30 @@ onMounted(() => { - +
Available in Phase 2.2 — New vs returning players, session duration
+New Players
+\u2014
+First-time visitors
+Returning Players
+\u2014
+Seen more than once
+Avg Session Duration
+\u2014
+Per visit
+Player retention analytics will be available in Phase 2