pr feedback

This commit is contained in:
Alex 2025-05-08 21:07:38 -05:00
parent fa22c345be
commit b2e804714f
No known key found for this signature in database
GPG key ID: 53CD082B3A5E1082
2 changed files with 4 additions and 9 deletions
web/src/lib/components/user-settings-page

View file

@ -18,9 +18,7 @@
});
const focusNext = (index: number) => {
if (index < pinLength - 1) {
pincodeInputElements[index + 1]?.focus();
}
pincodeInputElements[Math.min(index + 1, pinLength - 1)]?.focus();
};
const focusPrev = (index: number) => {
@ -37,7 +35,7 @@
currentPinValue = value.slice(0, 1);
}
if (!/^\d*$/.test(value)) {
if (Number.isNaN(Number(value))) {
pinValues[index] = '';
target.value = '';
return;
@ -82,7 +80,7 @@
return;
}
default: {
if (!/^\d$/.test(event.key)) {
if (Number.isNaN(Number(event.key))) {
event.preventDefault();
}
break;

View file

@ -34,10 +34,7 @@
});
const canSubmit = $derived(
(hasPincode ? currentPincode.length === 6 : true) &&
newPincode.length === 6 &&
confirmPincode.length === 6 &&
newPincode === confirmPincode,
(hasPincode ? currentPincode.length === 6 : true) && confirmPincode.length === 6 && newPincode === confirmPincode,
);
const handleCreatePincode = async () => {