This commit is contained in:
j3d1 2023-05-31 22:44:22 +02:00
parent cecc03a820
commit 509dfb24ec
4 changed files with 30 additions and 11 deletions

View file

@ -1,12 +1,11 @@
<template>
<li class="nav-item dropdown">
<a class="nav-icon dropdown-toggle" href="#" id="messagesDropdown" data-toggle="dropdown">
<a class="nav-icon dropdown-toggle" href="#" id="messagesDropdown" @click.prevent="toggleDropdown">
<div class="position-relative">
<b-icon-chat-left class="bi-valign-middle"></b-icon-chat-left>
</div>
</a>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right py-0"
aria-labelledby="messagesDropdown">
<div :class="['dropdown-menu','dropdown-menu-right', 'dropdown-menu-lg','py-0', {'show': show_dropdown}]">
<div class="dropdown-menu-header">
<div class="position-relative">
4 New Messages
@ -95,10 +94,20 @@ export default {
default: () => []
}
},
data() {
return {
show_dropdown: false
}
},
computed: {
top_messages() {
return this.messages.slice(0, 4);
}
},
methods: {
toggleDropdown() {
this.show_dropdown = !this.show_dropdown;
}
}
}
</script>

View file

@ -1,15 +1,14 @@
<template>
<li class="nav-item dropdown">
<a class="nav-icon dropdown-toggle" href="#" id="alertsDropdown" data-toggle="dropdown">
<a class="nav-icon dropdown-toggle" href="#" id="alertsDropdown" @click.prevent="toggleDropdown">
<div class="position-relative">
<b-icon-bell class="bi-valign-middle"></b-icon-bell>
<span :class="['indicator', notificationsColor(top_notifications)]">{{
top_notifications.length
top_notifications.length
}}</span>
</div>
</a>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right py-0"
aria-labelledby="alertsDropdown">
<div :class="['dropdown-menu','dropdown-menu-right', 'dropdown-menu-lg','py-0', {'show': show_dropdown}]">
<div class="dropdown-menu-header">
{{ top_notifications.length }} New Notifications
</div>
@ -61,6 +60,11 @@ export default {
default: () => []
}
},
data() {
return {
show_dropdown: false
}
},
computed: {
top_notifications() {
return this.notifications.sort((a, b) => {
@ -84,6 +88,9 @@ export default {
return 'bg-warning';
}
return 'bg-primary';
},
toggleDropdown() {
this.show_dropdown = !this.show_dropdown
}
},
async mounted() {

View file

@ -38,6 +38,11 @@ export default {
components: {
...BIcons
},
data() {
return {
show_dropdown: false
}
},
methods: {
...mapMutations(['logout']),
toggleDropdown() {

View file

@ -156,8 +156,6 @@ export default createStore({
const s = await dispatch('lookupServer', {username: friend.username})
servers.add(new ServerSet(s, state.unreachable_neighbors))
}
const home = await dispatch('getHomeServers')
servers.add(home)
return servers
})()
commit('setAllFriendsServers', promise)
@ -174,7 +172,7 @@ export default createStore({
return items
},
async searchInventories({state, dispatch, getters}, {query}) {
const servers = await dispatch('getAllFriendsServers')
const servers = await dispatch('getAllKnownServers')
return await servers.get(getters.signAuth, '/api/inventory/search/?q=' + query)
},
async createInventoryItem({state, dispatch, getters}, item) {
@ -197,7 +195,7 @@ export default createStore({
return ret
},
async fetchSearchResults({state, dispatch, getters}, {query}) {
const servers = await dispatch('getAllFriendsServers')
const servers = await dispatch('getAllKnownServers')
return await servers.get(getters.signAuth, '/api/search/?query=' + query)
},
async fetchFriends({commit, dispatch, getters, state}) {