Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Refactor browser extension settings pages and update order (#2462)

Leendert de Borstd58630cf7825
diff --git a/apps/browser-extension/src/entrypoints/popup/App.tsx b/apps/browser-extension/src/entrypoints/popup/App.tsx
index bf1408c2b..a31567791 100644
--- a/apps/browser-extension/src/entrypoints/popup/App.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/App.tsx
@@ -41,6 +41,7 @@ import PasswordGeneratorSettings from '@/entrypoints/popup/pages/settings/Passwo
import ActiveSessionsSettings from '@/entrypoints/popup/pages/settings/security/ActiveSessionsSettings';
import AuthLogsSettings from '@/entrypoints/popup/pages/settings/security/AuthLogsSettings';
import ChangePasswordSettings from '@/entrypoints/popup/pages/settings/security/ChangePasswordSettings';
+import DeleteAccountSettings from '@/entrypoints/popup/pages/settings/security/DeleteAccountSettings';
import SecuritySettings from '@/entrypoints/popup/pages/settings/security/SecuritySettings';
import Settings from '@/entrypoints/popup/pages/settings/Settings';
import VaultUnlockSettings from '@/entrypoints/popup/pages/settings/VaultUnlockSettings';
@@ -214,6 +215,7 @@ const App: React.FC = () => {
{ path: '/settings/security/change-password', element: <ChangePasswordSettings />, showBackButton: true, title: t('common.settings') },
{ path: '/settings/security/active-sessions', element: <ActiveSessionsSettings />, showBackButton: true, title: t('common.settings') },
{ path: '/settings/security/auth-logs', element: <AuthLogsSettings />, showBackButton: true, title: t('common.settings') },
+ { path: '/settings/security/delete-account', element: <DeleteAccountSettings />, showBackButton: true, title: t('common.settings') },
{ path: '/settings/autofill', element: <AutofillSettings />, showBackButton: true, title: t('common.settings') },
{ path: '/settings/context-menu', element: <ContextMenuSettings />, showBackButton: true, title: t('common.settings') },
{ path: '/settings/clipboard', element: <ClipboardSettings />, showBackButton: true, title: t('common.settings') },
diff --git a/apps/browser-extension/src/entrypoints/popup/components/Settings/SettingsMenu.tsx b/apps/browser-extension/src/entrypoints/popup/components/Settings/SettingsMenu.tsx
new file mode 100644
index 000000000..f547fd5fe
--- /dev/null
+++ b/apps/browser-extension/src/entrypoints/popup/components/Settings/SettingsMenu.tsx
@@ -0,0 +1,66 @@
+import React from 'react';
+
+type SettingsGroupProps = {
+ title?: string;
+ children: React.ReactNode;
+};
+
+/**
+ * A titled card of settings rows.
+ */
+export const SettingsGroup: React.FC<SettingsGroupProps> = ({ title, children }) => (
+ <section>
+ {title && (
+ <h2 className="px-1 mb-2 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">{title}</h2>
+ )}
+ <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden">
+ <div className="divide-y divide-gray-200 dark:divide-gray-700">
+ {children}
+ </div>
+ </div>
+ </section>
+);
+
+type SettingsRowProps = {
+ id?: string;
+ label: string;
+ icon: React.ReactNode;
+ onClick: () => void;
+ badge?: string;
+ external?: boolean;
+ danger?: boolean;
+ disabled?: boolean;
+ disabledReason?: string;
+};
+
+/**
+ * One navigation row in a settings group.
+ */
+export const SettingsRow: React.FC<SettingsRowProps> = ({ id, label, icon, onClick, badge, external, danger, disabled, disabledReason }) => (
+ <button
+ id={id}
+ onClick={onClick}
+ disabled={disabled}
+ title={disabled ? disabledReason : undefined}
+ className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
+ >
+ <div className="flex items-center">
+ <svg className={`w-5 h-5 mr-3 ${danger ? 'text-red-600 dark:text-red-400' : 'text-gray-600 dark:text-gray-400'}`} fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
+ {icon}
+ </svg>
+ <span className={`text-left ${danger ? 'text-red-600 dark:text-red-400' : 'text-gray-900 dark:text-white'}`}>{label}</span>
+ {badge && (
+ <span className="ml-2 px-1.5 py-0.5 text-[10px] font-semibold rounded-full bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-300 uppercase tracking-wide">
+ {badge}
+ </span>
+ )}
+ </div>
+ <svg className="w-4 h-4 text-gray-400" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
+ {external ? (
+ <path strokeLinecap="round" strokeLinejoin="round" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
+ ) : (
+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />
+ )}
+ </svg>
+ </button>
+);
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/settings/ClipboardSettings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/settings/ClipboardSettings.tsx
index 9edb2311c..e9181e5a4 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/settings/ClipboardSettings.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/settings/ClipboardSettings.tsx
@@ -40,7 +40,7 @@ const ClipboardSettings: React.FC = () => {
return (
<div className="space-y-6">
- <PageTitle>{t('settings.clipboardSettings')}</PageTitle>
+ <PageTitle>{t('settings.clipboardClear')}</PageTitle>
<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">
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx
index 076842a30..a0adccbfa 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx
@@ -9,6 +9,7 @@ import LogoutConfirmModal from '@/entrypoints/popup/components/Dialogs/LogoutCon
import HeaderButton from '@/entrypoints/popup/components/HeaderButton';
import { HeaderIconType } from '@/entrypoints/popup/components/Icons/HeaderIcons';
import PageTitle from '@/entrypoints/popup/components/PageTitle';
+import { SettingsGroup, SettingsRow } from '@/entrypoints/popup/components/Settings/SettingsMenu';
import { useApp } from '@/entrypoints/popup/context/AppContext';
import { useAuth } from '@/entrypoints/popup/context/AuthContext';
import { useCapabilities } from '@/entrypoints/popup/context/CapabilityContext';
@@ -164,90 +165,6 @@ const Settings: React.FC = () => {
navigate('/unlock');
};
- /**
- * Navigate to family sharing settings.
- */
- const navigateToFamilySharingSettings = () : void => {
- navigate('/settings/family-sharing');
- };
-
- /**
- * Navigate to autofill settings.
- */
- const navigateToAutofillSettings = () : void => {
- navigate('/settings/autofill');
- };
-
- /**
- * Navigate to clipboard settings.
- */
- const navigateToClipboardSettings = () : void => {
- navigate('/settings/clipboard');
- };
-
- /**
- * Navigate to language settings.
- */
- const navigateToLanguageSettings = () : void => {
- navigate('/settings/language');
- };
-
- /**
- * Navigate to auto-lock settings.
- */
- const navigateToAutoLockSettings = () : void => {
- navigate('/settings/auto-lock');
- };
-
- /**
- * Navigate to unlock method settings.
- */
- const navigateToUnlockMethodSettings = () : void => {
- navigate('/settings/unlock-method');
- };
-
- /**
- * Navigate to security settings.
- */
- const navigateToSecuritySettings = () : void => {
- navigate('/settings/security');
- };
-
- /**
- * Navigate to context menu settings.
- */
- const navigateToContextMenuSettings = () : void => {
- navigate('/settings/context-menu');
- };
-
- /**
- * Navigate to passkey settings.
- */
- const navigateToPasskeySettings = () : void => {
- navigate('/settings/passkeys');
- };
-
- /**
- * Navigate to identity generator settings.
- */
- const navigateToIdentityGeneratorSettings = () : void => {
- navigate('/settings/identity-generator');
- };
-
- /**
- * Navigate to password generator settings.
- */
- const navigateToPasswordGeneratorSettings = () : void => {
- navigate('/settings/password-generator');
- };
-
- /**
- * Navigate to appearance settings.
- */
- const navigateToAppearanceSettings = () : void => {
- navigate('/settings/appearance');
- };
-
return (
<>
{/* Logout Confirmation Modal */}
@@ -262,9 +179,9 @@ const Settings: React.FC = () => {
<PageTitle>{t('common.settings')}</PageTitle>
</div>
- {/* User Menu Section */}
+ {/* Account card: who is logged in, plus account-level destinations */}
<section>
- <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
+ <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden divide-y divide-gray-200 dark:divide-gray-700">
<div className="p-4">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-3">
@@ -330,438 +247,92 @@ const Settings: React.FC = () => {
</div>
</div>
</div>
+ {hasCapability(CapabilityKeys.VaultSharing) && (
+ <SettingsRow
+ label={familySharingText.title}
+ badge={familySharingText.beta}
+ onClick={() => navigate('/settings/family-sharing')}
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />}
+ />
+ )}
</div>
</section>
- {/* Family Sharing Section */}
- {hasCapability(CapabilityKeys.VaultSharing) && (
- <section>
- <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden">
- <button
- onClick={navigateToFamilySharingSettings}
- 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="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"
- />
- </svg>
- <span className="text-gray-900 dark:text-white text-left">{familySharingText.title}</span>
- <span className="ml-2 px-1.5 py-0.5 text-[10px] font-semibold rounded-full bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-300 uppercase tracking-wide">
- {familySharingText.beta}
- </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>
- </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">
- {/* 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 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="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>
- <span className="text-gray-900 dark:text-white text-left">{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"
- >
- <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">
- <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 text-left">{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>
-
- {/* 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 text-left">{t('settings.vaultUnlock')}</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 text-left">{t('settings.autoLock')}</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>
-
- {/* 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 text-left">{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"
- >
- <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">
- <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 text-left">{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>
-
- {/* Generator 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">
- {/* Password Generator Settings */}
- <button
- onClick={navigateToPasswordGeneratorSettings}
- 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="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 text-left">{t('settings.passwordGenerator')}</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>
-
- {/* Identity Generator Settings */}
- <button
- onClick={navigateToIdentityGeneratorSettings}
- 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="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"
- />
- </svg>
- <span className="text-gray-900 dark:text-white text-left">{t('settings.identityGenerator')}</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>
-
- {/* 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">
- <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 text-left">{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"
- >
- <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />
- </svg>
- </button>
-
- {/* Security Settings */}
- <button
- id="security-settings-button"
- onClick={navigateToSecuritySettings}
- 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="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
- </svg>
- <span className="text-gray-900 dark:text-white text-left">{t('settings.security')}</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 & Keyboard Shortcuts Section */}
- <section>
- <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden">
- <div className="divide-y divide-gray-200 dark:divide-gray-700">
- {/* Appearance Settings */}
- <button
- onClick={navigateToAppearanceSettings}
- 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 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828L9.828 19.071M7 17h.01"
- />
- </svg>
- <span className="text-gray-900 dark:text-white text-left">{t('settings.appearance')}</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>
-
- {/* Keyboard Shortcuts (opens browser settings) */}
- {openKeyboardShortcuts && (
- <button
- onClick={openKeyboardShortcuts}
- 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="M5 7h14a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2V9a2 2 0 012-2zM7 11h.01M11 11h.01M15 11h.01M8 15h8"
- />
- </svg>
- <span className="text-gray-900 dark:text-white text-left">{t('settings.keyboardShortcuts')}</span>
- </div>
- {/* External-link icon: indicates this opens the browser's own settings */}
- <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="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
- </svg>
- </button>
- )}
- </div>
- </div>
- </section>
+ <SettingsGroup title={t('settings.autofill')}>
+ <SettingsRow
+ label={t('settings.autofillSettings')}
+ onClick={() => navigate('/settings/autofill')}
+ icon={<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" />}
+ />
+ <SettingsRow
+ label={t('settings.passkeySettings')}
+ onClick={() => navigate('/settings/passkeys')}
+ icon={<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" />}
+ />
+ <SettingsRow
+ label={t('settings.contextMenuSettings')}
+ onClick={() => navigate('/settings/context-menu')}
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M4 6h16M4 12h16m-7 6h7" />}
+ />
+ {openKeyboardShortcuts && (
+ <SettingsRow
+ label={t('settings.keyboardShortcuts')}
+ onClick={openKeyboardShortcuts}
+ external
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M5 7h14a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2V9a2 2 0 012-2zM7 11h.01M11 11h.01M15 11h.01M8 15h8" />}
+ />
+ )}
+ </SettingsGroup>
+
+ <SettingsGroup title={t('settings.security')}>
+ <SettingsRow
+ label={t('settings.vaultUnlock')}
+ onClick={() => navigate('/settings/unlock-method')}
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14" />}
+ />
+ <SettingsRow
+ label={t('settings.autoLock')}
+ onClick={() => navigate('/settings/auto-lock')}
+ icon={<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" />}
+ />
+ <SettingsRow
+ label={t('settings.clipboardClear')}
+ onClick={() => navigate('/settings/clipboard')}
+ icon={<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" />}
+ />
+ <SettingsRow
+ id="security-settings-button"
+ label={t('settings.accountSecurity')}
+ onClick={() => navigate('/settings/security')}
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />}
+ />
+ </SettingsGroup>
+
+ <SettingsGroup title={t('settings.groups.generators')}>
+ <SettingsRow
+ label={t('settings.passwordGenerator')}
+ onClick={() => navigate('/settings/password-generator')}
+ icon={<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" />}
+ />
+ <SettingsRow
+ label={t('settings.identityGenerator')}
+ onClick={() => navigate('/settings/identity-generator')}
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />}
+ />
+ </SettingsGroup>
+
+ <SettingsGroup title={t('settings.groups.general')}>
+ <SettingsRow
+ label={t('settings.appearance')}
+ onClick={() => navigate('/settings/appearance')}
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828L9.828 19.071M7 17h.01" />}
+ />
+ <SettingsRow
+ label={t('settings.language')}
+ onClick={() => navigate('/settings/language')}
+ icon={<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" />}
+ />
+ </SettingsGroup>
<div className="text-center text-[13px] text-gray-400 dark:text-gray-600">
<div><span className="font-bold">{t('settings.appVersion')}:</span> {AppInfo.VERSION}</div>
@@ -774,4 +345,4 @@ const Settings: React.FC = () => {
);
};
-export default Settings;
\ No newline at end of file
+export default Settings;
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/settings/security/SecuritySettings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/settings/security/SecuritySettings.tsx
index 88f4fb298..8cca9f29e 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/settings/security/SecuritySettings.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/settings/security/SecuritySettings.tsx
@@ -3,88 +3,63 @@ import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import PageTitle from '@/entrypoints/popup/components/PageTitle';
+import { SettingsGroup, SettingsRow } from '@/entrypoints/popup/components/Settings/SettingsMenu';
import { useDb } from '@/entrypoints/popup/context/DbContext';
/**
- * One entry in the security settings menu.
- */
-type SecurityMenuEntry = {
- id: string;
- label: string;
- path: string;
- icon: React.ReactNode;
- disabled?: boolean;
- disabledReason?: string;
-};
-
-/**
- * Security settings page which groups the account and vault security pages.
+ * Account security page: server-side account actions, with account deletion kept apart at the bottom.
*/
const SecuritySettings: React.FC = () => {
const { t } = useTranslation();
const dbContext = useDb();
const navigate = useNavigate();
-
- const entries: SecurityMenuEntry[] = [
- {
- id: 'change-password-button',
- label: t('settings.securitySettings.changePassword.changePassword'),
- path: '/settings/security/change-password',
- disabled: dbContext.isOffline,
- disabledReason: t('common.errors.serverNotAvailable'),
- icon: <path strokeLinecap="round" strokeLinejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />,
- },
- {
- id: 'active-sessions-button',
- label: t('settings.securitySettings.activeSessionsTitle'),
- path: '/settings/security/active-sessions',
- disabled: dbContext.isOffline,
- disabledReason: t('common.errors.serverNotAvailable'),
- icon: <path strokeLinecap="round" strokeLinejoin="round" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />,
- },
- {
- id: 'auth-logs-button',
- label: t('settings.securitySettings.recentAuthLogs'),
- path: '/settings/security/auth-logs',
- disabled: dbContext.isOffline,
- disabledReason: t('common.errors.serverNotAvailable'),
- icon: <path strokeLinecap="round" strokeLinejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" />,
- },
- ];
+ const offlineReason = t('common.errors.serverNotAvailable');
return (
<div className="space-y-6">
<div>
- <PageTitle>{t('settings.security')}</PageTitle>
+ <PageTitle>{t('settings.accountSecurity')}</PageTitle>
<p className="text-sm text-gray-600 dark:text-gray-400">{t('settings.securitySettings.description')}</p>
</div>
- <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">
- {entries.map((entry) => (
- <button
- key={entry.id}
- id={entry.id}
- onClick={() => navigate(entry.path)}
- disabled={entry.disabled}
- title={entry.disabled ? entry.disabledReason : undefined}
- className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
- >
- <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">
- {entry.icon}
- </svg>
- <span className="text-gray-900 dark:text-white text-left">{entry.label}</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>
+ <SettingsGroup>
+ <SettingsRow
+ id="change-password-button"
+ label={t('settings.securitySettings.changeMasterPassword')}
+ onClick={() => navigate('/settings/security/change-password')}
+ disabled={dbContext.isOffline}
+ disabledReason={offlineReason}
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />}
+ />
+ <SettingsRow
+ id="active-sessions-button"
+ label={t('settings.securitySettings.activeSessionsTitle')}
+ onClick={() => navigate('/settings/security/active-sessions')}
+ disabled={dbContext.isOffline}
+ disabledReason={offlineReason}
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />}
+ />
+ <SettingsRow
+ id="auth-logs-button"
+ label={t('settings.securitySettings.recentAuthLogs')}
+ onClick={() => navigate('/settings/security/auth-logs')}
+ disabled={dbContext.isOffline}
+ disabledReason={offlineReason}
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" />}
+ />
+ </SettingsGroup>
+
+ <SettingsGroup>
+ <SettingsRow
+ id="delete-account-button"
+ label={t('settings.securitySettings.deleteAccount.deleteAccount')}
+ onClick={() => navigate('/settings/security/delete-account')}
+ danger
+ disabled={dbContext.isOffline}
+ disabledReason={offlineReason}
+ icon={<path strokeLinecap="round" strokeLinejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />}
+ />
+ </SettingsGroup>
</div>
);
};