Add export buttons to all admin panel screens

Backend export endpoints return DB data in seed JSON format
(games, routes+encounters, pokemon, evolutions). Frontend
downloads the JSON via new Export buttons on each admin page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 10:50:14 +01:00
parent 8fbf658a27
commit 5cdcd149b6
9 changed files with 236 additions and 21 deletions

View File

@@ -8,6 +8,8 @@ import {
useUpdateEvolution,
useDeleteEvolution,
} from '../../hooks/useAdmin'
import { exportEvolutions } from '../../api/admin'
import { downloadJson } from '../../utils/download'
import type { EvolutionAdmin, CreateEvolutionInput, UpdateEvolutionInput } from '../../types'
const PAGE_SIZE = 50
@@ -80,12 +82,23 @@ export function AdminEvolutions() {
<div>
<div className="flex justify-between items-center mb-4">
<h2 className="text-xl font-semibold">Evolutions</h2>
<button
onClick={() => setShowCreate(true)}
className="px-4 py-2 text-sm font-medium rounded-md bg-blue-600 text-white hover:bg-blue-700"
>
Add Evolution
</button>
<div className="flex gap-2">
<button
onClick={async () => {
const data = await exportEvolutions()
downloadJson(data, 'evolutions.json')
}}
className="px-4 py-2 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"
>
Export
</button>
<button
onClick={() => setShowCreate(true)}
className="px-4 py-2 text-sm font-medium rounded-md bg-blue-600 text-white hover:bg-blue-700"
>
Add Evolution
</button>
</div>
</div>
<div className="mb-4 flex items-center gap-4">