"use client"; import { useTranslations } from 'next-intl'; import { useAuthStore } from '@/stores/auth-store'; import { useEmailStore } from '@/stores/email-store'; import { useAccountStore } from '@/stores/account-store'; import { SettingsSection, SettingItem } from './settings-section'; import { formatFileSize } from '@/lib/utils'; export function AccountSettings() { const t = useTranslations('settings.account'); const { username, serverUrl, isDemoMode, primaryIdentity, authMode, activeAccountId } = useAuthStore(); const { quota } = useEmailStore(); const account = useAccountStore((s) => activeAccountId ? s.getAccountById(activeAccountId) : undefined); const quotaPercentage = quota ? Math.round((quota.used / quota.total) * 100) : 0; const displayName = primaryIdentity?.name || account?.displayName || (isDemoMode ? 'Demo User' : undefined); const email = primaryIdentity?.email || account?.email || username; return ( {/* Display Name */} {displayName || t('../../common.unknown')} {/* Email Address */} {email || t('../../common.unknown')} {/* Username / Login (show when it differs from email) */} {username && username !== email && ( {username} )} {/* Authentication Method */} {authMode === 'oauth' ? t('auth_method_oauth') : t('auth_method_basic')} {/* Server */} {serverUrl || t('../../common.unknown')} {/* Storage */} {quota && quota.total > 0 && (
{t('storage.percentage', { percent: quotaPercentage })}
)} {/* Demo mode indicator */} {isDemoMode && ( {t('demo_account')} )} ); }