Skip to content

Commit

Permalink
fixup! Feat: cross link app settings to account settings
Browse files Browse the repository at this point in the history
Signed-off-by: greta <[email protected]>
  • Loading branch information
GretaD committed Sep 4, 2024
1 parent f587af5 commit c0d8f44
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 33 deletions.
3 changes: 0 additions & 3 deletions src/components/AccountSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ export default {
}
},
computed: {
menu() {
return this.buildMenu()
},
displayName() {
return this.account.name
},
Expand Down
32 changes: 15 additions & 17 deletions src/components/AppSettingsMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:name="t('mail', 'Mail settings')"
:show-navigation="true"
:open.sync="showSettings">
<NcAppSettingsSection id="account-settings" :name="t('mail', 'Account creation')">
<NcAppSettingsSection id="account-creation" :name="t('mail', 'Accounts')">
<NcButton v-if="allowNewMailAccounts"
type="primary"
to="/setup"
Expand All @@ -19,6 +19,18 @@
</template>
{{ t('mail', 'Add mail account') }}
</NcButton>

<h4>{{ t('mail', 'Account settings') }}</h4>
<p>{{ t('mail', 'Settings for:') }}</p>
<li v-for="account in accounts" :key="account.id">
<NcButton v-if="account && account.emailAddress"
class="app-settings-button"
type="secondary"
:aria-label="t('mail', 'Account settings')"
@click="openAccountSettings(account.id)">
{{ account.emailAddress }}
</NcButton>
</li>
</NcAppSettingsSection>

<NcAppSettingsSection id="appearance-and-accessibility" :name="t('mail', 'General')">
Expand Down Expand Up @@ -279,19 +291,6 @@
</div>
</dl>
</NcAppSettingsSection>
<NcAppSettingsSection id="mailbox_settings" :name="t('mail', 'Account settings')">
<li v-for="account in accounts" :key="account.id">
<NcButton v-if="account && account.emailAddress"
class="app-settings-button"
type="primary"
@click="openAccountSettings(account.id)">
{{ account.emailAddress }}
</NcButton>
</li>
<AccountSettings :open.sync="showAccountSettings"
:account="selectedAccount"
@update:open="closeAccountSettings"/>
</NcAppSettingsSection>
</NcAppSettingsDialog>
</div>
</template>
Expand Down Expand Up @@ -427,9 +426,8 @@ export default {
this.showAccountSettings = false
},
openAccountSettings(accountId) {
this.selectedAccount = this.accounts.find(account => account.id === accountId)
this.showMailSettings = false
this.showAccountSettings = true
this.$store.commit('showSettingsForAccount', accountId)
this.showSettings = false
},
checkMailvelope() {
this.mailvelopeIsAvailable = !!window.mailvelope
Expand Down
27 changes: 14 additions & 13 deletions src/components/NavigationAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
{{ quotaText }}
</ActionText>
<ActionButton :close-after-click="true"
@click="showAccountSettings"
@shortkey="toggleAccountSettings">
@click="showAccountSettings(true)">
<template #icon>
<IconSettings :size="16" />
</template>
Expand Down Expand Up @@ -81,7 +80,7 @@
</template>
</template>
</NcAppNavigationCaption>
<AccountSettings :open="showSettings" :account="account" @update:open="toggleAccountSettings" />
<AccountSettings :open="showSettings" :account="account" @update:open="showAccountSettings($event)" />
</Fragment>
</template>

Expand Down Expand Up @@ -150,11 +149,13 @@ export default {
quota: undefined,
editing: false,
showSaving: false,
showSettings: false,
createMailboxName: '',
}
},
computed: {
showSettings() {
return this.$store.getters.showSettingsForAccount(this.account.id)
},
visible() {
return this.account.isUnified !== true && this.account.visible !== false
},
Expand Down Expand Up @@ -276,16 +277,16 @@ export default {
}
},
/**
* Toggles the account settings overview
*/
toggleAccountSettings() {
this.showSettings = !this.showSettings
},
/**
* Shows the account settings
* Show the settings for the given account
*
* @param {boolean} show true to show, false to hide
*/
showAccountSettings() {
this.showSettings = true
showAccountSettings(show) {
if (show) {
this.$store.commit('showSettingsForAccount', this.account.id)
} else {
this.$store.commit('showSettingsForAccount', null)
}
},
},
}
Expand Down
1 change: 1 addition & 0 deletions src/store/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,5 @@ export const getters = {
hasFetchedInitialEnvelopes: (state) => state.hasFetchedInitialEnvelopes,
isFollowUpFeatureAvailable: (state) => state.followUpFeatureAvailable,
getInternalAddresses: (state) => state.internalAddress?.filter(internalAddress => internalAddress !== undefined),
showSettingsForAccount: (state) => (accountId) => state.showAccountSettings === accountId,
}
1 change: 1 addition & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default new Store({
hasFetchedInitialEnvelopes: false,
followUpFeatureAvailable: false,
internalAddress: [],
showAccountSettings: null,
},
getters,
mutations,
Expand Down
3 changes: 3 additions & 0 deletions src/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,4 +513,7 @@ export default {
setFollowUpFeatureAvailable(state, followUpFeatureAvailable) {
state.followUpFeatureAvailable = followUpFeatureAvailable
},
showSettingsForAccount(state, accountId) {
state.showAccountSettings = accountId
},
}

0 comments on commit c0d8f44

Please sign in to comment.