import { Link } from 'react-router-dom' import { useRuns } from '../hooks/useRuns' import type { RunStatus } from '../types' const statusStyles: Record = { active: 'bg-green-100 text-green-800 dark:bg-green-900/40 dark:text-green-300', completed: 'bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300', failed: 'bg-red-100 text-red-800 dark:bg-red-900/40 dark:text-red-300', } export function Home() { const { data: runs, isLoading } = useRuns() const activeRun = runs?.find((r) => r.status === 'active') const recentRuns = runs?.slice(0, 5) return (

Nuzlocke Tracker

Track your Nuzlocke runs with ease

Start New Run
{isLoading && (
)} {activeRun && (

Continue Playing

{activeRun.name}

Started{' '} {new Date(activeRun.startedAt).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric', })}

Resume →
)} {recentRuns && recentRuns.length > 0 && (

Recent Runs

View all
{recentRuns.map((run) => (

{run.name}

{new Date(run.startedAt).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric', })}

{run.status}
))}
)} {runs && runs.length === 0 && (

No runs yet. Start your first Nuzlocke challenge above!

)}
) }