mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 23:33:29 +00:00
Show a refused profile field under the input it belongs to
The onboarding baseline step flashed a toast naming one refused field and walked on to the done screen, stamping the account as set up over a value the server never stored. The value the person typed was gone with the step. A refused field now writes its reason into that field's own error slot, marks the control invalid, and holds the step until the person corrects it. Every refused field is named, not only the first, and the reason comes from the validator code rather than the validator's own prose, in all seven shipped languages.
This commit is contained in:
1 parent
ae20ee3d9d
commit
36cbf48286
16 files changed
+438
-26
No files matched your search
@@ -31,6 +31,10 @@ interface HeightFieldControlProps {
|
||||
onChange: (next: HeightDraft) => void;
|
||||
autoComplete?: string;
|
||||
enterKeyHint?: "next";
|
||||
/** Marks every box of the control as refused. */
|
||||
invalid?: boolean;
|
||||
/** Id of the error paragraph the control's boxes point at. */
|
||||
describedBy?: string;
|
||||
}
|
||||
|
||||
export function HeightFieldControl({
|
||||
@@ -40,6 +44,8 @@ export function HeightFieldControl({
|
||||
onChange,
|
||||
autoComplete,
|
||||
enterKeyHint,
|
||||
invalid,
|
||||
describedBy,
|
||||
}: HeightFieldControlProps) {
|
||||
const { t } = useTranslations();
|
||||
const { bounds } = adapter;
|
||||
@@ -58,6 +64,8 @@ export function HeightFieldControl({
|
||||
max={bounds.cm.max}
|
||||
step={0.1}
|
||||
autoComplete={autoComplete}
|
||||
aria-invalid={invalid || undefined}
|
||||
aria-describedby={describedBy}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -77,6 +85,8 @@ export function HeightFieldControl({
|
||||
max={bounds.feet.max}
|
||||
step={1}
|
||||
autoComplete={autoComplete}
|
||||
aria-invalid={invalid || undefined}
|
||||
aria-describedby={describedBy}
|
||||
aria-label={t("common.heightFeet")}
|
||||
/>
|
||||
<span
|
||||
@@ -99,6 +109,8 @@ export function HeightFieldControl({
|
||||
max={bounds.inches.max}
|
||||
step={1}
|
||||
autoComplete={autoComplete}
|
||||
aria-invalid={invalid || undefined}
|
||||
aria-describedby={describedBy}
|
||||
aria-label={t("common.heightInches")}
|
||||
/>
|
||||
<span
|
||||
|
||||
Reference in new issue
Block a user