huge update

This commit is contained in:
2025-09-10 10:59:14 +02:00
parent be01ee2adb
commit 2f40fc6753
15 changed files with 729 additions and 301 deletions

View File

@@ -1,6 +1,6 @@
'use client';
import { useState, useEffect } from 'react';
import { useState, useEffect, useCallback } from 'react';
import { motion } from 'framer-motion';
import {
BarChart3,
@@ -8,16 +8,12 @@ import {
Eye,
Heart,
Zap,
Users,
Clock,
Globe,
Activity,
Target,
Award,
RefreshCw,
Calendar,
MousePointer,
Monitor,
RotateCcw,
Trash2,
AlertTriangle
@@ -76,7 +72,7 @@ export function AnalyticsDashboard({ isAuthenticated }: AnalyticsDashboardProps)
const [resetType, setResetType] = useState<'analytics' | 'pageviews' | 'interactions' | 'performance' | 'all'>('analytics');
const [resetting, setResetting] = useState(false);
const fetchAnalyticsData = async () => {
const fetchAnalyticsData = useCallback(async () => {
if (!isAuthenticated) return;
try {
@@ -132,7 +128,7 @@ export function AnalyticsDashboard({ isAuthenticated }: AnalyticsDashboardProps)
} finally {
setLoading(false);
}
};
}, [isAuthenticated]);
const resetAnalytics = async () => {
if (!isAuthenticated || resetting) return;
@@ -167,7 +163,7 @@ export function AnalyticsDashboard({ isAuthenticated }: AnalyticsDashboardProps)
if (isAuthenticated) {
fetchAnalyticsData();
}
}, [isAuthenticated, timeRange]);
}, [isAuthenticated, fetchAnalyticsData]);
const StatCard = ({ title, value, icon: Icon, color, trend, trendValue, description }: {
title: string;
@@ -530,7 +526,7 @@ export function AnalyticsDashboard({ isAuthenticated }: AnalyticsDashboardProps)
<label className="block text-white/80 text-sm mb-2">Reset Type</label>
<select
value={resetType}
onChange={(e) => setResetType(e.target.value as any)}
onChange={(e) => setResetType(e.target.value as 'all' | 'performance' | 'analytics')}
className="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-red-500"
>
<option value="analytics">Analytics Only (views, likes, shares)</option>