"use client" import { Card, CardContent } from "@/components/ui/card" import { Camera, MapPin, Calendar, Hash } from "lucide-react" interface Photo { id: number src: string title: string description: string category: string tags: string[] date: string exif: { camera: string lens: string settings: string location: string } } interface TimelineStatsProps { photos: Photo[] } export function TimelineStats({ photos }: TimelineStatsProps) { // Calculate statistics const totalPhotos = photos.length const uniqueLocations = new Set(photos.map((p) => p.exif.location)).size const uniqueCameras = new Set(photos.map((p) => p.exif.camera)).size const dateRange = photos.length > 0 ? { start: new Date(Math.min(...photos.map((p) => new Date(p.date).getTime()))), end: new Date(Math.max(...photos.map((p) => new Date(p.date).getTime()))), } : null const stats = [ { icon: Camera, label: "总作品数", value: totalPhotos, color: "text-blue-600", }, { icon: MapPin, label: "拍摄地点", value: uniqueLocations, color: "text-green-600", }, { icon: Hash, label: "使用设备", value: uniqueCameras, color: "text-purple-600", }, { icon: Calendar, label: "创作时间", value: dateRange ? `${dateRange.start.getFullYear()}-${dateRange.end.getFullYear()}` : "N/A", color: "text-orange-600", }, ] return (
{stats.map((stat, index) => (
{stat.value}
{stat.label}
))}
) }