From 07af29e6e6c285ab41e6a08e3935b6056172c2aa Mon Sep 17 00:00:00 2001
From: Josh Creek <8179928+jcreek@users.noreply.github.com>
Date: Fri, 9 Jan 2026 18:45:47 +0000
Subject: [PATCH] chore(#67): Address pr comments
---
scripts/sql-to-csv.js | 87 -----
.../pokedex/PokedexViewBoxes.svelte | 19 +-
src/lib/models/PokedexEntry.ts | 2 -
.../repositories/CombinedDataRepository.ts | 48 +--
.../repositories/PokedexEntryRepository.ts | 21 +-
src/routes/api/seed/+server.ts | 99 -----
src/routes/auth/confirm/+server.ts | 2 +-
src/routes/my-pokedexes/+page.svelte | 24 +-
src/routes/pokedex/[id]/+page.svelte | 202 +++++++---
src/routes/welcome/+page.svelte | 365 ++++++++++++++++++
.../migrations/20260105160807_seed_johto.sql | 4 +-
11 files changed, 538 insertions(+), 335 deletions(-)
delete mode 100644 scripts/sql-to-csv.js
delete mode 100644 src/routes/api/seed/+server.ts
create mode 100644 src/routes/welcome/+page.svelte
diff --git a/scripts/sql-to-csv.js b/scripts/sql-to-csv.js
deleted file mode 100644
index b28d67f..0000000
--- a/scripts/sql-to-csv.js
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * Converts Kanto seed SQL migration to CSV format
- * Parses 20260104000001_seed_kanto.sql and generates:
- * - data/pokemon/gen1-kanto.csv
- * - data/pokemon/games.csv
- */
-
-import fs from 'fs';
-import path from 'path';
-import { fileURLToPath } from 'url';
-
-const __filename = fileURLToPath(import.meta.url);
-const __dirname = path.dirname(__filename);
-
-// Read the SQL migration file
-const sqlPath = path.join(__dirname, '..', 'supabase', 'migrations', '20260104000001_seed_kanto.sql');
-const sqlContent = fs.readFileSync(sqlPath, 'utf-8');
-
-// Extract games from region_game_mappings section
-const gameMatches = [...sqlContent.matchAll(/\('Kanto', '([^']+)'\)/g)];
-const games = gameMatches.map(m => m[1]);
-
-console.log(`Found ${games.length} Kanto games:`, games);
-
-// Extract Pokemon entries from INSERT statement
-// Match pattern: (number, 'name', form, boolean, 'region', ARRAY[games], ...)
-const valuePattern = /\((\d+),\s*'([^']+)',\s*(NULL|'[^']+'),\s*(true|false),\s*'[^']+',\s*ARRAY\[([^\]]+)\][^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,\s*(NULL|\d+)\)/g;
-
-const pokemon = [];
-let match;
-while ((match = valuePattern.exec(sqlContent)) !== null) {
- const [_, pokedexNumber, name, formRaw, canGigantamax, gamesRaw, regionalNumberRaw] = match;
-
- // Parse form (NULL or 'Female')
- const form = formRaw === 'NULL' ? '' : formRaw.replace(/'/g, '');
-
- // Parse games array - extract game names from ARRAY['Red', 'Blue', ...]
- const gamesList = gamesRaw.match(/'([^']+)'/g).map(g => g.replace(/'/g, ''));
- const gamesStr = gamesList.join('|');
-
- // Parse regional number
- const regionalNumber = regionalNumberRaw === 'NULL' ? '' : regionalNumberRaw;
-
- pokemon.push({
- pokedexNumber,
- name,
- form,
- games: gamesStr,
- regionalNumber
- });
-}
-
-console.log(`Extracted ${pokemon.length} Pokemon entries`);
-
-// Generate gen1-kanto.csv
-const kantoCSV = [
- 'pokedexNumber,name,form,games,regionalNumber',
- ...pokemon.map(p => {
- const form = p.form.includes(',') ? `"${p.form}"` : p.form;
- const games = p.games.includes(',') ? `"${p.games}"` : p.games;
- return `${p.pokedexNumber},${p.name},${form},${games},${p.regionalNumber}`;
- })
-].join('\n');
-
-const kantoPath = path.join(__dirname, '..', 'data', 'pokemon', 'gen1-kanto.csv');
-fs.writeFileSync(kantoPath, kantoCSV);
-console.log(`✓ Created ${kantoPath}`);
-
-// Generate games.csv
-const gamesCSV = [
- 'id,displayName,region,generation',
- ...games.map((game, idx) => {
- const id = game.toLowerCase().replace(/[^a-z0-9]/g, '-');
- const generation = game.startsWith('LG:') ? 7 : 1;
- return `${id},${game},Kanto,${generation}`;
- })
-].join('\n');
-
-const gamesPath = path.join(__dirname, '..', 'data', 'pokemon', 'games.csv');
-fs.writeFileSync(gamesPath, gamesCSV);
-console.log(`✓ Created ${gamesPath}`);
-
-console.log('\n✅ Conversion complete!');
-console.log(` gen1-kanto.csv: ${pokemon.length} entries`);
-console.log(` games.csv: ${games.length} games`);
diff --git a/src/lib/components/pokedex/PokedexViewBoxes.svelte b/src/lib/components/pokedex/PokedexViewBoxes.svelte
index 624c0ac..f6bb523 100644
--- a/src/lib/components/pokedex/PokedexViewBoxes.svelte
+++ b/src/lib/components/pokedex/PokedexViewBoxes.svelte
@@ -1,12 +1,11 @@
Please sign in
+{:else if !pokedex} +Loading...
{:else}Check Your Email
++ We've sent you a magic link to verify your account. Click the link in your email + to sign in and start tracking your Pokédex progress. +
++ After clicking the link, you'll be automatically signed in and can start tracking your + Pokémon catches across all generations! +
+ + ++ Haven't received the email? Check your spam or junk + folder. +
++ Still having trouble? + + Contact support + for assistance. +
+Check your email
+Look for our verification email in your inbox
+Click the magic link
+This will sign you in and verify your account
+Start tracking your Pokémon
++ Create your first Pokédex and begin your journey! +
++ Manage different Living Dex challenges across all generations +
+Connect with friends and share your Pokédex journey
+Track your catches even without an internet connection
+