Skip to content

Commit

Permalink
Add a lower limit to duplicate tiles. (#2854)
Browse files Browse the repository at this point in the history
* Add a limit to duplicate tiles.

* missed a change
  • Loading branch information
Half-Shot authored Dec 2, 2024
1 parent a37c3bf commit cc26081
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ interface InputFieldProps {
defaultValue?: string;
placeholder?: string;
defaultChecked?: boolean;
min?: number;
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
}

Expand All @@ -91,6 +92,7 @@ export const InputField = forwardRef<
suffix,
description,
disabled,
min,
...rest
},
ref,
Expand Down Expand Up @@ -127,6 +129,7 @@ export const InputField = forwardRef<
checked={checked}
disabled={disabled}
aria-describedby={descriptionId}
min={min}
{...rest}
/>
)}
Expand Down
4 changes: 4 additions & 0 deletions src/settings/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,13 @@ export const SettingsModal: FC<Props> = ({
type="number"
label={t("developer_mode.duplicate_tiles_label")}
value={duplicateTiles.toString()}
min={0}
onChange={useCallback(
(event: ChangeEvent<HTMLInputElement>): void => {
const value = event.target.valueAsNumber;
if (value < 0) {
return;
}
setDuplicateTiles(Number.isNaN(value) ? 0 : value);
},
[setDuplicateTiles],
Expand Down

0 comments on commit cc26081

Please sign in to comment.