diff options
author | Joas Schilling <coding@schilljs.com> | 2020-09-11 16:37:08 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-09-11 16:37:08 +0300 |
commit | dd8d415473d7a39ecfcfaec7cea0f4b52466c796 (patch) | |
tree | c52d03ece00442ad34a6195d096c740f01798b1b /src/views | |
parent | 77626f57142585fd73d3bf7f39fea83401d929d0 (diff) |
Bump vue-dashboard library
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/Dashboard.vue | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index b9ffaae65..0342118ef 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -25,17 +25,15 @@ :items="roomOptions" :show-more-url="''" :loading="loading" - @hide="() => {}" - @markDone="() => {}"> + :show-items-and-empty-content="!hasImportantConversations" + :half-empty-content-message="t('spreed', 'No unread mentions')"> <template v-slot:default="{ item }"> - <EmptyContent v-if="item.empty" - class="half-screen" - icon="icon-checkmark"> - <template #desc> - {{ t('spreed', 'No unread mentions') }} - </template> - </EmptyContent> - <DashboardWidgetItem v-else :item="getWidgetItem(item)"> + <DashboardWidgetItem + :target-url="getItemTargetUrl(item)" + :main-text="getMainText(item)" + :sub-text="getSubText(item)" + :item="item" + v-on="handlers"> <template v-slot:avatar> <ConversationIcon :item="item" @@ -79,12 +77,15 @@ const propertySort = (properties) => (a, b) => properties.map(obj => { export default { name: 'Dashboard', components: { DashboardWidget, DashboardWidgetItem, ConversationIcon, EmptyContent }, + data() { return { roomOptions: [], + hasImportantConversations: false, loading: true, } }, + computed: { callLink() { return (conversation) => { @@ -116,6 +117,18 @@ export default { } }, + getItemTargetUrl() { + return (conversation) => { + return generateUrl(`call/${conversation.token}`) + } + }, + + getMainText() { + return (conversation) => { + return conversation.displayName + } + }, + getSubText() { return (conversation) => { if (conversation.hasCall) { @@ -129,23 +142,14 @@ export default { return this.simpleLastChatMessage(conversation.lastMessage) } }, - - getWidgetItem() { - return (conversation) => { - return { - targetUrl: generateUrl(`call/${conversation.token}`), - mainText: conversation.displayName, - subText: this.getSubText(conversation), - conversation, - } - } - }, }, + beforeMount() { this.fetchRooms() // FIXME: reduce interval if user not active setInterval(() => this.fetchRooms(), ROOM_POLLING_INTERVAL * 1000) }, + methods: { fetchRooms() { axios.get(generateOcsUrl('apps/spreed/api/v2', 2) + 'room').then((response) => { @@ -159,17 +163,14 @@ export default { this.roomOptions = importantRooms.slice(0, 7) this.hasImportantConversations = true } else { - const items = rooms.sort(propertySort(['-lastActivity'])).slice(0, 4) - items.unshift({ - empty: true, - }) - this.roomOptions = items + this.roomOptions = rooms.sort(propertySort(['-lastActivity'])).slice(0, 5) this.hasImportantConversations = false } this.loading = false }) }, + clickStartNew() { window.location = generateUrl('/apps/spreed') }, |