44-->
55
66<template >
7- <li :id =" id"
8- class =" menu-entry" >
9- <component :is =" profileEnabled ? 'a' : 'span'"
10- class =" menu-entry__wrapper"
11- :class =" {
12- active,
13- 'menu-entry__wrapper--link': profileEnabled,
14- }"
15- :href =" profileEnabled ? href : undefined"
16- @click.exact =" handleClick" >
17- <span class =" menu-entry__content" >
18- <span class =" menu-entry__displayname" >{{ displayName }}</span >
19- <NcLoadingIcon v-if =" loading" :size =" 18" />
20- </span >
21- <span v-if =" profileEnabled" >{{ name }}</span >
22- </component >
23- </li >
7+ <NcListItem :id =" profileEnabled ? undefined : id"
8+ :anchor-id =" id"
9+ :active =" active"
10+ compact
11+ :href =" profileEnabled ? href : undefined"
12+ :name =" displayName"
13+ target =" _self" >
14+ <template v-if =" profileEnabled " #subname >
15+ {{ name }}
16+ </template >
17+ <template v-if =" loading " #indicator >
18+ <NcLoadingIcon />
19+ </template >
20+ </NcListItem >
2421</template >
2522
26- <script >
23+ <script lang="ts" >
2724import { loadState } from ' @nextcloud/initial-state'
2825import { getCurrentUser } from ' @nextcloud/auth'
2926import { subscribe , unsubscribe } from ' @nextcloud/event-bus'
27+ import { defineComponent } from ' vue'
3028
29+ import NcListItem from ' @nextcloud/vue/dist/Components/NcListItem.js'
3130import NcLoadingIcon from ' @nextcloud/vue/dist/Components/NcLoadingIcon.js'
3231
33- const { profileEnabled } = loadState (' user_status' , ' profileEnabled' , false )
32+ const { profileEnabled } = loadState (' user_status' , ' profileEnabled' , { profileEnabled: false } )
3433
35- export default {
36- name: ' ProfileUserMenuEntry ' ,
34+ export default defineComponent ( {
35+ name: ' AccountMenuProfileEntry ' ,
3736
3837 components: {
38+ NcListItem ,
3939 NcLoadingIcon ,
4040 },
4141
@@ -58,10 +58,15 @@ export default {
5858 },
5959 },
6060
61- data () {
61+ setup () {
6262 return {
6363 profileEnabled ,
64- displayName: getCurrentUser ().displayName ,
64+ displayName: getCurrentUser ()! .displayName ,
65+ }
66+ },
67+
68+ data() {
69+ return {
6570 loading: false ,
6671 }
6772 },
@@ -83,41 +88,13 @@ export default {
8388 }
8489 },
8590
86- handleProfileEnabledUpdate (profileEnabled ) {
91+ handleProfileEnabledUpdate(profileEnabled : boolean ) {
8792 this .profileEnabled = profileEnabled
8893 },
8994
90- handleDisplayNameUpdate (displayName ) {
95+ handleDisplayNameUpdate(displayName : string ) {
9196 this .displayName = displayName
9297 },
9398 },
94- }
99+ })
95100 </script >
96-
97- <style lang="scss" scoped>
98- .menu-entry {
99- & __wrapper {
100- box-sizing : border-box ;
101- display : inline-flex ;
102- flex-direction : column ;
103- align-items : flex-start !important ;
104- padding : 10px 12px 5px 12px !important ;
105- height : var (--header-menu-item-height );
106- color : var (--color-text-maxcontrast );
107-
108- & --link {
109- height : calc (var (--header-menu-item-height ) * 1.5 ) !important ;
110- color : var (--color-main-text );
111- }
112- }
113-
114- & __content {
115- display : inline-flex ;
116- gap : 0 10px ;
117- }
118-
119- & __displayname {
120- font-weight : bold ;
121- }
122- }
123- </style >
0 commit comments