CLAUDE: Limit flyball hit locations to outfield positions only
- Added OUTFIELD_ONLY_OUTCOMES constant for flyout_a, flyout_b, flyout_c - Added showInfieldLocations computed to hide infield for flyballs - Updated selectOutcome to clear infield location when switching to flyball - Mirrors existing groundball logic that hides outfield positions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
920d1c599c
commit
acdc465841
@ -42,7 +42,7 @@
|
||||
<div v-if="needsHitLocation" class="hit-location-section">
|
||||
<label class="form-label">Hit Location</label>
|
||||
<div class="location-grid">
|
||||
<div class="location-group">
|
||||
<div v-if="showInfieldLocations" class="location-group">
|
||||
<div class="location-group-label">Infield</div>
|
||||
<div class="location-buttons">
|
||||
<button
|
||||
@ -105,7 +105,7 @@ import { ref, computed } from 'vue'
|
||||
import type { PlayOutcome, RollData } from '~/types'
|
||||
|
||||
// Import centralized outcome constants
|
||||
import { OUTCOME_CATEGORIES, OUTCOMES_REQUIRING_HIT_LOCATION, INFIELD_ONLY_OUTCOMES, HIT_LOCATIONS } from '~/constants/outcomes'
|
||||
import { OUTCOME_CATEGORIES, OUTCOMES_REQUIRING_HIT_LOCATION, INFIELD_ONLY_OUTCOMES, OUTFIELD_ONLY_OUTCOMES, HIT_LOCATIONS } from '~/constants/outcomes'
|
||||
|
||||
interface Props {
|
||||
rollData: RollData | null
|
||||
@ -150,6 +150,12 @@ const showOutfieldLocations = computed(() => {
|
||||
return !(INFIELD_ONLY_OUTCOMES as readonly string[]).includes(selectedOutcome.value)
|
||||
})
|
||||
|
||||
// Hide infield positions for flyball outcomes (they go to the outfield)
|
||||
const showInfieldLocations = computed(() => {
|
||||
if (!selectedOutcome.value) return true
|
||||
return !(OUTFIELD_ONLY_OUTCOMES as readonly string[]).includes(selectedOutcome.value)
|
||||
})
|
||||
|
||||
const canSubmitForm = computed(() => {
|
||||
if (!selectedOutcome.value) return false
|
||||
if (needsHitLocation.value && !selectedHitLocation.value) return false
|
||||
@ -170,6 +176,13 @@ const selectOutcome = (outcome: PlayOutcome) => {
|
||||
selectedHitLocation.value = null
|
||||
}
|
||||
}
|
||||
// Clear infield hit location if switching to flyball (outfield only)
|
||||
if ((OUTFIELD_ONLY_OUTCOMES as readonly string[]).includes(outcome)) {
|
||||
const infield = HIT_LOCATIONS.infield as readonly string[]
|
||||
if (selectedHitLocation.value && infield.includes(selectedHitLocation.value)) {
|
||||
selectedHitLocation.value = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const selectHitLocation = (location: string) => {
|
||||
|
||||
@ -94,6 +94,16 @@ export const INFIELD_ONLY_OUTCOMES = [
|
||||
'groundball_c',
|
||||
] as const satisfies readonly PlayOutcome[]
|
||||
|
||||
/**
|
||||
* Outcomes that only allow outfield hit locations (no infield)
|
||||
* Flyballs by definition go to the outfield
|
||||
*/
|
||||
export const OUTFIELD_ONLY_OUTCOMES = [
|
||||
'flyout_a',
|
||||
'flyout_b',
|
||||
'flyout_c',
|
||||
] as const satisfies readonly PlayOutcome[]
|
||||
|
||||
/**
|
||||
* Hit location options
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user