diff options
-rw-r--r-- | src/components/ContactDetails.vue | 18 | ||||
-rw-r--r-- | src/components/ContactDetails/ContactDetailsAvatar.vue | 14 | ||||
-rw-r--r-- | src/components/ContactsList.vue | 8 | ||||
-rw-r--r-- | src/components/Properties/PropertyText.vue | 2 | ||||
-rw-r--r-- | src/components/Settings/SettingsAddressbook.vue | 11 | ||||
-rw-r--r-- | src/components/Settings/SettingsAddressbookSharee.vue | 5 | ||||
-rw-r--r-- | src/components/Settings/SettingsNewAddressbook.vue | 3 | ||||
-rw-r--r-- | src/main.js | 3 | ||||
-rw-r--r-- | src/store/addressbooks.js | 5 | ||||
-rw-r--r-- | src/store/contacts.js | 6 | ||||
-rw-r--r-- | src/views/Contacts.vue | 9 |
11 files changed, 52 insertions, 32 deletions
diff --git a/src/components/ContactDetails.vue b/src/components/ContactDetails.vue index e806904a..81806cc3 100644 --- a/src/components/ContactDetails.vue +++ b/src/components/ContactDetails.vue @@ -21,7 +21,7 @@ --> <template> - <div id="contact-details" class="app-content-details"> + <AppContentDetails> <!-- nothing selected or contact not found --> <EmptyContent v-if="!contact && !loading" icon="icon-contacts"> {{ t('contacts', 'No contact selected') }} @@ -37,7 +37,7 @@ <template v-else> <!-- contact header --> - <header> + <header class="contact-header"> <!-- avatar and upload photo --> <ContactAvatar :contact="contact" @@ -46,7 +46,7 @@ contact-avatar ? :avatar="contact.photo"--> <!-- fullname, org, title --> - <div id="contact-header-infos"> + <div class="contact-header__infos"> <h2> <input id="contact-fullname" ref="fullname" @@ -86,7 +86,7 @@ </div> <!-- actions --> - <div id="contact-header-actions"> + <div class="contact-header__actions"> <!-- warning message --> <a v-if="loadingUpdate || warning" v-tooltip.bottom="{ @@ -234,7 +234,7 @@ <PropertyRev v-if="contact.rev" :value="contact.rev" /> </section> </template> - </div> + </AppContentDetails> </template> <script> @@ -249,6 +249,7 @@ import { VueMasonryPlugin } from 'vue-masonry' import ActionButton from '@nextcloud/vue/dist/Components/ActionButton' import ActionLink from '@nextcloud/vue/dist/Components/ActionLink' import Actions from '@nextcloud/vue/dist/Components/Actions' +import AppContentDetails from '@nextcloud/vue/dist/Components/AppContentDetails' import Modal from '@nextcloud/vue/dist/Components/Modal' import Multiselect from '@nextcloud/vue/dist/Components/Multiselect' @@ -274,6 +275,7 @@ export default { ActionLink, Actions, AddNewProp, + AppContentDetails, ContactAvatar, ContactProperty, EmptyContent, @@ -775,7 +777,7 @@ export default { </script> <style lang="scss"> -#contact-details { +.app-content-details { flex: 1 1 100%; min-width: 0; @@ -787,7 +789,7 @@ export default { font-weight: bold; // ORG-TITLE-NAME - #contact-header-infos { + .contact-header__infos { display: flex; flex: 1 1 auto; // shrink avatar before this one flex-direction: column; @@ -819,7 +821,7 @@ export default { } // ACTIONS - #contact-header-actions { + .contact-header__actions { position: relative; display: flex; .header-menu { diff --git a/src/components/ContactDetails/ContactDetailsAvatar.vue b/src/components/ContactDetails/ContactDetailsAvatar.vue index b5eb5323..9ae83770 100644 --- a/src/components/ContactDetails/ContactDetailsAvatar.vue +++ b/src/components/ContactDetails/ContactDetailsAvatar.vue @@ -162,7 +162,7 @@ import Actions from '@nextcloud/vue/dist/Components/Actions' import ActionButton from '@nextcloud/vue/dist/Components/ActionButton' import ActionLink from '@nextcloud/vue/dist/Components/ActionLink' -import { getFilePickerBuilder } from '@nextcloud/dialogs' +import { showError, showInfo, getFilePickerBuilder, showSuccess } from '@nextcloud/dialogs' import { generateUrl, generateRemoteUrl } from '@nextcloud/router' import { getCurrentUser } from '@nextcloud/auth' import { loadState } from '@nextcloud/initial-state' @@ -274,7 +274,7 @@ export default { self.setPhoto(imageBase64, type) } catch (error) { console.error(error) - OC.Notification.showTemporary(t('contacts', 'Invalid image')) + showError(t('contacts', 'Invalid image')) } finally { self.resetPicker() } @@ -284,7 +284,7 @@ export default { const blob = file.slice(0, 4) reader.readAsArrayBuffer(blob) } else { - OC.Notification.showTemporary(t('contacts', 'Image is too big (max 1MB).')) + showError(t('contacts', 'Image is too big (max 1MB).')) this.resetPicker() } } @@ -412,7 +412,7 @@ export default { const data = Buffer.from(response.data, 'binary').toString('base64') this.setPhoto(data, type) } catch (error) { - OC.Notification.showTemporary(t('contacts', 'Error while processing the picture.')) + showError(t('contacts', 'Error while processing the picture.')) console.error(error) this.loading = false } @@ -448,12 +448,12 @@ export default { await this.$emit('updateLocalContact', contact) // Notify user - OC.Notification.showTemporary(t('contacts', 'Avatar downloaded from social network')) + showSuccess(t('contacts', 'Avatar downloaded from social network')) } catch (error) { if (error.response.status === 304) { - OC.Notification.showTemporary(t('contacts', 'Avatar already up to date')) + showInfo(t('contacts', 'Avatar already up to date')) } else { - OC.Notification.showTemporary(t('contacts', 'Avatar download failed')) + showError(t('contacts', 'Avatar download failed')) console.debug(error) } } diff --git a/src/components/ContactsList.vue b/src/components/ContactsList.vue index 6548faf5..743dc77c 100644 --- a/src/components/ContactsList.vue +++ b/src/components/ContactsList.vue @@ -186,6 +186,14 @@ export default { </script> <style lang="scss" scoped> +.app-content-list { + flex: 1 1 300px; + + .empty-content { + padding: 20px; + } +} + // Virtual scroller overrides .vue-recycle-scroller { position: sticky !important; diff --git a/src/components/Properties/PropertyText.vue b/src/components/Properties/PropertyText.vue index 129bd811..0cbbecac 100644 --- a/src/components/Properties/PropertyText.vue +++ b/src/components/Properties/PropertyText.vue @@ -72,7 +72,7 @@ :class="{'property__value--with-ext': haveExtHandler}" type="text" class="property__value" - :placeholder="type" + :placeholder="localType.placeholder" @input="updateValue"> <!-- external link --> diff --git a/src/components/Settings/SettingsAddressbook.vue b/src/components/Settings/SettingsAddressbook.vue index e62ca5cf..2f75bb5b 100644 --- a/src/components/Settings/SettingsAddressbook.vue +++ b/src/components/Settings/SettingsAddressbook.vue @@ -99,6 +99,7 @@ import ActionButton from '@nextcloud/vue/dist/Components/ActionButton' import ActionInput from '@nextcloud/vue/dist/Components/ActionInput' import ActionCheckbox from '@nextcloud/vue/dist/Components/ActionCheckbox' import ShareAddressBook from './SettingsAddressbookShare' +import { showError, showSuccess } from '@nextcloud/dialogs' export default { name: 'SettingsAddressbook', @@ -195,7 +196,7 @@ export default { } catch (err) { // error handling console.error(err) - OC.Notification.showTemporary(t('contacts', 'Toggling of address book was not successful')) + showError(t('contacts', 'Toggling of address book was not successful')) } finally { // stop loading status regardless of outcome this.toggleEnabledLoading = false @@ -220,7 +221,7 @@ export default { } catch (err) { // error handling console.error(err) - OC.Notification.showTemporary(t('contacts', 'Deletion of address book was not successful.')) + showError(t('contacts', 'Deletion of address book was not successful.')) } finally { // stop loading status regardless of outcome this.deleteAddressbookLoading = false @@ -241,7 +242,7 @@ export default { } catch (err) { // error handling console.error(err) - OC.Notification.showTemporary(t('contacts', 'Renaming of address book was not successful.')) + showError(t('contacts', 'Renaming of address book was not successful.')) } finally { this.editingName = false // stop loading status regardless of outcome @@ -260,11 +261,11 @@ export default { this.copySuccess = true this.copied = true // Notify addressbook was copied - OC.Notification.showTemporary(t('contacts', 'Address book copied to clipboard')) + showSuccess(t('contacts', 'Address book copied to clipboard')) } catch (error) { this.copySuccess = false this.copied = true - OC.Notification.showTemporary(t('contacts', 'Address book was not copied to clipboard.')) + showError(t('contacts', 'Address book was not copied to clipboard.')) } finally { this.copyLoading = false setTimeout(() => { diff --git a/src/components/Settings/SettingsAddressbookSharee.vue b/src/components/Settings/SettingsAddressbookSharee.vue index ddb43a37..f9bb7af0 100644 --- a/src/components/Settings/SettingsAddressbookSharee.vue +++ b/src/components/Settings/SettingsAddressbookSharee.vue @@ -53,6 +53,7 @@ </template> <script> +import { showError } from '@nextcloud/dialogs' export default { name: 'SettingsAddressbookSharee', @@ -98,7 +99,7 @@ export default { }) } catch (error) { console.error(error) - OC.Notification.showTemporary(t('contacts', 'Unable to delete the share.')) + showError(t('contacts', 'Unable to delete the share')) } finally { this.loading = false } @@ -117,7 +118,7 @@ export default { }) } catch (error) { console.error(error) - OC.Notification.showTemporary(t('contacts', 'Unable to change permissions.')) + showError(t('contacts', 'Unable to change permissions')) } finally { this.loading = false } diff --git a/src/components/Settings/SettingsNewAddressbook.vue b/src/components/Settings/SettingsNewAddressbook.vue index 7d5f72d2..2b4a764c 100644 --- a/src/components/Settings/SettingsNewAddressbook.vue +++ b/src/components/Settings/SettingsNewAddressbook.vue @@ -45,6 +45,7 @@ </template> <script> +import { showError } from '@nextcloud/dialogs' export default { name: 'SettingsNewAddressbook', @@ -71,7 +72,7 @@ export default { }) .catch((error) => { console.error(error) - OC.Notification.showTemporary(t('contacts', 'An error occurred, unable to create the address book.')) + showError(t('contacts', 'An error occurred, unable to create the address book')) this.loading = false }) }, diff --git a/src/main.js b/src/main.js index c752e160..b478cf94 100644 --- a/src/main.js +++ b/src/main.js @@ -34,6 +34,9 @@ import ClickOutside from 'vue-click-outside' import VTooltip from '@nextcloud/vue/dist/Directives/Tooltip' import VueClipboard from 'vue-clipboard2' +// Dialogs css +import '@nextcloud/dialogs/styles/toast.scss' + // CSP config for webpack dynamic chunk loading // eslint-disable-next-line __webpack_nonce__ = btoa(getRequestToken()) diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js index b6bea889..1a4a7c49 100644 --- a/src/store/addressbooks.js +++ b/src/store/addressbooks.js @@ -21,8 +21,9 @@ * */ -import Vue from 'vue' +import { showError } from '@nextcloud/dialogs' import pLimit from 'p-limit' +import Vue from 'vue' import Contact from '../models/contact' @@ -367,7 +368,7 @@ const actions = { }, []) if (failed > 0) { - OC.Notification.showTemporary(n( + showError(n( 'contacts', '{failed} contact failed to be read', '{failed} contacts failed to be read', diff --git a/src/store/contacts.js b/src/store/contacts.js index 2b9bc6af..9698bdba 100644 --- a/src/store/contacts.js +++ b/src/store/contacts.js @@ -20,8 +20,10 @@ * */ -import Vue from 'vue' +import { showError } from '@nextcloud/dialogs' import ICAL from 'ical.js' +import Vue from 'vue' + import Contact from '../models/contact' import validate from '../services/validate' @@ -293,7 +295,7 @@ const actions = { await contact.dav.delete() .catch((error) => { console.error(error) - OC.Notification.showTemporary(t('contacts', 'An error occurred')) + showError(t('contacts', 'Unable to delete contact')) }) } context.commit('deleteContact', contact) diff --git a/src/views/Contacts.vue b/src/views/Contacts.vue index 7070d7b8..3fb2e903 100644 --- a/src/views/Contacts.vue +++ b/src/views/Contacts.vue @@ -212,6 +212,7 @@ import Content from '@nextcloud/vue/dist/Components/Content' import isMobile from '@nextcloud/vue/dist/Mixins/isMobile' import Modal from '@nextcloud/vue/dist/Components/Modal' +import { showError } from '@nextcloud/dialogs' import { VCardTime } from 'ical.js' import download from 'downloadjs' import moment from 'moment' @@ -489,7 +490,7 @@ export default { }, }) } catch (error) { - OC.Notification.showTemporary(t('contacts', 'Unable to create the contact.')) + showError(t('contacts', 'Unable to create the contact.')) console.error(error) } }, @@ -527,7 +528,7 @@ export default { */ selectFirstContactIfNone() { // Do not redirect if pending import - if (this.$route.name !== 'import') { + if (this.$route.name === 'import') { return } @@ -535,7 +536,7 @@ export default { if (this.selectedContact === undefined || !inList) { // Unknown contact if (this.selectedContact && !inList) { - OC.Notification.showTemporary(t('contacts', 'Contact not found')) + showError(t('contacts', 'Contact not found')) this.$router.push({ name: 'group', params: { @@ -548,7 +549,7 @@ export default { if (!this.groups.find(group => group.name === this.selectedGroup) && this.GROUP_ALL_CONTACTS !== this.selectedGroup && this.GROUP_NO_GROUP_CONTACTS !== this.selectedGroup) { - OC.Notification.showTemporary(t('contacts', 'Group not found')) + showError(t('contacts', 'Group not found')) this.$router.push({ name: 'root', }) |