@ -20,11 +20,11 @@
-- >
< template >
< component :is ="elementTag" >
< div class = "user-status-menu-item" >
< component : is = "inline ? 'div' : 'li'" >
<!-- User Menu Entries -- >
< div v-if ="!inline" class="user-status-menu-item" >
<!-- Username display -- >
< a v -if = " ! inline "
class = "user-status-menu-item__header"
< a class = "user-status-menu-item__header"
: href = "profilePageLink"
@ click . exact = "loadProfilePage" >
< div class = "user-status-menu-item__header-content" >
@ -37,20 +37,25 @@
< / div >
< / a >
<!-- Status modal toggle -- >
< toggle : is = "inline ? 'button' : 'a'"
: class = "{'user-status-menu-item__toggle--inline': inline}"
class = "user-status-menu-item__toggle"
href = "#"
@ click . prevent . stop = "openModal" >
< span aria -hidden = " true " :class ="statusIcon" class = "user-status-menu-item__toggle-icon" / >
<!-- User Status = Status modal toggle -- >
< button class = "user-status-menu-item__toggle" @click.stop ="openModal" >
< span aria -hidden = " true " :class ="statusIcon" class = "user-status-icon" / >
{ { visibleMessage } }
< / toggle >
< / button >
< / div >
<!-- Dashboard Status -- >
< NcButton v -else
: icon = "statusIcon"
@ click . stop = "openModal" >
< template # icon >
< span aria -hidden = " true " :class ="statusIcon" class = "user-status-icon" / >
< / template >
{ { visibleMessage } }
< / NcButton >
<!-- Status management modal -- >
< SetStatusModal v -if = " isModalOpen "
@ close = "closeModal" / >
< SetStatusModal v -if = " isModalOpen " @close ="closeModal" / >
< / component >
< / template >
@ -59,6 +64,7 @@ import { generateUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth'
import { loadState } from '@nextcloud/initial-state'
import { subscribe , unsubscribe } from '@nextcloud/event-bus'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import debounce from 'debounce'
import { sendHeartbeat } from './services/heartbeatService.js'
@ -70,11 +76,17 @@ export default {
name : 'UserStatus' ,
components : {
NcButton ,
SetStatusModal : ( ) => import ( /* webpackChunkName: 'user-status-modal' */ './components/SetStatusModal.vue' ) ,
} ,
mixins : [ OnlineStatusMixin ] ,
props : {
/ * *
* Whether the component should be rendered as a Dashboard Status or a User Menu Entries
* true = Dashboard Status
* false = User Menu Entries
* /
inline : {
type : Boolean ,
default : false ,
@ -94,13 +106,10 @@ export default {
}
} ,
computed : {
elementTag ( ) {
return this . inline ? 'div' : 'li'
} ,
/ * *
* The profile page link
*
* @ return { string | null }
* @ return { string | undefined }
* /
profilePageLink ( ) {
if ( this . profileEnabled ) {
@ -109,7 +118,7 @@ export default {
/ / S i n c e a n a n c h o r e l e m e n t i s u s e d r a t h e r t h a n a b u t t o n ,
/ / t h i s h a c k r e m o v e s h r e f i f t h e p r o f i l e i s d i s a b l e d s o t h a t d i s a b l i n g p o i n t e r - e v e n t s i s n o t n e e d e d t o p r e v e n t a c l i c k f r o m o p e n i n g a p a g e
/ / a n d t o a l l o w t h e h o v e r e v e n t f o r s t y l i n g
return null
return undefined
} ,
} ,
@ -272,45 +281,37 @@ export default {
}
& __toggle {
& - icon {
width : 16 px ;
height : 16 px ;
margin - right : 10 px ;
opacity : 1 ! important ;
background - size : 16 px ;
vertical - align : middle ! important ;
width : auto ;
min - width : 44 px ;
height : 44 px ;
margin : 0 ;
border : 0 ;
border - radius : var ( -- border - radius - pill ) ;
background - color : var ( -- color - main - background - blur ) ;
font - size : inherit ;
font - weight : normal ;
- webkit - backdrop - filter : var ( -- background - blur ) ;
backdrop - filter : var ( -- background - blur ) ;
& : active ,
& : hover ,
& : focus {
background - color : var ( -- color - background - hover ) ;
}
/ / I n d a s h b o a r d
& -- inline {
width : auto ;
min - width : 44 px ;
height : 44 px ;
margin : 0 ;
border : 0 ;
border - radius : var ( -- border - radius - pill ) ;
background - color : var ( -- color - main - background - blur ) ;
font - size : inherit ;
font - weight : normal ;
- webkit - backdrop - filter : var ( -- background - blur ) ;
backdrop - filter : var ( -- background - blur ) ;
& : active ,
& : hover ,
& : focus {
background - color : var ( -- color - background - hover ) ;
}
& : focus - visible {
box - shadow : 0 0 0 4 px var ( -- color - main - background ) ! important ;
outline : 2 px solid var ( -- color - main - text ) ! important ;
}
& : focus - visible {
box - shadow : 0 0 0 4 px var ( -- color - main - background ) ! important ;
outline : 2 px solid var ( -- color - main - text ) ! important ;
}
}
}
li {
list - style - type : none ;
. user - status - icon {
width : 16 px ;
height : 16 px ;
margin - right : 10 px ;
opacity : 1 ! important ;
background - size : 16 px ;
vertical - align : middle ! important ;
}
< / style >