"use client"; import React, { useState, useRef, useEffect } from 'react'; import { Search, Filter, Grid, List, Play, Pause, Volume2, VolumeX, Eye, Bookmark, Share, Download, Clock, TrendingUp, Globe, Calendar, Tag, ExternalLink, MoreHorizontal, ChevronLeft, ChevronRight, Heart, MessageCircle, Video, Image, Music, FileText, Rss, Archive, Star, ThumbsUp, Settings, RefreshCw, Maximize, User, MapPin, Zap, Briefcase, Gamepad2, Palette, Users, Award, ShoppingBag, Plane, DollarSign, Newspaper, AlertTriangle, Target, Mic, Camera } from 'lucide-react'; import { cn } from "@/lib/utils"; // Mock news data - realistic news structure const mockNews = [ { id: 1, headline: "Major Climate Summit Reaches Breakthrough Agreement on Carbon Reduction", summary: "World leaders agree to unprecedented measures targeting 50% reduction in emissions by 2030, with binding commitments from major economies.", content: "In a historic development at the Global Climate Summit, representatives from 195 countries have agreed to a comprehensive framework...", author: "Sarah Chen", publication: "Global Times", publishedAt: "2025-01-15T14:30:00Z", category: "Environment", subcategory: "Climate Change", readTime: "8 min read", mediaType: "article", imageUrl: "/api/placeholder/800/400", videoUrl: null, audioUrl: null, tags: ["climate", "politics", "international", "environment"], location: "Geneva, Switzerland", breaking: true, featured: true, viewCount: 45670, shareCount: 1240, commentCount: 892, bookmarkCount: 2130, sentiment: "positive", credibilityScore: 0.94 }, { id: 2, headline: "Tech Giant Announces Revolutionary AI Chip Architecture", summary: "New quantum-enhanced processing unit promises 1000x performance improvement for AI workloads, reshaping the semiconductor industry.", content: "Silicon Valley's leading tech company unveiled its latest innovation today, a groundbreaking AI chip that combines...", author: "Marcus Rodriguez", publication: "Tech Weekly", publishedAt: "2025-01-15T12:45:00Z", category: "Technology", subcategory: "AI & Computing", readTime: "6 min read", mediaType: "video", imageUrl: "/api/placeholder/800/400", videoUrl: "/api/placeholder/video", audioUrl: null, videoDuration: "15:32", tags: ["ai", "technology", "semiconductors", "innovation"], location: "San Francisco, CA", breaking: false, featured: true, viewCount: 78234, shareCount: 2156, commentCount: 445, bookmarkCount: 3421, sentiment: "positive", credibilityScore: 0.91 }, { id: 3, headline: "Global Markets React to Federal Reserve Interest Rate Decision", summary: "Stock markets surge as Fed maintains current rates, signaling confidence in economic recovery and inflation control measures.", content: "Financial markets around the world responded positively to the Federal Reserve's decision to maintain...", author: "Elena Vasquez", publication: "Financial Herald", publishedAt: "2025-01-15T11:20:00Z", category: "Business", subcategory: "Markets", readTime: "5 min read", mediaType: "article", imageUrl: "/api/placeholder/800/400", videoUrl: null, audioUrl: null, tags: ["finance", "fed", "markets", "economy"], location: "New York, NY", breaking: false, featured: false, viewCount: 34567, shareCount: 876, commentCount: 234, bookmarkCount: 1456, sentiment: "neutral", credibilityScore: 0.96 }, { id: 4, headline: "Space Mission Discovers Evidence of Ancient Water on Mars", summary: "NASA's latest rover findings reveal extensive underground water systems, raising new questions about potential for past life.", content: "The Mars exploration mission has yielded its most significant discovery yet, with clear evidence of...", author: "Dr. James Mitchell", publication: "Science Today", publishedAt: "2025-01-15T09:15:00Z", category: "Science", subcategory: "Space", readTime: "10 min read", mediaType: "multimedia", imageUrl: "/api/placeholder/800/400", videoUrl: "/api/placeholder/video", audioUrl: "/api/placeholder/audio", videoDuration: "8:45", audioDuration: "12:30", tags: ["space", "mars", "nasa", "discovery"], location: "Pasadena, CA", breaking: false, featured: true, viewCount: 92341, shareCount: 4567, commentCount: 1234, bookmarkCount: 5678, sentiment: "positive", credibilityScore: 0.98 }, { id: 5, headline: "Championship Final Breaks Viewership Records Worldwide", summary: "Historic match draws over 2 billion viewers globally, showcasing the growing international appeal of the sport.", content: "Last night's championship final has set a new benchmark for global sports viewership...", author: "Alex Thompson", publication: "Sports Central", publishedAt: "2025-01-15T08:30:00Z", category: "Sports", subcategory: "Football", readTime: "4 min read", mediaType: "video", imageUrl: "/api/placeholder/800/400", videoUrl: "/api/placeholder/video", audioUrl: null, videoDuration: "22:15", tags: ["sports", "football", "championship", "records"], location: "London, UK", breaking: false, featured: false, viewCount: 156789, shareCount: 8901, commentCount: 3456, bookmarkCount: 2345, sentiment: "positive", credibilityScore: 0.89 } ]; const categories = [ { id: 'all', name: 'All News', icon: Newspaper, color: 'text-gray-600' }, { id: 'breaking', name: 'Breaking', icon: AlertTriangle, color: 'text-red-600' }, { id: 'politics', name: 'Politics', icon: Users, color: 'text-blue-600' }, { id: 'technology', name: 'Technology', icon: Zap, color: 'text-purple-600' }, { id: 'business', name: 'Business', icon: Briefcase, color: 'text-green-600' }, { id: 'science', name: 'Science', icon: Target, color: 'text-indigo-600' }, { id: 'sports', name: 'Sports', icon: Award, color: 'text-orange-600' }, { id: 'entertainment', name: 'Entertainment', icon: Palette, color: 'text-pink-600' }, { id: 'health', name: 'Health', icon: Heart, color: 'text-emerald-600' }, { id: 'world', name: 'World', icon: Globe, color: 'text-cyan-600' } ]; const formatDate = (dateString) => { const date = new Date(dateString); const now = new Date(); const diffMs = now - date; const diffHours = Math.floor(diffMs / (1000 * 60 * 60)); const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); if (diffHours < 1) return 'Just now'; if (diffHours < 24) return `${diffHours}h ago`; if (diffDays < 7) return `${diffDays}d ago`; return date.toLocaleDateString(); }; const formatNumber = (num) => { if (num >= 1000000) return `${(num / 1000000).toFixed(1)}M`; if (num >= 1000) return `${(num / 1000).toFixed(1)}K`; return num.toString(); }; const MediaPlayer = ({ article, onClose }) => { const [isPlaying, setIsPlaying] = useState(false); const [isMuted, setIsMuted] = useState(false); const [currentTime, setCurrentTime] = useState(0); const [duration, setDuration] = useState(0); const videoRef = useRef(null); const audioRef = useRef(null); const togglePlay = () => { if (article.mediaType === 'video' && videoRef.current) { if (isPlaying) { videoRef.current.pause(); } else { videoRef.current.play(); } setIsPlaying(!isPlaying); } }; const toggleMute = () => { if (videoRef.current) { videoRef.current.muted = !isMuted; setIsMuted(!isMuted); } }; return (

{article.headline}

{article.mediaType === 'video' && (
{article.videoDuration}
)} {article.mediaType === 'audio' && (
)}
{article.author} • {article.publication} • {formatDate(article.publishedAt)}

{article.summary}

); }; const NewsCard = ({ article, layout = 'grid', onPlay, onBookmark, onShare }) => { const getMediaIcon = () => { switch (article.mediaType) { case 'video': return