Make counter fields directly writable in wizards - #822
Merged
Conversation
The passenger, landing and go-around counters were adjustable only via the +/- buttons. Setting a large count meant many clicks. The shared IncrementationField now renders a digit-only text input as well, so a value can be typed directly, mirroring the time field. The typed value is committed and clamped to minValue on blur; the +/- buttons and the onChange contract are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the movement wizard forms, the passenger counter (and the landing /
go-around counters, which share the same component) could only be
adjusted with the
+/-buttons. Entering a large value — e.g. 17passengers — meant clicking
+seventeen times.Change
The shared
IncrementationFieldnow renders a text input alongside the+/-buttons, so the value can be typed directly — mirroring how thetime fields already work.
/^\d*$/); non-digits and-are rejected as youtype, so negative values are impossible.
minValue(default 0); an empty field resolves to
minValue.+/-buttons and theonChange({ target: { value } })contractare unchanged, so the landing/go-around fee recomputation keeps working.
Because the component is shared, passenger, landing and go-around
counters all become writable.
Verification
npm run typecheckclean; full Jest suite passes (2281 tests).IncrementationField.spec.tsx: typing → commit on blur,clear → minValue, clamp below minValue, non-digit rejection, buttons
unchanged.
npm run build --project=lszmcompiles.