'use client' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import Link from 'next/link' import { RiArrowRightLine, RiAwardLine } from '@remixicon/react' import { fetchChallenges } from '@/service/challenges' import type { ChallengeListItem } from '@/service/challenges' export default function ChallengesListPage() { const { t } = useTranslation() const [challenges, setChallenges] = useState([]) const [loading, setLoading] = useState(true) useEffect(() => { const load = async () => { try { const data = await fetchChallenges() console.log('Loaded challenges:', data) setChallenges(data) } catch (error) { console.error('Failed to load challenges:', error) } finally { setLoading(false) } } load() }, []) return (

{t('challenges.player.browse')}

Test your skills and compete on the leaderboard

{loading ? (
{t('common.loading')}
) : challenges.length === 0 ? (
No challenges available yet
) : (
{challenges.map(challenge => (

{challenge.name}

{challenge.description && (

{challenge.description}

)} {challenge.goal && (
Goal
{challenge.goal}
)}
))}
)}
) }