diff --git a/resources/js/admin/i18n/locales/de/management.json b/resources/js/admin/i18n/locales/de/management.json index a64ac60..6a6f4ca 100644 --- a/resources/js/admin/i18n/locales/de/management.json +++ b/resources/js/admin/i18n/locales/de/management.json @@ -2877,16 +2877,24 @@ "analytics": { "title": "Analytics", "upgradeAction": "Upgrade auf Premium", + "kpiTitle": "Event-Überblick", + "kpiUploads": "Uploads", + "kpiContributors": "Beitragende", + "kpiLikes": "Likes", "activityTitle": "Aktivitäts-Zeitachse", + "timeframe": "Letzte {{hours}} Stunden", "uploadsPerHour": "Uploads pro Stunde", "noActivity": "Noch keine Uploads", + "emptyActionShareQr": "QR-Code teilen", "contributorsTitle": "Top-Beitragende", "likesCount": "{{count}} Likes", "likesCount_one": "{{count}} Like", "likesCount_other": "{{count}} Likes", "noContributors": "Noch keine Beitragenden", + "emptyActionInvite": "Gäste einladen", "tasksTitle": "Beliebte Aufgaben", "noTasks": "Noch keine Aufgabenaktivität", + "emptyActionOpenTasks": "Aufgaben öffnen", "lockedTitle": "Analytics freischalten", "lockedBody": "Erhalte tiefe Einblicke in die Interaktionen deines Events mit dem Premium-Paket." }, diff --git a/resources/js/admin/i18n/locales/en/management.json b/resources/js/admin/i18n/locales/en/management.json index 69827a8..9a59bbc 100644 --- a/resources/js/admin/i18n/locales/en/management.json +++ b/resources/js/admin/i18n/locales/en/management.json @@ -2881,16 +2881,24 @@ "analytics": { "title": "Analytics", "upgradeAction": "Upgrade to Premium", + "kpiTitle": "Event snapshot", + "kpiUploads": "Uploads", + "kpiContributors": "Contributors", + "kpiLikes": "Likes", "activityTitle": "Activity Timeline", + "timeframe": "Last {{hours}} hours", "uploadsPerHour": "Uploads per hour", "noActivity": "No uploads yet", + "emptyActionShareQr": "Share your QR code", "contributorsTitle": "Top Contributors", "likesCount": "{{count}} likes", "likesCount_one": "{{count}} like", "likesCount_other": "{{count}} likes", "noContributors": "No contributors yet", + "emptyActionInvite": "Invite guests", "tasksTitle": "Popular Tasks", "noTasks": "No task activity yet", + "emptyActionOpenTasks": "Open tasks", "lockedTitle": "Unlock Analytics", "lockedBody": "Get deep insights into your event engagement with the Premium package." }, diff --git a/resources/js/admin/mobile/EventAnalyticsPage.tsx b/resources/js/admin/mobile/EventAnalyticsPage.tsx index d95acc7..31c9d08 100644 --- a/resources/js/admin/mobile/EventAnalyticsPage.tsx +++ b/resources/js/admin/mobile/EventAnalyticsPage.tsx @@ -2,14 +2,14 @@ import React from 'react'; import { useParams, useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { useQuery } from '@tanstack/react-query'; -import { TrendingUp, ListTodo, Lock, Trophy } from 'lucide-react'; +import { TrendingUp, Users, ListTodo, Lock, Trophy } from 'lucide-react'; import { YStack, XStack } from '@tamagui/stacks'; import { SizableText as Text } from '@tamagui/text'; import { format, parseISO } from 'date-fns'; import { de, enGB } from 'date-fns/locale'; import { MobileShell } from './components/MobileShell'; -import { MobileCard, CTAButton, SkeletonCard } from './components/Primitives'; +import { MobileCard, CTAButton, KpiTile, SkeletonCard } from './components/Primitives'; import { getEventAnalytics, EventAnalytics } from '../api'; import { ApiError } from '../lib/apiError'; import { useAdminTheme } from './theme'; @@ -98,10 +98,14 @@ export default function MobileEventAnalyticsPage() { const hasTimeline = timeline.length > 0; const hasContributors = contributors.length > 0; const hasTasks = tasks.length > 0; + const timeframeHours = 12; // Prepare chart data const maxTimelineCount = resolveMaxCount(timeline.map((point) => point.count)); const maxTaskCount = resolveMaxCount(tasks.map((task) => task.count)); + const totalUploads = timeline.reduce((total, point) => total + point.count, 0); + const totalLikes = contributors.reduce((total, contributor) => total + contributor.likes, 0); + const totalContributors = contributors.length; return ( navigate(-1)} > + + + {t('analytics.kpiTitle', 'Event snapshot')} + + + + + + + {/* Activity Timeline */} @@ -118,6 +144,9 @@ export default function MobileEventAnalyticsPage() { {t('analytics.activityTitle', 'Activity Timeline')} + + {t('analytics.timeframe', 'Last {{hours}} hours', { hours: timeframeHours })} + {hasTimeline ? ( @@ -152,7 +181,11 @@ export default function MobileEventAnalyticsPage() { ) : ( - + slug && navigate(adminPath(`/mobile/events/${slug}/qr`))} + /> )} @@ -198,7 +231,11 @@ export default function MobileEventAnalyticsPage() { ))} ) : ( - + slug && navigate(adminPath(`/mobile/events/${slug}/members`))} + /> )} @@ -238,7 +275,11 @@ export default function MobileEventAnalyticsPage() { })} ) : ( - + slug && navigate(adminPath(`/mobile/events/${slug}/tasks`))} + /> )} @@ -246,13 +287,24 @@ export default function MobileEventAnalyticsPage() { ); } -function EmptyState({ message }: { message: string }) { +function EmptyState({ + message, + actionLabel, + onAction, +}: { + message: string; + actionLabel?: string; + onAction?: () => void; +}) { const { muted } = useAdminTheme(); return ( - + {message} + {actionLabel && onAction ? ( + + ) : null} ); }