huge update
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user