Add egg encounter logging with route-lock bypass

Egg hatches can now be logged at any location without consuming the
route's encounter slot. Adds an EggEncounterModal with pokemon search
and a "Log Egg" button on the run encounters page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 22:25:47 +01:00
parent 8bd4ad1ecf
commit 35df9023f1
5 changed files with 300 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ import { useCreateEncounter, useUpdateEncounter, useBulkRandomize } from '../hoo
import { usePokemonFamilies } from '../hooks/usePokemon'
import { useGameBosses, useBossResults, useCreateBossResult } from '../hooks/useBosses'
import {
EggEncounterModal,
EncounterModal,
EncounterMethodBadge,
StatCard,
@@ -410,6 +411,7 @@ export function RunEncounters() {
useState<EncounterDetail | null>(null)
const [showEndRun, setShowEndRun] = useState(false)
const [showShinyModal, setShowShinyModal] = useState(false)
const [showEggModal, setShowEggModal] = useState(false)
const [expandedBosses, setExpandedBosses] = useState<Set<number>>(new Set())
const [showTeam, setShowTeam] = useState(true)
const [filter, setFilter] = useState<'all' | RouteStatus>('all')
@@ -675,6 +677,7 @@ export function RunEncounters() {
setSelectedRoute(null)
setEditingEncounter(null)
setShowShinyModal(false)
setShowEggModal(false)
},
})
}
@@ -752,6 +755,14 @@ export function RunEncounters() {
&#10022; Log Shiny
</button>
)}
{isActive && (
<button
onClick={() => setShowEggModal(true)}
className="px-3 py-1 text-sm border border-green-400 dark:border-green-600 text-green-600 dark:text-green-400 rounded-full font-medium hover:bg-green-50 dark:hover:bg-green-900/20 transition-colors"
>
&#x1F95A; Log Egg
</button>
)}
{isActive && (
<button
onClick={() => setShowEndRun(true)}
@@ -1257,6 +1268,16 @@ export function RunEncounters() {
/>
)}
{/* Egg Encounter Modal */}
{showEggModal && routes && (
<EggEncounterModal
routes={routes}
onSubmit={handleCreate}
onClose={() => setShowEggModal(false)}
isPending={createEncounter.isPending}
/>
)}
{/* Status Change Modal (team pokemon) */}
{selectedTeamEncounter && (
<StatusChangeModal