+ {/* Pokemon Selection (only for new encounters) */}
+ {!isEditing && (
+
+
+ {loadingPokemon ? (
+
+ ) : filteredPokemon && filteredPokemon.length > 0 ? (
+ <>
+ {(routePokemon?.length ?? 0) > 6 && (
+
setSearch(e.target.value)}
+ className="w-full px-3 py-1.5 mb-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
+ />
+ )}
+
+ {filteredPokemon.map((rp) => (
+
+ ))}
+
+ >
+ ) : (
+
+ No pokemon data for this route
+
+ )}
+
+ )}
+
+ {/* Editing: show pokemon info */}
+ {isEditing && existing && (
+
+ {existing.pokemon.spriteUrl ? (
+

+ ) : (
+
+ {existing.pokemon.name[0].toUpperCase()}
+
+ )}
+
+
+ {existing.pokemon.name}
+
+
+ Caught at Lv. {existing.catchLevel ?? '?'}
+
+
+
+ )}
+
+ {/* Status */}
+
+
+
+ {statusOptions.map((opt) => (
+
+ ))}
+
+
+
+ {/* Nickname (for caught) */}
+ {status === 'caught' && (
+
+
+ setNickname(e.target.value)}
+ placeholder="Give it a name..."
+ className="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"
+ />
+
+ )}
+
+ {/* Level (for new caught encounters) */}
+ {!isEditing && status === 'caught' && (
+
+
+ setCatchLevel(e.target.value)}
+ placeholder={
+ selectedPokemon
+ ? `${selectedPokemon.minLevel}–${selectedPokemon.maxLevel}`
+ : 'Level'
+ }
+ className="w-24 px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"
+ />
+
+ )}
+
+ {/* Faint Level (only when editing a caught pokemon to mark dead) */}
+ {isEditing &&
+ existing?.status === 'caught' &&
+ existing?.faintLevel === null && (
+
+
+ setFaintLevel(e.target.value)}
+ placeholder="Leave empty if still alive"
+ className="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"
+ />
+
+ )}
+