import React, { useEffect, useState } from 'react'; import { Download as DownloadIcon, Monitor, Server, HardDrive, Smartphone } from 'lucide-react'; export function DownloadPage() { const [userLocation, setUserLocation] = useState(null); const [userRegion, setUserRegion] = useState(null); // Detect user location using a public API useEffect(() => { async function fetchLocation() { try { const response = await fetch('https://ipapi.co/json/'); const data = await response.json(); setUserLocation(`${data.city}, ${data.country}`); setUserRegion(data.country); // Store the user's country or region } catch (error) { console.error('Failed to fetch user location:', error); setUserLocation(null); setUserRegion(null); } } fetchLocation(); }, []); // Find the closest mirror based on the user's region const getSuggestedMirror = () => { if (!userRegion) return null; // If region is not detected, return null // Normalize userRegion to handle cases like "United States" vs. "USA" const regionMap: { [key: string]: string } = { "united states": "north america", "canada": "north america", "brazil": "south america", "argentina": "south america", "germany": "europe", "france": "europe", "india": "asia", "japan": "asia", "south africa": "africa", "australia": "australia", }; // Lowercase the userRegion for more lenient matching const normalizedRegion = regionMap[userRegion.toLowerCase()] || userRegion.toLowerCase(); // Find the closest mirror based on the user's region return mirrorData.find((mirror) => mirror.region.toLowerCase().includes(normalizedRegion) ); }; const suggestedMirror = getSuggestedMirror(); return (
{/* Hero Section */}

Download Snigdha OS

Choose the edition that best suits your needs. All versions are free to download and use, providing the best experience for developers, students, and professionals alike.

Snigdha OS is designed to provide an unparalleled experience, whether you're working on an older device or a high-end system. Built with efficiency, reliability, and beauty in mind, it’s perfect for home users, professionals, and enterprises. Download today to unlock the full potential of your hardware.

{/* Edition Cards */}
{editionData.map((edition, index) => ( ))}
{/* System Requirements */}

System Requirements

{/* Download Mirrors */}

Download Mirrors

Select a mirror closest to your location for faster download speeds.{' '}
{userLocation ? ( Your detected location: {userLocation} ) : ( Detecting your location... )}

{mirrorData.map((mirror, index) => ( ))}
{suggestedMirror && (

Suggested Mirror for You

)}
); } // Components function FeatureBadge({ color, text, }: { color: string; text: string; }) { return ( {text} ); } function EditionCard({ title, description, keyFeatures, idealFor, icon, recommended, }: { title: string; description: string; keyFeatures: string[]; idealFor: string; icon: React.ReactNode; recommended?: boolean; }) { return (
{recommended && (
Recommended
)}
{icon}

{title}

{description}

Key Features:

    {keyFeatures.map((feature, index) => (
  • {feature}
  • ))}

Ideal For:

{idealFor}

); } function SystemRequirements({ title, specs, notes, }: { title: string; specs: string[]; notes: string; }) { return (

{title}

    {specs.map((spec, index) => (
  • {spec}
  • ))}

{notes}

); } function MirrorButton({ region, speed, host, url, suggested = false, // Added 'suggested' prop to highlight the suggested mirror }: { region: string; speed: string; host: string; url: string; suggested?: boolean; // Optional prop to check if this is the suggested mirror }) { const speedColor = { 'Very Fast': 'text-green-500', Fast: 'text-blue-500', Moderate: 'text-orange-500', }[speed]; return (

{region}

{host}

{speed}
{suggested && (
Suggested Mirror
)}
); } // Data const editionData = [ { title: 'Gnome Edition', description: 'Modern, innovative features while being traditional and familiar.', keyFeatures: ['Dynamic Workspaces', 'Extensible Extensions', 'Built-in Accessibility'], idealFor: 'General users who prefer a sleek and functional desktop experience.', icon: , recommended: true, }, { title: 'MATE Edition', description: 'Traditional desktop experience, highly stable and reliable.', keyFeatures: ['Low Resource Usage', 'Consistent Workflow', 'Legacy Support'], idealFor: 'Users who value simplicity and reliability over modern features.', icon: , }, { title: 'Xfce Edition', description: 'Lightweight and stable. Perfect for older computers.', keyFeatures: ['Minimal Resource Usage', 'Fast Boot Times', 'Highly Customizable'], idealFor: 'Users with older hardware or those who need maximum performance.', icon: , }, { title: 'KDE Plasma Edition', description: 'Feature-rich, eye-catching, and offers tons of customization.', keyFeatures: ['Cutting-edge Visuals', 'Full Customization', 'Highly Extensible'], idealFor: 'Power users who want control and beauty in equal measure.', icon: , }, ]; // Example of mirrorData (you can add more mirrors as needed) const mirrorData = [ { region: 'North America (USA)', speed: 'Very Fast', host: 'ExampleMirrorHost.com', url: 'https://example.com/download', }, { region: 'Europe (Germany)', speed: 'Fast', host: 'EU-Mirror.com', url: 'https://eu-mirror.com/download', }, { region: 'Asia (India)', speed: 'Moderate', host: 'IN-Mirror.com', url: 'https://in-mirror.com/download', }, ];