2020 -->
2121
2222<template >
23- <header class =" header" >
24- <!-- Nextcloud Apps use #header selector to get its height -->
25- <!-- This is invisible stub with the same height -->
26- <div id =" header" class =" header-stub" />
27-
28- <a class =" header__root-link" @click.prevent =" pushToRoot" >
29- <img class =" header__logo" src =" ~@talk/img/app.svg" alt =" Talk Logo" >
30- </a >
31-
32- <div >
33- <span class =" header__title" >Nextcloud Talk</span >
34- <span class =" header__preview-badge" >Preview</span >
35- </div >
36-
37- <div class =" spacer" />
38-
39- <div class =" header__item" >
40- <NcButton :aria-label =" t('talk_desktop', 'Search')"
41- type =" tertiary-no-background"
42- class =" header__button"
43- @click =" showNotSupportedAlert('Search')" >
44- <template #icon >
45- <MdiMagnify />
46- </template >
47- </NcButton >
48- </div >
49-
50- <div class =" header__item" >
51- <NcButton :aria-label =" t('talk_desktop', 'Notifications')"
52- type =" tertiary-no-background"
53- class =" header__button"
54- @click =" showNotSupportedAlert('Notifications')" >
55- <template #icon >
56- <MdiBell />
57- </template >
58- </NcButton >
59- </div >
60-
61- <div class =" header__item" >
62- <UserMenu :user =" $options.userMetadata" @logout =" logout" />
23+ <header id =" header" class =" header" >
24+ <div class =" header__inner" >
25+ <div v-if =" !OS.isMac"
26+ class =" header__title-wrapper"
27+ role =" button"
28+ tabindex =" 0"
29+ @click =" pushToRoot" >
30+ <span class =" header__title" >Nextcloud Talk</span >
31+ <span class =" header__preview-badge" >Preview</span >
32+ </div >
33+
34+ <div class =" spacer" />
35+
36+ <div class =" header__item" >
37+ <UserMenu :user =" user" @logout =" logout" />
38+ </div >
6339 </div >
6440 </header >
6541</template >
6642
6743<script >
68- import MdiBell from ' vue-material-design-icons/Bell.vue'
69- import MdiMagnify from ' vue-material-design-icons/Magnify.vue'
70- import NcButton from ' @nextcloud/vue/dist/Components/NcButton.js'
7144import UserMenu from ' ./components/UserMenu.vue'
7245import { appData } from ' ../../app/AppData.js'
7346
7447export default {
7548 name: ' DesktopHeader' ,
7649
77- userMetadata: appData .userMetadata ,
78-
7950 components: {
80- MdiBell,
81- MdiMagnify,
82- NcButton,
8351 UserMenu,
8452 },
8553
86- inject: [' router' ],
54+ setup () {
55+ return {
56+ user: appData .userMetadata ,
57+ OS : window .OS ,
58+ }
59+ },
60+
61+ mounted () {
62+ window .addEventListener (' keydown' , (event ) => {
63+ if (event .key === ' Escape' && document .activeElement === document .body ) {
64+ this .pushToRoot ()
65+ }
66+ }, { capture: true })
67+ },
8768
8869 methods: {
70+ getTalkRouter () {
71+ return window .OCA .Talk .instance .$router
72+ },
73+
8974 pushToRoot () {
90- this .router .push ({ name: ' root' }).catch (() => {})
75+ this .getTalkRouter () .push ({ name: ' root' }).catch (() => {})
9176 },
9277
9378 logout () {
@@ -102,25 +87,22 @@ export default {
10287 </script >
10388
10489<style scoped>
105- .header__root-link {
106- cursor : pointer ;
107- }
108-
109- .header-stub {
110- height : 100% ;
111- position : absolute ;
112- z-index : -1 ;
113- }
114-
11590.header {
11691 height : 50px ;
11792 box-sizing : border-box ;
11893 margin-bottom : -50px ;
11994 color : #FFF ;
95+ user-select : none ;
96+ }
97+
98+ .header__inner {
12099 padding : 0 calc (var (--body-container-margin ) + 4px ) 0 var (--body-container-margin );
121100 display : flex ;
122101 align-items : center ;
123- user-select : none ;
102+ height : 100% ;
103+ /* Save space for native title bar buttons */
104+ margin-inline-start : env(titlebar-area-x, 0 );
105+ width : env(titlebar-area-width, 100% );
124106}
125107
126108.header__item {
@@ -129,35 +111,31 @@ export default {
129111 justify-content : center ;
130112}
131113
132- .header__logo {
133- height : 32px ;
134- margin : 0 14px 0 20px ;
114+ .header__title-wrapper {
115+ display : flex ;
116+ align-items : center ;
117+ height : 100% ;
118+ margin-inline-start : calc (var (--default-grid-baseline ) * 3 );
119+ position : relative ;
120+
121+ &:focus-visible::after {
122+ bottom : 0 ;
123+ }
135124}
136125
137126.header__title {
138- font-size : 20 px ;
127+ font-size : 18 px ;
139128 font-weight : bold ;
140129}
141130
142131.header__preview-badge {
143- margin-left : var (--default-grid-baseline );
144- }
145-
146- .header__button {
147- opacity : .85 ;
148- /* We have to use !important here because NcButton already has !important */
149- color : inherit !important ;
150- transition : opacity ease var (--animation-quick ) !important ;
151- }
152-
153- .header__button :hover ,
154- .header__button :active ,
155- .header__button :focus-visible {
156- color : inherit !important ;
157- opacity : 1 ;
132+ margin-inline-start : var (--default-grid-baseline );
158133}
159134
160135.spacer {
161136 flex : 1 0 auto ;
137+ height : 100% ;
138+ /* Allow to drag the window using header */
139+ app-region : drag;
162140}
163141 </style >
0 commit comments