Refactor settings account tab#44
Conversation
📝 WalkthroughWalkthroughThe Account tab in Settings.vue is refactored by extracting inline account card rendering into a new ChangesAccount Settings Extraction
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/frontend/src/components/settings/account/AccountSettingsTab.vue (1)
13-77: ⚡ Quick winUse
v-elseinstead of a secondv-if="!isSimple", and deduplicateAccountPasswordCard.Two separate issues on this block:
<template v-if="isSimple">/<template v-if="!isSimple">evaluates the condition twice. Usev-elseto make the mutual exclusion explicit and avoid the double evaluation.
AccountPasswordCardis rendered identically in both branches — the only difference is the:titleprop key (settings.tabs.accountvssettings.account.passwordTitle). Moving it outside the branches and binding a computed title eliminates the duplication.♻️ Proposed refactor
- <template v-if="isSimple"> - <AccountPasswordCard - v-if="!accountToken" - :t="t" - :title="t('settings.tabs.account')" - :email="authEmail" - :password="authPassword" - :loading="authLoading" - :error="authError" - `@update`:email="$emit('update:authEmail', $event)" - `@update`:password="$emit('update:authPassword', $event)" - `@login`="$emit('login')" - `@register`="$emit('register')" - /> + <AccountPasswordCard + v-if="!accountToken" + :t="t" + :title="isSimple ? t('settings.tabs.account') : t('settings.account.passwordTitle')" + :email="authEmail" + :password="authPassword" + :loading="authLoading" + :error="authError" + `@update`:email="$emit('update:authEmail', $event)" + `@update`:password="$emit('update:authPassword', $event)" + `@login`="$emit('login')" + `@register`="$emit('register')" + /> + + <template v-if="isSimple"> <AccountSimpleSyncCard v-else ... /> </template> - <template v-if="!isSimple"> - <AccountPasswordCard - v-if="!accountToken" - :t="t" - :title="t('settings.account.passwordTitle')" - ... - /> + <template v-else> <AccountAdvancedSummaryCard v-else ... /> <AccountDeviceTableCard v-if="accountToken" ... /> </template>
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 46bf6f89-c95c-47eb-8747-e35d93c68600
📒 Files selected for processing (2)
src/frontend/src/components/pages/Settings.vuesrc/frontend/src/components/settings/account/AccountSettingsTab.vue
Summary
Verification
Summary by CodeRabbit