'use client'; import { useEffect, useState } from 'react'; import Link from 'next/link'; import { Skeleton } from '@/components/ui/skeleton'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { useT } from '@/i18n'; import { API_BASE } from '@/lib/config'; import { ShoppingBag, CheckCircle, Heart } from 'lucide-react'; interface MarketplaceSkill { id: string; name: string; description: string; icon: string; category: string; difficulty: string; tags: string[]; price: number | null; purchased: boolean; sortOrder: number; } export default function MarketplacePage() { const t = useT(); const [skills, setSkills] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { const url = `${API_BASE}/skills/marketplace`; fetch(url, { credentials: 'include' }) .then((r) => r.json()) .then((data) => { setSkills(Array.isArray(data) ? data : []); }) .catch(() => {}) .finally(() => setLoading(false)); }, []); return (

{t.marketplace.title}

{t.marketplace.desc}

{t.marketplace.freeNote}

{t.donate.toDonate} →
{loading ? (
{[1, 2, 3, 4, 5, 6].map((i) => ( ))}
) : (
{skills.map((skill) => (
{skill.icon}

{skill.name}

{skill.description}

{(t.skills as any)[skill.difficulty]} {(t.skills.categories as any)[skill.category] || skill.category}
{skill.tags.slice(0, 3).map((tag) => ( {tag} ))}
{t.marketplace.free}
))}
)} {!loading && skills.length === 0 && (

{t.common.noData}

)}
); }