Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Refactor (#1347)
Leendert de Borstf7b0084ebad0
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/auth/MobileUnlock.tsx b/apps/browser-extension/src/entrypoints/popup/pages/auth/MobileUnlock.tsxindex 38844a452..dd368d6ba 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/auth/MobileUnlock.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/auth/MobileUnlock.tsx@@ -123,6 +123,7 @@ const MobileUnlock: React.FC = () => {clearInterval(countdownIntervalRef.current);}};+ // eslint-disable-next-line react-hooks/exhaustive-deps}, []);/**diff --git a/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsxindex a9ce2affa..bc83c405d 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx@@ -176,46 +176,146 @@ const Settings: React.FC = () => {};return (- <div className="space-y-6">- <div className="flex justify-between items-center mb-4">- <h2 className="text-gray-900 dark:text-white text-xl">{t('settings.title')}</h2>- </div>+ <>+ {/* Logout Confirmation Modal */}+ {showLogoutConfirm && (+ <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">+ <div className="bg-white dark:bg-gray-800 rounded-lg p-6 max-w-sm w-full mx-4">+ <h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-3">+ {t('auth.logout')}+ </h3>+ <p className="text-sm text-gray-600 dark:text-gray-400 mb-6">+ {t('auth.logoutConfirm')}+ </p>+ <div className="flex gap-3">+ <button+ onClick={() => setShowLogoutConfirm(false)}+ className="flex-1 px-4 py-2 bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-900 dark:text-white rounded-md transition-colors"+ >+ {t('common.cancel')}+ </button>+ <button+ onClick={handleLogout}+ className="flex-1 px-4 py-2 bg-red-500 hover:bg-red-600 text-white rounded-md transition-colors"+ >+ {t('settings.logout')}+ </button>+ </div>+ </div>+ </div>+ )}+ <div className="space-y-6">+ <div className="flex justify-between items-center mb-4">+ <h2 className="text-gray-900 dark:text-white text-xl">{t('settings.title')}</h2>+ </div>- {/* User Menu Section */}- <section>- <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">- <div className="p-4">- <div className="flex items-center justify-between">- <div className="flex items-center space-x-3">- <div className="flex-shrink-0">- <div className="w-10 h-10 rounded-full bg-primary-100 dark:bg-primary-900 flex items-center justify-center">- <span className="text-primary-600 dark:text-primary-400 text-lg font-medium">- {app.username?.[0]?.toUpperCase() || '?'}- </span>+ {/* User Menu Section */}+ <section>+ <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">+ <div className="p-4">+ <div className="flex items-center justify-between">+ <div className="flex items-center space-x-3">+ <div className="flex-shrink-0">+ <div className="w-10 h-10 rounded-full bg-primary-100 dark:bg-primary-900 flex items-center justify-center">+ <span className="text-primary-600 dark:text-primary-400 text-lg font-medium">+ {app.username?.[0]?.toUpperCase() || '?'}+ </span>+ </div>+ </div>+ <div>+ <p className="text font-medium text-gray-900 dark:text-white">+ {app.username}+ </p>+ <p className="text-sm text-gray-500 dark:text-gray-400">+ {t('settings.loggedIn')}+ </p></div></div>- <div>- <p className="text font-medium text-gray-900 dark:text-white">- {app.username}- </p>- <p className="text-sm text-gray-500 dark:text-gray-400">- {t('settings.loggedIn')}- </p>+ <div className="flex gap-2">+ <button+ onClick={handleLock}+ title={t('settings.lock')}+ className="p-2 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 rounded-md transition-colors"+ >+ <svg+ className="w-5 h-5"+ fill="none"+ stroke="currentColor"+ strokeWidth={2}+ viewBox="0 0 24 24"+ aria-label={t('settings.lock')}+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"+ />+ </svg>+ </button>+ <button+ onClick={() => setShowLogoutConfirm(true)}+ title={t('settings.logout')}+ className="p-2 bg-red-100 hover:bg-red-200 dark:bg-red-900/30 dark:hover:bg-red-900/50 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 rounded-md transition-colors"+ >+ <svg+ className="w-5 h-5"+ fill="none"+ stroke="currentColor"+ strokeWidth={2}+ viewBox="0 0 24 24"+ aria-label={t('settings.logout')}+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"+ />+ </svg>+ </button></div></div>- <div className="flex gap-2">- <button- onClick={handleLock}- title={t('settings.lock')}- className="p-2 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 rounded-md transition-colors"+ </div>+ </div>+ </section>++ {/* Settings Navigation Section */}+ <section>+ <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">+ <div className="divide-y divide-gray-200 dark:divide-gray-700">+ {/* Vault Unlock Method */}+ <button+ onClick={navigateToUnlockMethodSettings}+ className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"+ >+ <div className="flex items-center">+ <svg className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14" />+ </svg>+ <span className="text-gray-900 dark:text-white">{t('settings.unlockMethod.title')}</span>+ </div>+ <svg+ className="w-4 h-4 text-gray-400"+ fill="none"+ stroke="currentColor"+ strokeWidth={2}+ viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />+ </svg>+ </button>++ {/* Auto-lock Settings */}+ <button+ onClick={navigateToAutoLockSettings}+ className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"+ >+ <div className="flex items-center"><svg- className="w-5 h-5"+ className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"fill="none"stroke="currentColor"strokeWidth={2}viewBox="0 0 24 24"- aria-label={t('settings.lock')}><pathstrokeLinecap="round"@@ -223,362 +323,263 @@ const Settings: React.FC = () => {d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/></svg>- </button>- <button- onClick={() => setShowLogoutConfirm(true)}- title={t('settings.logout')}- className="p-2 bg-red-100 hover:bg-red-200 dark:bg-red-900/30 dark:hover:bg-red-900/50 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 rounded-md transition-colors"+ <span className="text-gray-900 dark:text-white">{t('settings.autoLockTimeout')}</span>+ </div>+ <svg+ className="w-4 h-4 text-gray-400"+ fill="none"+ stroke="currentColor"+ strokeWidth={2}+ viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />+ </svg>+ </button>++ {/* Autofill Settings */}+ <button+ onClick={navigateToAutofillSettings}+ className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"+ >+ <div className="flex items-center"><svg- className="w-5 h-5"+ className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"fill="none"stroke="currentColor"strokeWidth={2}viewBox="0 0 24 24"- aria-label={t('settings.logout')}><pathstrokeLinecap="round"strokeLinejoin="round"- d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"+ d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>- </button>- </div>- </div>- </div>- </div>- </section>-- {/* Settings Navigation Section */}- <section>- <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">- <div className="divide-y divide-gray-200 dark:divide-gray-700">- {/* Vault Unlock Method */}- <button- onClick={navigateToUnlockMethodSettings}- className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"- >- <div className="flex items-center">- <svg className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">- <path strokeLinecap="round" strokeLinejoin="round" d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14" />- </svg>- <span className="text-gray-900 dark:text-white">{t('settings.unlockMethod.title')}</span>- </div>- <svg- className="w-4 h-4 text-gray-400"- fill="none"- stroke="currentColor"- strokeWidth={2}- viewBox="0 0 24 24"- >- <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />- </svg>- </button>-- {/* Auto-lock Settings */}- <button- onClick={navigateToAutoLockSettings}- className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"- >- <div className="flex items-center">- <svg- className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"- fill="none"- stroke="currentColor"- strokeWidth={2}- viewBox="0 0 24 24"- >- <path- strokeLinecap="round"- strokeLinejoin="round"- d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"- />- </svg>- <span className="text-gray-900 dark:text-white">{t('settings.autoLockTimeout')}</span>- </div>- <svg- className="w-4 h-4 text-gray-400"- fill="none"- stroke="currentColor"- strokeWidth={2}- viewBox="0 0 24 24"- >- <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />- </svg>- </button>-- {/* Autofill Settings */}- <button- onClick={navigateToAutofillSettings}- className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"- >- <div className="flex items-center">+ <span className="text-gray-900 dark:text-white">{t('settings.autofillSettings')}</span>+ </div><svg- className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"+ className="w-4 h-4 text-gray-400"fill="none"stroke="currentColor"strokeWidth={2}viewBox="0 0 24 24">- <path- strokeLinecap="round"- strokeLinejoin="round"- d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"- />+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" /></svg>- <span className="text-gray-900 dark:text-white">{t('settings.autofillSettings')}</span>- </div>- <svg- className="w-4 h-4 text-gray-400"- fill="none"- stroke="currentColor"- strokeWidth={2}- viewBox="0 0 24 24"+ </button>++ {/* Passkey Settings */}+ <button+ onClick={navigateToPasskeySettings}+ className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">- <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />- </svg>- </button>-- {/* Passkey Settings */}- <button- onClick={navigateToPasskeySettings}- className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"- >- <div className="flex items-center">+ <div className="flex items-center">+ <svg+ className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"+ fill="none"+ stroke="currentColor"+ strokeWidth={2}+ viewBox="0 0 24 24"+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"+ />+ </svg>+ <span className="text-gray-900 dark:text-white">{t('settings.passkeySettings')}</span>+ </div><svg- className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"+ className="w-4 h-4 text-gray-400"fill="none"stroke="currentColor"strokeWidth={2}viewBox="0 0 24 24">- <path- strokeLinecap="round"- strokeLinejoin="round"- d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"- />+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" /></svg>- <span className="text-gray-900 dark:text-white">{t('settings.passkeySettings')}</span>- </div>- <svg- className="w-4 h-4 text-gray-400"- fill="none"- stroke="currentColor"- strokeWidth={2}- viewBox="0 0 24 24"- >- <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />- </svg>- </button>+ </button>+ </div></div>- </div>- </section>-- {/* Additional Settings Section */}- <section>- <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">- <div className="divide-y divide-gray-200 dark:divide-gray-700">- {/* Clipboard Settings */}- <button- onClick={navigateToClipboardSettings}- className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"- >- <div className="flex items-center">+ </section>++ {/* Additional Settings Section */}+ <section>+ <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">+ <div className="divide-y divide-gray-200 dark:divide-gray-700">+ {/* Clipboard Settings */}+ <button+ onClick={navigateToClipboardSettings}+ className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"+ >+ <div className="flex items-center">+ <svg+ className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"+ fill="none"+ stroke="currentColor"+ strokeWidth={2}+ viewBox="0 0 24 24"+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ d="M8 7v8a2 2 0 002 2h6M8 7V5a2 2 0 012-2h4.586a1 1 0 01.707.293l4.414 4.414a1 1 0 01.293.707V15a2 2 0 01-2 2h-2M8 7H6a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2v-2"+ />+ </svg>+ <span className="text-gray-900 dark:text-white">{t('settings.clipboardSettings')}</span>+ </div><svg- className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"+ className="w-4 h-4 text-gray-400"fill="none"stroke="currentColor"strokeWidth={2}viewBox="0 0 24 24">- <path- strokeLinecap="round"- strokeLinejoin="round"- d="M8 7v8a2 2 0 002 2h6M8 7V5a2 2 0 012-2h4.586a1 1 0 01.707.293l4.414 4.414a1 1 0 01.293.707V15a2 2 0 01-2 2h-2M8 7H6a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2v-2"- />+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" /></svg>- <span className="text-gray-900 dark:text-white">{t('settings.clipboardSettings')}</span>- </div>- <svg- className="w-4 h-4 text-gray-400"- fill="none"- stroke="currentColor"- strokeWidth={2}- viewBox="0 0 24 24"+ </button>++ {/* Context Menu Settings */}+ <button+ onClick={navigateToContextMenuSettings}+ className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">- <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />- </svg>- </button>-- {/* Context Menu Settings */}- <button- onClick={navigateToContextMenuSettings}- className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"- >- <div className="flex items-center">+ <div className="flex items-center">+ <svg+ className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"+ fill="none"+ stroke="currentColor"+ strokeWidth={2}+ viewBox="0 0 24 24"+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ d="M4 6h16M4 12h16m-7 6h7"+ />+ </svg>+ <span className="text-gray-900 dark:text-white">{t('settings.contextMenuSettings')}</span>+ </div><svg- className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"+ className="w-4 h-4 text-gray-400"fill="none"stroke="currentColor"strokeWidth={2}viewBox="0 0 24 24">- <path- strokeLinecap="round"- strokeLinejoin="round"- d="M4 6h16M4 12h16m-7 6h7"- />+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" /></svg>- <span className="text-gray-900 dark:text-white">{t('settings.contextMenuSettings')}</span>- </div>- <svg- className="w-4 h-4 text-gray-400"- fill="none"- stroke="currentColor"- strokeWidth={2}- viewBox="0 0 24 24"+ </button>++ {/* Language Settings */}+ <button+ onClick={navigateToLanguageSettings}+ className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">- <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />- </svg>- </button>-- {/* Language Settings */}- <button- onClick={navigateToLanguageSettings}- className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"- >- <div className="flex items-center">+ <div className="flex items-center">+ <svg+ className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"+ fill="none"+ stroke="currentColor"+ strokeWidth={2}+ viewBox="0 0 24 24"+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ d="M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129"+ />+ </svg>+ <span className="text-gray-900 dark:text-white">{t('settings.language')}</span>+ </div><svg- className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"+ className="w-4 h-4 text-gray-400"fill="none"stroke="currentColor"strokeWidth={2}viewBox="0 0 24 24">- <path- strokeLinecap="round"- strokeLinejoin="round"- d="M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129"- />+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" /></svg>- <span className="text-gray-900 dark:text-white">{t('settings.language')}</span>- </div>- <svg- className="w-4 h-4 text-gray-400"- fill="none"- stroke="currentColor"- strokeWidth={2}- viewBox="0 0 24 24"- >- <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />- </svg>- </button>- </div>- </div>- </section>-- {/* Appearance Settings Section */}- <section>- <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">{t('settings.appearance')}</h3>- <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">- <div className="p-4">- <div>- <p className="font-medium text-gray-900 dark:text-white mb-2">{t('settings.theme')}</p>- <div className="flex flex-col space-y-2">- <label className="flex items-center">- <input- type="radio"- name="theme"- value="system"- checked={theme === 'system'}- onChange={() => setThemePreference('system')}- className="mr-2"- />- <span className="text-sm text-gray-700 dark:text-gray-300">{t('settings.useDefault')}</span>- </label>- <label className="flex items-center">- <input- type="radio"- name="theme"- value="light"- checked={theme === 'light'}- onChange={() => setThemePreference('light')}- className="mr-2"- />- <span className="text-sm text-gray-700 dark:text-gray-300">{t('settings.light')}</span>- </label>- <label className="flex items-center">- <input- type="radio"- name="theme"- value="dark"- checked={theme === 'dark'}- onChange={() => setThemePreference('dark')}- className="mr-2"- />- <span className="text-sm text-gray-700 dark:text-gray-300">{t('settings.dark')}</span>- </label>- </div>+ </button></div></div>- </div>- </section>+ </section>- {/* Keyboard Shortcuts Section */}- {import.meta.env.CHROME && (+ {/* Appearance Settings Section */}<section>- <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">{t('settings.keyboardShortcuts')}</h3>+ <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">{t('settings.appearance')}</h3><div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700"><div className="p-4">- <div className="flex items-center justify-between">- <div>- <p className="font-medium text-gray-900 dark:text-white">{t('settings.configureKeyboardShortcuts')}</p>+ <div>+ <p className="font-medium text-gray-900 dark:text-white mb-2">{t('settings.theme')}</p>+ <div className="flex flex-col space-y-2">+ <label className="flex items-center">+ <input+ type="radio"+ name="theme"+ value="system"+ checked={theme === 'system'}+ onChange={() => setThemePreference('system')}+ className="mr-2"+ />+ <span className="text-sm text-gray-700 dark:text-gray-300">{t('settings.useDefault')}</span>+ </label>+ <label className="flex items-center">+ <input+ type="radio"+ name="theme"+ value="light"+ checked={theme === 'light'}+ onChange={() => setThemePreference('light')}+ className="mr-2"+ />+ <span className="text-sm text-gray-700 dark:text-gray-300">{t('settings.light')}</span>+ </label>+ <label className="flex items-center">+ <input+ type="radio"+ name="theme"+ value="dark"+ checked={theme === 'dark'}+ onChange={() => setThemePreference('dark')}+ className="mr-2"+ />+ <span className="text-sm text-gray-700 dark:text-gray-300">{t('settings.dark')}</span>+ </label></div>- <button- onClick={openKeyboardShortcuts}- className="px-4 py-2 bg-primary-500 hover:bg-primary-600 text-white rounded-md transition-colors"- >- {t('settings.configure')}- </button></div></div></div></section>- )}- <div className="text-center text-gray-400 dark:text-gray-600">- {t('settings.versionPrefix')}{AppInfo.VERSION} ({getDisplayUrl()})- </div>-- {/* Logout Confirmation Modal */}- {showLogoutConfirm && (- <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">- <div className="bg-white dark:bg-gray-800 rounded-lg p-6 max-w-sm w-full mx-4">- <h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-3">- {t('auth.logout')}- </h3>- <p className="text-sm text-gray-600 dark:text-gray-400 mb-6">- {t('auth.logoutConfirm')}- </p>- <div className="flex gap-3">- <button- onClick={() => setShowLogoutConfirm(false)}- className="flex-1 px-4 py-2 bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-900 dark:text-white rounded-md transition-colors"- >- {t('common.cancel')}- </button>- <button- onClick={handleLogout}- className="flex-1 px-4 py-2 bg-red-500 hover:bg-red-600 text-white rounded-md transition-colors"- >- {t('settings.logout')}- </button>+ {/* Keyboard Shortcuts Section */}+ {import.meta.env.CHROME && (+ <section>+ <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">{t('settings.keyboardShortcuts')}</h3>+ <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">+ <div className="p-4">+ <div className="flex items-center justify-between">+ <div>+ <p className="font-medium text-gray-900 dark:text-white">{t('settings.configureKeyboardShortcuts')}</p>+ </div>+ <button+ onClick={openKeyboardShortcuts}+ className="px-4 py-2 bg-primary-500 hover:bg-primary-600 text-white rounded-md transition-colors"+ >+ {t('settings.configure')}+ </button>+ </div>+ </div></div>- </div>+ </section>+ )}++ <div className="text-center text-gray-400 dark:text-gray-600">+ {t('settings.versionPrefix')}{AppInfo.VERSION} ({getDisplayUrl()})</div>- )}- </div>+ </div>+ </>);};diff --git a/apps/mobile-app/app/(tabs)/settings/qr-confirm.tsx b/apps/mobile-app/app/(tabs)/settings/qr-confirm.tsxindex 2c05b2453..86dfb05a3 100644--- a/apps/mobile-app/app/(tabs)/settings/qr-confirm.tsx+++ b/apps/mobile-app/app/(tabs)/settings/qr-confirm.tsx@@ -114,9 +114,9 @@ export default function QRConfirmScreen() : React.ReactNode {try {await NativeVaultManager.showPinUnlock();authenticated = true;- } catch (pinError: any) {+ } catch (pinError: unknown) {// User cancelled PIN or PIN failed- console.log('PIN unlock cancelled or failed:', pinError);+ console.error('PIN unlock cancelled or failed:', pinError);Alert.alert(t('common.error'),t('settings.qrScanner.mobileUnlock.authenticationFailed')@@ -130,7 +130,7 @@ export default function QRConfirmScreen() : React.ReactNode {authenticated = await NativeVaultManager.authenticateUser(t('settings.qrScanner.mobileUnlock.authenticationRequired'));- } catch (authError: any) {+ } catch (authError: unknown) {console.error('Biometric authentication error:', authError);Alert.alert(t('common.error'),diff --git a/apps/mobile-app/app/(tabs)/settings/qr-result.tsx b/apps/mobile-app/app/(tabs)/settings/qr-result.tsxindex 17c89edec..cd4128515 100644--- a/apps/mobile-app/app/(tabs)/settings/qr-result.tsx+++ b/apps/mobile-app/app/(tabs)/settings/qr-result.tsx@@ -22,10 +22,12 @@ export default function QRResultScreen() : React.ReactNode {const isSuccess = success === 'true';+ /**+ * Handle dismiss which will go back to the settings tab.+ */const handleDismiss = () : void => {/*- * Switch to credentials tab immediately for smooth UX,- * then clean up the settings stack in the background.+ * Go back to the settings tab.*/router.back();};diff --git a/apps/mobile-app/app/(tabs)/settings/qr-scanner.tsx b/apps/mobile-app/app/(tabs)/settings/qr-scanner.tsxindex 75fba65d3..73d3c3660 100644--- a/apps/mobile-app/app/(tabs)/settings/qr-scanner.tsx+++ b/apps/mobile-app/app/(tabs)/settings/qr-scanner.tsx@@ -1,8 +1,8 @@import { Ionicons } from '@expo/vector-icons';import { CameraView, useCameraPermissions } from 'expo-camera';import { router, useLocalSearchParams } from 'expo-router';-import { useState, useEffect } from 'react';-import { View, TouchableOpacity, Alert, StyleSheet } from 'react-native';+import { useEffect, useCallback } from 'react';+import { View, Alert, StyleSheet } from 'react-native';import { useColors } from '@/hooks/useColorScheme';import { useMinDurationLoading } from '@/hooks/useMinDurationLoading';@@ -16,8 +16,10 @@ import { useWebApi } from '@/context/WebApiContext';// QR Code type prefixesconst QR_CODE_PREFIXES = {MOBILE_UNLOCK: 'aliasvault://mobile-unlock/',- // Future: PASSKEY: 'aliasvault://passkey/',- // Future: SHARE_CREDENTIAL: 'aliasvault://share/',+ /*+ * Future: PASSKEY: 'aliasvault://passkey/',+ * Future: SHARE_CREDENTIAL: 'aliasvault://share/',+ */} as const;type QRCodeType = keyof typeof QR_CODE_PREFIXES;@@ -25,7 +27,7 @@ type QRCodeType = keyof typeof QR_CODE_PREFIXES;/*** Scanned QR code data.*/-interface ScannedQRCode {+type ScannedQRCode = {type: QRCodeType | null;payload: string;rawData: string;@@ -60,6 +62,9 @@ export default function QRScannerScreen() : React.ReactNode {// Request camera permission on mountuseEffect(() => {+ /**+ * Request camera permission.+ */const requestCameraPermission = async () : Promise<void> => {if (!permission) {return; // Still loading permission status@@ -73,50 +78,21 @@ export default function QRScannerScreen() : React.ReactNode {Alert.alert(t('settings.qrScanner.cameraPermissionTitle'),t('settings.qrScanner.cameraPermissionMessage'),- [{ text: t('common.ok'), onPress: () => router.back() }]+ [{ text: t('common.ok'), /**+ * Go back to the settings tab.+ */+ onPress: (): void => router.back() }]);}};requestCameraPermission();- }, [permission?.granted]);-- // Handle QR code URL passed from deep link (e.g., from native camera)- useEffect(() => {- if (url && typeof url === 'string') {- handleBarcodeScanned({ data: url });- }- }, [url]);-- /**- * Handle barcode scanned - validate request and navigate to confirmation.- */- const handleBarcodeScanned = ({ data }: { data: string }) : void => {- // Prevent multiple scans- if (isLoadingAfterScan) {- return;- }-- // Parse the QR code to determine its type- const parsedData = parseQRCode(data);-- if (!parsedData.type) {- Alert.alert(- t('settings.qrScanner.invalidQrCode'),- t('settings.qrScanner.notAliasVaultQr'),- [{ text: t('common.ok'), onPress: () => router.back() }]- );- return;- }-- // Validate the request and navigate (with min 500ms loading)- validateAndNavigate(parsedData);- };+ }, [permission, requestPermission, t]);/*** Validate the QR request with the server before navigating.*/- const validateAndNavigate = async (parsedData: ScannedQRCode) : Promise<void> => {+ const validateAndNavigate = useCallback(async (parsedData: ScannedQRCode) : Promise<void> => {setIsLoadingAfterScan(true);try {@@ -127,8 +103,10 @@ export default function QRScannerScreen() : React.ReactNode {{ method: 'GET' });- // Request is valid, navigate to confirmation page- // Min duration of 500ms is handled by useMinDurationLoading+ /*+ * Request is valid, navigate to confirmation page+ * Min duration of 500ms is handled by useMinDurationLoading+ */setIsLoadingAfterScan(false);router.replace({@@ -156,7 +134,42 @@ export default function QRScannerScreen() : React.ReactNode {[{ text: t('common.ok') }]);}- };+ }, [webApi, setIsLoadingAfterScan, t]);++ /**+ * Handle barcode scanned - validate request and navigate to confirmation.+ */+ const handleBarcodeScanned = useCallback(({ data }: { data: string }) : void => {+ // Prevent multiple scans+ if (isLoadingAfterScan) {+ return;+ }++ // Parse the QR code to determine its type+ const parsedData = parseQRCode(data);++ if (!parsedData.type) {+ Alert.alert(+ t('settings.qrScanner.invalidQrCode'),+ t('settings.qrScanner.notAliasVaultQr'),+ [{ text: t('common.ok'), /**+ * Go back to the settings tab.+ */+ onPress: (): void => router.back() }]+ );+ return;+ }++ // Validate the request and navigate (with min 500ms loading)+ validateAndNavigate(parsedData);+ }, [isLoadingAfterScan, t, validateAndNavigate]);++ // Handle QR code URL passed from deep link (e.g., from native camera)+ useEffect(() => {+ if (url && typeof url === 'string') {+ handleBarcodeScanned({ data: url });+ }+ }, [url, handleBarcodeScanned]);const styles = StyleSheet.create({camera: {diff --git a/apps/mobile-app/app/_layout.tsx b/apps/mobile-app/app/_layout.tsxindex 60b777e35..17b23fe9f 100644--- a/apps/mobile-app/app/_layout.tsx+++ b/apps/mobile-app/app/_layout.tsx@@ -118,7 +118,7 @@ function RootLayoutNav() : React.ReactNode {handleDeepLink(url);});- return () => {+ return (): void => {subscription.remove();};}, [bootComplete, redirectTarget, router]);