"use client"; import { useState, useEffect } from "react"; import { motion, Variants } from "framer-motion"; import { Button } from "@/components/ui/button"; import { Monitor, Smartphone, Terminal, Apple, Download, ExternalLink, Bell, Loader2, Clock, } from "lucide-react"; import { Dictionary } from "@/lib/IDict"; import { pb, type PBDownload, getPbFileUrl } from "@/lib/pb"; interface DownloadClientProps { dict: Dictionary["download"]; lang: string; } export function DownloadClient({ dict, lang }: DownloadClientProps) { const [platforms, setPlatforms] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { async function fetchDownloads() { try { setLoading(true); const records = await pb .collection(`downloads_${lang}`) .getFullList({ sort: "order", requestKey: null, }); setPlatforms(records); } catch (error) { console.error("Ошибка загрузки данных платформы:", error); } finally { setLoading(false); } } fetchDownloads(); }, [lang]); // Единый конфиг стилей: Primary (Фиолетовый) для базы, Secondary (Циан) для акцентов const getPlatformIcon = (platformId: string) => { const props = { className: "size-8 text-secondary drop-shadow-[0_0_10px_rgba(0,229,242,0.8)]", }; switch (platformId) { case "windows": return ; case "linux": return ; case "android": return ; case "macos": case "ios": return ; default: return ; } }; const containerVariants: Variants = { hidden: { opacity: 0 }, show: { opacity: 1, transition: { staggerChildren: 0.1 }, }, }; const itemVariants: Variants = { hidden: { opacity: 0, y: 40 }, show: { opacity: 1, y: 0, transition: { type: "spring", stiffness: 300, damping: 24 }, }, }; return (
{/* Мягкое фоновое свечение */}

{dict.title}

{dict.subtitle}

{loading ? (
Accessing_Build_Server...
) : ( {platforms.map((platform) => ( {/* Статус бейдж */}
{platform.status === "active" ? (
{dict.badges.active}
) : (
{dict.badges.dev}
)}
{/* Иконка в Циановом (Secondary) стиле */}
{getPlatformIcon(platform.platformId)}

{platform.name}

{platform.version}

{/* Кнопки действий: Основная всегда Фиолетовая (Primary) */}
{platform.status === "active" ? ( <> {/* Прямое скачивание */} {platform.file ? ( ) : ( )} {/* Ссылка на магазин (Вместо GitHub) */} {platform.storeLink ? ( ) : ( )} ) : ( // В разработке )}
))}
)}
); }