From d8ede82510afe55a06c754710463a45eab6e5d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Mon, 11 May 2020 18:38:15 +0200 Subject: Add create group entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- css/ContactsList.scss | 14 ------- src/components/ContactDetails.vue | 26 +++++++------ src/components/ContactsList.vue | 37 +++++++++++++++++++ src/components/EmptyContent.vue | 77 +++++++++++++++++++++++++++++++++++++++ src/store/groups.js | 23 ++++++++++++ src/views/Contacts.vue | 38 ++++++++++++++++++- 6 files changed, 188 insertions(+), 27 deletions(-) create mode 100644 src/components/EmptyContent.vue diff --git a/css/ContactsList.scss b/css/ContactsList.scss index 75ef932a..43e8f17c 100644 --- a/css/ContactsList.scss +++ b/css/ContactsList.scss @@ -33,17 +33,3 @@ border-radius: 50%; opacity: 1; } - -// Virtual scroller overrides -.vue-recycle-scroller { - position: sticky !important; -} - -.vue-recycle-scroller__item-view { - // TODO: find better solution? - // https://github.com/Akryum/vue-virtual-scroller/issues/70 - // hack to not show the transition - overflow: hidden; - // same as app-content-list-item - height: 68px; -} diff --git a/src/components/ContactDetails.vue b/src/components/ContactDetails.vue index 10c69a04..da1b7e87 100644 --- a/src/components/ContactDetails.vue +++ b/src/components/ContactDetails.vue @@ -23,17 +23,17 @@ + + \ No newline at end of file diff --git a/src/components/EmptyContent.vue b/src/components/EmptyContent.vue new file mode 100644 index 00000000..5198f8ce --- /dev/null +++ b/src/components/EmptyContent.vue @@ -0,0 +1,77 @@ + + + + + + + diff --git a/src/store/groups.js b/src/store/groups.js index 8df01b19..981e0932 100644 --- a/src/store/groups.js +++ b/src/store/groups.js @@ -105,6 +105,19 @@ const mutations = { } }) }, + + /** + * Add a group + * + * @param {Object} state the store data + * @param {string} groupName the name of the group + */ + addGroup(state, groupName) { + state.groups.push({ + name: groupName, + contacts: [], + }) + }, } const getters = { @@ -146,6 +159,16 @@ const actions = { removeContactToGroup(context, { groupName, contact }) { context.commit('removeContactToGroup', { groupName, contact }) }, + + /** + * Add a group + * + * @param {Object} context the store mutations + * @param {string} groupName the name of the group + */ + addGroup(context, groupName) { + context.commit('addGroup', groupName) + }, } export default { state, mutations, getters, actions } diff --git a/src/views/Contacts.vue b/src/views/Contacts.vue index 13c5dc16..60784a97 100644 --- a/src/views/Contacts.vue +++ b/src/views/Contacts.vue @@ -52,6 +52,20 @@ {{ item.utils.counter }} + + + + @@ -70,7 +84,9 @@
- @@ -96,6 +112,7 @@ import AppNavigationCounter from '@nextcloud/vue/dist/Components/AppNavigationCo import AppNavigationNew from '@nextcloud/vue/dist/Components/AppNavigationNew' import AppNavigationSettings from '@nextcloud/vue/dist/Components/AppNavigationSettings' import ActionButton from '@nextcloud/vue/dist/Components/ActionButton' +import ActionInput from '@nextcloud/vue/dist/Components/ActionInput' import Content from '@nextcloud/vue/dist/Components/Content' import Modal from '@nextcloud/vue/dist/Components/Modal' import isMobile from '@nextcloud/vue/dist/Mixins/isMobile' @@ -128,6 +145,7 @@ export default { AppNavigationNew, AppNavigationSettings, ActionButton, + ActionInput, ContactDetails, ContactsList, Content, @@ -155,6 +173,8 @@ export default { data() { return { + isNewGroupMenuOpen: false, + isCreatingGroup: false, loading: true, searchQuery: '', } @@ -510,6 +530,22 @@ export default { this.$store.dispatch('changeStage', 'default') } }, + + toggleNewGroupMenu() { + this.isNewGroupMenuOpen = !this.isNewGroupMenuOpen + }, + createNewGroup(e) { + const input = e.target.querySelector('input[type=text]') + const groupName = input.value.trim() + this.$store.dispatch('addGroup', groupName) + this.isNewGroupMenuOpen = false + }, }, } + + -- cgit v1.2.3