Exotics
A builder for Quinellas, Exactas, Trifectas and First 4s, whose Box folds the places into one, with the Flexi worked out as the stake is typed.
Usage
import { Exotics } from '@wdzyi/ui';
<Exotics
runners={field}
defaultType='trifecta'
onChange={setBet}
onAdd={(bet) => addToSlip(bet)}
/>Part of @wdzyi/ui. See setup to install it, or copy the code above.
Props
- runnersExoticsRunner[]
- The field, by saddlecloth number, each with its name, whether it’s scratched, and silks found from its name unless you give it some. Nine sample runners by default, one scratched.
- type, defaultType'quinella' | 'exacta' | 'trifecta' | 'first-four' = 'trifecta'
- The bet type, when you hold it, or where it starts. Each opens its places across the grid.
- onTypeChange(type: ExoticsType) => void
- Called with the bet type picked.
- boxed, defaultBoxedboolean = false
- Boxed, when you hold it: one column, and any order of the runners in it counts. A Quinella always is.
- onBoxedChange(boxed: boolean) => void
- Called as Box is turned on or off.
- defaultPicksnumber[][]
- The runners in each place to begin with, first place first, or the box in the first list when it’s boxed.
- stake, defaultStakenumber = 0
- The whole stake, spread across the combinations, when you hold it, or where it starts.
- onStakeChange(stake: number) => void
- Called as the stake is typed.
- onChange(bet: ExoticsBet) => void
- Called with the bet whenever it changes: its type, whether it’s boxed, the runners in each place, the combinations, the stake and the Flexi.
- onAdd(bet: ExoticsBet) => void
- Adds the bet to a slip, from the button or Enter in the stake. The button says Added to slip for a moment, and the builder stays as it was.
- denseboolean = false
- Shorter rows, and the stake and the sum on one line without the button, for a small space. Enter in the stake still adds the bet.
- currencystring = 'AUD'
- The currency of the stake, written the Australian way.
- classNamestring
- Added to the builder. It’s 560px wide at most, and narrows with the space it’s in.
Notes
- A Quinella is the first two in any order, an Exacta the first two in order, a Trifecta the first three and a First 4 the first four. Each opens its places across the top, a column each, over 280ms, and a column that isn’t needed closes to nothing. A runner goes in a place where its row meets the column, the square filling in ink on a small spring with a tick drawing across it.
- Box folds the places into one column, so any order of the runners in it counts. Boxing gathers every place’s runners into the box, and unboxing puts the box back in every place, so the bet doesn’t change either way. A Quinella is in any order already, so the switch gives way to a note saying so. Scratchings are struck through and can’t be picked.
- The combinations are counted as it’s built: three runners boxed in a Trifecta make six, and places picked one by one count every run of different runners through them. The stake is the whole outlay, and the Flexi is the share of each dividend it buys, $12 on six combinations being 200%, rounded down so it never claims more than it is.
- There’s no quick pick and no countdown: nothing chooses runners for you and nothing hurries the stake. Until there’s a bet, the line under the grid says what’s still needed, such as Pick 2 more, and the button waits. Added, it steps back to a plate with a green tick, rather than inviting another.
- The bet types are radio buttons that the arrows move along, and the places are a grid that the arrows move around, Space or Enter putting a runner in. Enter in the stake adds the bet. It sends select for a bet type, toggle-on and toggle-off as runners go in and out and as Box turns, key and erase as the stake is typed, and success once it’s added. With reduced motion, the columns open and close at once and a square fills without its spring.