Skip to content

impr: native support for number/boolean in InputField (@fehmer)#8197

Draft
fehmer wants to merge 3 commits into
masterfrom
feature/inputField-numbers
Draft

impr: native support for number/boolean in InputField (@fehmer)#8197
fehmer wants to merge 3 commits into
masterfrom
feature/inputField-numbers

Conversation

@fehmer

@fehmer fehmer commented Jul 5, 2026

Copy link
Copy Markdown
Member

No description provided.

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Jul 5, 2026
@fehmer fehmer added the force-ci Force CI to run on draft PRs label Jul 5, 2026
@Miodec Miodec requested a review from Copilot July 5, 2026 12:46
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Jul 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds typed/natively-parsed numeric/boolean handling to the shared InputField, then simplifies several settings/modals to stop manually parseFloat/parseInt and to rely on schema validation + numeric field values.

Changes:

  • Tighten InputField type prop + add value conversion to support non-string field values.
  • Update settings/custom-settings to submit numeric values directly and reuse fromSchema(...) number validators.
  • Update modals (custom word amount, custom generator) to store numeric form values; extend InputField unit tests for numbers.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/ts/components/ui/form/InputField.tsx Typed type union; converts field values to/from string; updates input binding
frontend/src/ts/components/pages/settings/SettingsPage.tsx AutoSetting number submit/validation now uses numeric values + fromSchema
frontend/src/ts/components/pages/settings/custom-setting/PaceCaret.tsx Removes float parsing; schema validator directly on numeric value
frontend/src/ts/components/pages/settings/custom-setting/MinSpeed.tsx Removes float parsing; schema validator directly on numeric value
frontend/src/ts/components/pages/settings/custom-setting/MinBurst.tsx Removes float parsing; schema validator directly on numeric value
frontend/src/ts/components/pages/settings/custom-setting/MinAcc.tsx Removes float parsing; schema validator directly on numeric value
frontend/src/ts/components/pages/settings/custom-setting/MaxLineWidth.tsx Removes float parsing; schema validator directly on numeric value
frontend/src/ts/components/modals/CustomWordAmountModal.tsx Form value is now numeric; validator uses zod schema via fromSchema
frontend/src/ts/components/modals/CustomGeneratorModal.tsx DefaultValues + submit handling now treats lengths/count as numbers
frontend/tests/components/ui/form/InputField.spec.tsx Field helper updated for non-string defaults; adds number input test

Comment on lines +14 to +23
type?:
| "text"
| "textarea"
| "password"
| "email"
| "number"
| "range"
| "date"
| "datetime-local"
| "checkbox";
Comment on lines 94 to +98
onInput={(e) => {
props.field().handleChange(e.target.value);
const value: unknown = convertStringToValue(
props.field().state.value,
e.target.value,
);
Comment on lines +164 to +169
function convertValueToString(input: unknown | undefined): string {
if (input === undefined || input === null) return "";
if (typeof input === "boolean") return input ? "true" : "false";
if (typeof input === "number") return input.toString();
return input as string;
}
Comment on lines +67 to +70
it("calls handleChange on input for number", async () => {
const field = makeField("name", 2.5);
render(() => <InputField field={() => field} type="number" />);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

force-ci Force CI to run on draft PRs frontend User interface or web stuff waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants