Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 31 additions & 29 deletions src/components/AppNavigation/ContactsSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
</CheckboxRadioSwitch>
<SettingsSortContacts class="contacts-settings-modal__form__row" />
</AppSettingsSection>

<AppSettingsSection id="address-books" :name="t('contacts', 'Address books')">
<div class="contacts-settings-modal__form">
<div class="contacts-settings-modal__form__row">
Expand Down Expand Up @@ -57,11 +58,12 @@ export default {
components: {
AppSettingsDialog,
AppSettingsSection,
NcFormBox,
NcFormBoxSwitch,
SettingsAddressbook,
SettingsNewAddressbook,
SettingsImportContacts,
SettingsSortContacts,
CheckboxRadioSwitch,
},
props: {
open: {
Expand All @@ -71,7 +73,6 @@ export default {
},
data() {
return {
CONTACTS_SETTINGS,
allowSocialSync: loadState('contacts', 'allowSocialSync') !== 'no',
enableSocialSync: loadState('contacts', 'enableSocialSync') !== 'no',
enableSocialSyncLoading: false,
Expand Down Expand Up @@ -111,6 +112,10 @@ export default {
await axios.put(generateUrl('apps/contacts/api/v1/social/config/user/enableSocialSync'), {
allow: setting,
})
showSuccess(t('contacts', 'Setting saved'))
} catch {
showError(t('contacts', 'Failed to save setting'))
this.enableSocialSync = !value
} finally {
this.enableSocialSyncLoading = false
}
Expand All @@ -125,36 +130,33 @@ export default {
}
</script>

<style scoped>
>>> .app-settings__title {
padding: 20px 0;
margin-bottom: 0;
}

.app-settings-section {
margin-bottom: 45px;
padding: 25px 25px 0 25px;
}
<style lang="scss" scoped>
.addressbook-list {
list-style: none;
padding: 0;
margin: 0 0 calc(var(--default-grid-baseline) * 2);

.social-sync__checkbox, .settings-new-addressbook {
margin-bottom: 20px;
}
:deep(.settings-addressbook-list) {
display: flex;
align-items: center;
gap: calc(var(--default-grid-baseline) * 2);
padding: calc(var(--default-grid-baseline) * 2) 0;
border-bottom: 1px solid var(--color-border);

.contacts-settings-modal__form__row >>> .material-design-icon {
justify-content: flex-start;
}
&:last-child {
border-bottom: none;
}

.settings-new-addressbook >>> .new-addressbook-input {
min-height: 44px;
height: 44px;
width: 100%;
}
.settings-line__icon {
flex-shrink: 0;
width: 44px;
height: 44px;
}

.settings-new-addressbook >>> .icon-confirm {
min-height: 44px;
height: 44px;
border-color: var(--color-border-dark) !important;
border-inline-start: none;
.addressbook {
flex: 1;
padding: 0;
}
}
}

</style>
20 changes: 20 additions & 0 deletions src/components/AppNavigation/Settings/SettingsAddressbook.vue
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,26 @@ export default {
.settings-addressbook-list {
display: flex;
width: 100%;
align-items: center;
gap: calc(var(--default-grid-baseline) * 2);
padding: calc(var(--default-grid-baseline) * 2) 0;
border-bottom: 1px solid var(--color-border);

&:last-child {
border-bottom: none;
}

.settings-line__icon {
flex-shrink: 0;
width: 44px;
height: 44px;
}

.addressbook {
flex: 1;
padding: 0;
}

.material-design-icon {
justify-content: flex-start;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,32 @@
<template #trailing-button-icon>
<IconAdd :size="20" />
</template>
</NcInputField>
{{ t('contacts', 'New address book') }}
</NcButton>
<IconLoading v-if="loading" :size="20" />

<NcModal v-if="modalOpen" size="small" @close="onModalCancel">
<div class="new-addressbook-modal">
<NcInputField
v-model:model-value="displayName"
class="new-addressbook"
:disabled="loading"
:label="t('contacts', 'Add new address book')"
type="text"
autocomplete="off"
autocorrect="off"
spellcheck="false" />

<div class="new-addressbook-modal__buttons">
<NcButton variant="tertiary" :disabled="loading" @click="onModalCancel">
{{ t('contacts', 'Cancel') }}
</NcButton>
<NcButton variant="primary" :disabled="loading || inputErrorState" @click="onModalSubmit">
{{ t('contacts', 'Add') }}
</NcButton>
</div>
</div>
</NcModal>
</div>
</template>

Expand All @@ -37,11 +62,14 @@ export default {
NcInputField,
IconAdd,
IconLoading,
NcButton,
NcModal,
},
data() {
return {
loading: false,
displayName: '',
modalOpen: false,
}
},
computed: {
Expand All @@ -55,6 +83,21 @@ export default {
},
},
methods: {
openModal() {
this.modalOpen = true
},

onModalCancel() {
this.modalOpen = false
this.displayName = ''
this.loading = false
},

async onModalSubmit() {
await this.addAddressbook()
this.modalOpen = false
},

/**
* Add a new address book
*/
Expand All @@ -78,3 +121,32 @@ export default {
},
}
</script>

<style lang="scss" scoped>

.new-addressbook-entry {
display: flex;
width: 100%;
justify-content: stretch;
margin-top: calc(var(--default-grid-baseline) * 2);

> * {
flex-grow: 1;
}
}

.new-addressbook-modal {
padding: calc(var(--default-grid-baseline) * 4);
padding-top: calc(var(--default-grid-baseline) * 8);
> * {
width: 100%;
}

&__buttons {
display: flex;
justify-content: end;
gap: calc(var(--default-grid-baseline) * 2);
margin-top: calc(var(--default-grid-baseline) * 2);
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@

<script>
import { NcSelect } from '@nextcloud/vue'
import IconList from 'vue-material-design-icons/FormatListBulletedSquare.vue'
import NcFormBox from '@nextcloud/vue/components/NcFormBox'

export default {
name: 'SettingsSortContacts',

components: {
NcFormBox,
NcSelect,
IconList,
},

computed: {
/* Order Keys */
options() {
return [
{
Expand Down Expand Up @@ -84,5 +83,7 @@ export default {
<style lang="scss" scoped>
.sort-contacts {
display: flex;
flex-direction: column;
gap: calc(var(--default-grid-baseline) * 2);
}
</style>