diff --git a/app/admin/page.tsx b/app/admin/page.tsx index 92b6bdc..3f313f3 100644 --- a/app/admin/page.tsx +++ b/app/admin/page.tsx @@ -23,8 +23,6 @@ import { Smile, FileText, Settings, - Database, - BarChart3, TrendingUp } from 'lucide-react'; import Link from 'next/link'; @@ -37,7 +35,7 @@ const apiService = { return response.json(); }, - async createProject(data: any) { + async createProject(data: Record) { const response = await fetch('/api/projects', { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -47,7 +45,7 @@ const apiService = { return response.json(); }, - async updateProject(id: number, data: any) { + async updateProject(id: number, data: Record) { const response = await fetch(`/api/projects/${id}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, @@ -65,7 +63,6 @@ const apiService = { return response.json(); } }; -import AdminDashboard from '@/components/AdminDashboard'; import ImportExport from '@/components/ImportExport'; import AnalyticsDashboard from '@/components/AnalyticsDashboard'; import { useToast } from '@/components/Toast'; diff --git a/app/api/analytics/dashboard/route.ts b/app/api/analytics/dashboard/route.ts index 4f2a88e..6083264 100644 --- a/app/api/analytics/dashboard/route.ts +++ b/app/api/analytics/dashboard/route.ts @@ -41,11 +41,11 @@ export async function GET(request: NextRequest) { totalProjects: projects.length, publishedProjects: projects.filter(p => p.published).length, featuredProjects: projects.filter(p => p.featured).length, - totalViews: projects.reduce((sum, p) => sum + ((p.analytics as any)?.views || 0), 0), - totalLikes: projects.reduce((sum, p) => sum + ((p.analytics as any)?.likes || 0), 0), - totalShares: projects.reduce((sum, p) => sum + ((p.analytics as any)?.shares || 0), 0), + totalViews: projects.reduce((sum, p) => sum + ((p.analytics as Record)?.views as number || 0), 0), + totalLikes: projects.reduce((sum, p) => sum + ((p.analytics as Record)?.likes as number || 0), 0), + totalShares: projects.reduce((sum, p) => sum + ((p.analytics as Record)?.shares as number || 0), 0), avgLighthouse: projects.length > 0 - ? Math.round(projects.reduce((sum, p) => sum + ((p.performance as any)?.lighthouse || 0), 0) / projects.length) + ? Math.round(projects.reduce((sum, p) => sum + ((p.performance as Record)?.lighthouse as number || 0), 0) / projects.length) : 0 }, projects: projects.map(project => ({ @@ -53,10 +53,10 @@ export async function GET(request: NextRequest) { title: project.title, category: project.category, difficulty: project.difficulty, - views: (project.analytics as any)?.views || 0, - likes: (project.analytics as any)?.likes || 0, - shares: (project.analytics as any)?.shares || 0, - lighthouse: (project.performance as any)?.lighthouse || 0, + views: (project.analytics as Record)?.views as number || 0, + likes: (project.analytics as Record)?.likes as number || 0, + shares: (project.analytics as Record)?.shares as number || 0, + lighthouse: (project.performance as Record)?.lighthouse as number || 0, published: project.published, featured: project.featured, createdAt: project.createdAt, diff --git a/app/api/projects/export/route.ts b/app/api/projects/export/route.ts index 22cfdac..eab0cbc 100644 --- a/app/api/projects/export/route.ts +++ b/app/api/projects/export/route.ts @@ -1,7 +1,7 @@ -import { NextRequest, NextResponse } from 'next/server'; +import { NextResponse } from 'next/server'; import { projectService } from '@/lib/prisma'; -export async function GET(request: NextRequest) { +export async function GET() { try { // Get all projects with full data const projectsResult = await projectService.getAllProjects(); diff --git a/app/api/projects/import/route.ts b/app/api/projects/import/route.ts index 32f7047..16b50f1 100644 --- a/app/api/projects/import/route.ts +++ b/app/api/projects/import/route.ts @@ -34,7 +34,7 @@ export async function POST(request: NextRequest) { } // Create new project - const newProject = await projectService.createProject({ + await projectService.createProject({ title: projectData.title, description: projectData.description, content: projectData.content, diff --git a/app/api/projects/route.ts b/app/api/projects/route.ts index d21fd5e..6467033 100644 --- a/app/api/projects/route.ts +++ b/app/api/projects/route.ts @@ -13,9 +13,6 @@ export async function GET(request: NextRequest) { const difficulty = searchParams.get('difficulty'); const search = searchParams.get('search'); - // Create cache key based on parameters - const cacheKey = `projects:${page}:${limit}:${category || 'all'}:${featured || 'all'}:${published || 'all'}:${difficulty || 'all'}:${search || 'all'}`; - // Check cache first const cached = await apiCache.getProjects(); if (cached && !search) { // Don't cache search results @@ -24,7 +21,7 @@ export async function GET(request: NextRequest) { const skip = (page - 1) * limit; - const where: any = {}; + const where: Record = {}; if (category) where.category = category; if (featured !== null) where.featured = featured === 'true'; diff --git a/components/AdminDashboard.tsx b/components/AdminDashboard.tsx index e78c0e3..5e62d53 100644 --- a/components/AdminDashboard.tsx +++ b/components/AdminDashboard.tsx @@ -1,23 +1,18 @@ "use client"; import { useState, useEffect } from 'react'; -import { motion, AnimatePresence } from 'framer-motion'; +import { motion } from 'framer-motion'; import { Database, Search, - Filter, BarChart3, Download, Upload, - Trash2, Edit, Eye, Plus, - Save, - Settings, TrendingUp, Users, - Clock, Star, Tag, FolderOpen, @@ -96,7 +91,7 @@ export default function AdminDashboard({ onProjectSelect, onNewProject }: AdminD return matchesSearch && matchesCategory; }) .sort((a, b) => { - let aValue: any, bValue: any; + let aValue: unknown, bValue: unknown; switch (sortBy) { case 'date': @@ -386,7 +381,7 @@ export default function AdminDashboard({ onProjectSelect, onNewProject }: AdminD