diff options
author | Christopher Ng <chrng8@gmail.com> | 2023-02-09 17:54:59 -0800 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2023-02-09 17:54:59 -0800 |
commit | c77998209f779dfccd86afeeafd43a7bbd886ff2 (patch) | |
tree | ff1b5fc33b1d5115f0f62eb4ea02848cdf468bc6 /apps/user_status | |
parent | e47d56ac36d0f1d3e47392a7d9688decf847e1bc (diff) | |
download | nextcloud-server-c77998209f779dfccd86afeeafd43a7bbd886ff2.tar.gz nextcloud-server-c77998209f779dfccd86afeeafd43a7bbd886ff2.zip |
Port user menu to Vue
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/user_status')
-rw-r--r-- | apps/user_status/appinfo/info.xml | 2 | ||||
-rw-r--r-- | apps/user_status/src/UserStatus.vue | 7 | ||||
-rw-r--r-- | apps/user_status/src/menu.js | 47 |
3 files changed, 22 insertions, 34 deletions
diff --git a/apps/user_status/appinfo/info.xml b/apps/user_status/appinfo/info.xml index 90744d40747..3c2486fde76 100644 --- a/apps/user_status/appinfo/info.xml +++ b/apps/user_status/appinfo/info.xml @@ -13,7 +13,7 @@ <bugs>https://github.com/nextcloud/server</bugs> <navigations> <navigation> - <id>user_status-menuitem</id> + <id>user_status-menu-entry</id> <name>User status</name> <order>1</order> <type>settings</type> diff --git a/apps/user_status/src/UserStatus.vue b/apps/user_status/src/UserStatus.vue index a4b7b9552f3..28c0896fee5 100644 --- a/apps/user_status/src/UserStatus.vue +++ b/apps/user_status/src/UserStatus.vue @@ -26,7 +26,7 @@ <a v-if="!inline" class="user-status-menu-item__header" :href="profilePageLink" - @click="loadProfilePage"> + @click.exact="loadProfilePage"> <div class="user-status-menu-item__header-content"> <div class="user-status-menu-item__header-content-displayname">{{ displayName }}</div> <div v-if="!loadingProfilePage" class="user-status-menu-item__header-content-placeholder" /> @@ -234,11 +234,6 @@ export default { align-items: flex-start !important; color: var(--color-main-text) !important; - &:focus-visible { - padding: 6px 8px 1px 8px !important; - margin: 2px !important; - } - &:not([href]) { height: var(--header-menu-item-height) !important; color: var(--color-text-maxcontrast) !important; diff --git a/apps/user_status/src/menu.js b/apps/user_status/src/menu.js index 66010102f10..abcfe7b7527 100644 --- a/apps/user_status/src/menu.js +++ b/apps/user_status/src/menu.js @@ -24,10 +24,11 @@ import Vue from 'vue' import { getRequestToken } from '@nextcloud/auth' -import UserStatus from './UserStatus' -import store from './store' -import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar' -import { loadState } from '@nextcloud/initial-state' +import { subscribe } from '@nextcloud/event-bus' + +import UserStatus from './UserStatus.vue' + +import store from './store/index.js' // eslint-disable-next-line camelcase __webpack_nonce__ = btoa(getRequestToken()) @@ -35,31 +36,23 @@ __webpack_nonce__ = btoa(getRequestToken()) Vue.prototype.t = t Vue.prototype.$t = t -const avatarDiv = document.getElementById('avatardiv-menu') -const userStatusData = loadState('user_status', 'status') -const propsData = { - preloadedUserStatus: { - message: userStatusData.message, - icon: userStatusData.icon, - status: userStatusData.status, - }, - user: avatarDiv.dataset.user, - displayName: avatarDiv.dataset.displayname, - disableMenu: true, - disableTooltip: true, -} +const mountPoint = document.getElementById('user_status-menu-entry') -const NcAvatarInMenu = Vue.extend(NcAvatar) -new NcAvatarInMenu({ propsData }).$mount('#avatardiv-menu') +const mountMenuEntry = () => { + const mountPoint = document.getElementById('user_status-menu-entry') + // eslint-disable-next-line no-new + new Vue({ + el: mountPoint, + render: h => h(UserStatus), + store, + }) +} -// Register settings menu entry -export default new Vue({ - el: 'li[data-id="user_status-menuitem"]', - // eslint-disable-next-line vue/match-component-file-name - name: 'UserStatusRoot', - render: h => h(UserStatus), - store, -}) +if (mountPoint) { + mountMenuEntry() +} else { + subscribe('core:user-menu:mounted', mountMenuEntry) +} // Register dashboard status document.addEventListener('DOMContentLoaded', function() { |