-
Notifications
You must be signed in to change notification settings - Fork 157
/
TopBar.vue
114 lines (105 loc) · 2.55 KB
/
TopBar.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<template>
<header
id="oc-topbar"
class="oc-flex oc-flex-middle oc-flex-between oc-px-m"
:aria-label="$gettext('Top bar')"
>
<div class="topbar-gap oc-flex oc-flex-middle oc-flex-between">
<applications-menu v-if="applicationsList.length" :applications-list="applicationsList" />
<router-link ref="navigationSidebarLogo" to="/">
<oc-img :src="logoImage" :alt="sidebarLogoAlt" />
</router-link>
</div>
<div class="portal-wrapper">
<portal-target name="app.runtime.header" multiple></portal-target>
</div>
<div class="topbar-gap oc-flex oc-flex-middle oc-flex-between">
<feedback-link v-if="isFeedbackLinkEnabled" />
<notifications v-if="isNotificationBellEnabled" />
<user-menu
v-if="isUserMenuEnabled"
:user-id="userId"
:user-display-name="userDisplayName"
:applications-list="applicationsList"
/>
</div>
</header>
</template>
<script>
import { mapGetters } from 'vuex'
import ApplicationsMenu from './ApplicationsMenu.vue'
import UserMenu from './UserMenu.vue'
import Notifications from './Notifications.vue'
import FeedbackLink from './FeedbackLink.vue'
export default {
components: {
FeedbackLink,
Notifications,
ApplicationsMenu,
UserMenu
},
props: {
userId: {
type: String,
required: false,
default: ''
},
userDisplayName: {
type: String,
required: false,
default: ''
},
applicationsList: {
type: Array,
required: false,
default: () => []
},
activeNotifications: {
type: [Array, Boolean],
required: false,
default: () => []
}
},
computed: {
...mapGetters(['configuration', 'user']),
sidebarLogoAlt() {
return this.$gettext('Navigate to all files page')
},
logoImage() {
return this.configuration.theme.logo.sidebar
},
isFeedbackLinkEnabled() {
return !this.configuration.options.disableFeedbackLink
},
isNotificationBellEnabled() {
return this.user?.id && this.activeNotifications.length
},
isUserMenuEnabled() {
return this.user?.id
}
}
}
</script>
<style lang="scss">
#oc-topbar {
height: 60px;
position: sticky;
z-index: 5;
img {
height: 42px;
image-rendering: auto;
image-rendering: crisp-edges;
image-rendering: pixelated;
image-rendering: -webkit-optimize-contrast;
user-select: none;
}
.topbar-gap {
gap: 30px;
}
@media only screen and (max-width: 960px) {
.topbar-gap {
gap: 0.5rem;
}
}
}
</style>