From b2e804714f9b74d18b33c3a981a92ad2804e605a Mon Sep 17 00:00:00 2001
From: Alex <alex.tran1502@gmail.com>
Date: Thu, 8 May 2025 21:07:38 -0500
Subject: [PATCH] pr feedback

---
 .../lib/components/user-settings-page/PincodeInput.svelte | 8 +++-----
 .../components/user-settings-page/PincodeSettings.svelte  | 5 +----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/web/src/lib/components/user-settings-page/PincodeInput.svelte b/web/src/lib/components/user-settings-page/PincodeInput.svelte
index a14e28335f..eb7e8aa0d0 100644
--- a/web/src/lib/components/user-settings-page/PincodeInput.svelte
+++ b/web/src/lib/components/user-settings-page/PincodeInput.svelte
@@ -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;
diff --git a/web/src/lib/components/user-settings-page/PincodeSettings.svelte b/web/src/lib/components/user-settings-page/PincodeSettings.svelte
index fc7f8a5955..ce890f90f4 100644
--- a/web/src/lib/components/user-settings-page/PincodeSettings.svelte
+++ b/web/src/lib/components/user-settings-page/PincodeSettings.svelte
@@ -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 () => {