strat-gameplay-webapp/frontend-sba/constants/xCheckResults.ts
Cal Corum f77666db87 CLAUDE: Add XCheckWizard component and result constants (step 6)
New files:
- constants/xCheckResults.ts - Labels, helpers for all result codes
- components/Gameplay/XCheckWizard.vue - Interactive x-check UI

XCheckWizard features:
 Displays d20 and 3d6 dice results prominently
 Shows 5-column chart row (Range 1-5) as selectable buttons
 Hash result sub-choices (G2#/G3# → pick G2 or SI2)
 SPD result sub-choice (click to reveal d20, pick safe/out)
 Error selection (NO/E1/E2/E3/RP) based on 3d6
 Submit validation (both result + error required)
 Read-only mode for transparency (opponent sees same UI)
 Mobile-responsive layout (stacks on small screens)
 Tailwind styling with clear visual hierarchy

Helper functions:
- getResultLabel() - Display names for all codes
- getErrorLabel() - Display names for error types
- isHashResult() - Detect G2#/G3#
- isSpdResult() - Detect SPD
- getHashConversions() - Get conversion options

Next: Integrate XCheckWizard into GameplayPanel

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 17:36:23 -06:00

88 lines
1.9 KiB
TypeScript

/**
* X-Check Result Code Labels and Descriptions
*
* Display labels for all possible result codes that can appear in
* defensive x-check chart rows (5 columns).
*/
export const X_CHECK_RESULT_LABELS: Record<string, string> = {
// Groundball results
G1: 'Groundball Out (best)',
G2: 'Groundball Out (good)',
G3: 'Groundball Out (weak)',
'G2#': 'Groundball (speed test)',
'G3#': 'Groundball (speed test)',
// Singles
SI1: 'Single (clean)',
SI2: 'Single (through)',
// Doubles
DO2: 'Double (2-base)',
DO3: 'Double (3-base)',
// Triples
TR3: 'Triple',
// Flyball results
F1: 'Flyout (deep)',
F2: 'Flyout (medium)',
F3: 'Flyout (shallow)',
// Catcher-specific
SPD: 'Speed Check',
FO: 'Fly Out',
PO: 'Pop Out',
}
export const X_CHECK_ERROR_LABELS: Record<string, string> = {
NO: 'No Error',
E1: 'Error (+1 base)',
E2: 'Error (+2 bases)',
E3: 'Error (+3 bases)',
RP: 'Rare Play (+3 bases)',
}
/**
* Hash result conversions (player mentally resolves based on batter speed)
*/
export const HASH_CONVERSIONS: Record<string, string[]> = {
'G2#': ['G2', 'SI2'],
'G3#': ['G3', 'SI2'],
}
/**
* Get display label for a result code
*/
export function getResultLabel(code: string): string {
return X_CHECK_RESULT_LABELS[code] || code
}
/**
* Get display label for an error result
*/
export function getErrorLabel(code: string): string {
return X_CHECK_ERROR_LABELS[code] || code
}
/**
* Check if a result code is a hash result (requires speed test)
*/
export function isHashResult(code: string): boolean {
return code.endsWith('#')
}
/**
* Check if a result code is SPD (speed check)
*/
export function isSpdResult(code: string): boolean {
return code === 'SPD'
}
/**
* Get conversion options for a hash result
*/
export function getHashConversions(code: string): string[] | null {
return HASH_CONVERSIONS[code] || null
}