Skip to content

Commit ea7ef61

Browse files
Merge pull request #1984 from solliancenet/jdh-tooltips-0.8.4
(0.8.4) Add username tooltip and add tooltip component to Management Portal
2 parents ecfcbe3 + 3f31443 commit ea7ef61

File tree

6 files changed

+77
-5
lines changed

6 files changed

+77
-5
lines changed

src/ui/ManagementPortal/components/Sidebar.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,16 @@
7676
<UserAvatar class="sidebar__avatar" size="large" />
7777

7878
<div>
79-
<span class="sidebar__username">{{ $authStore.currentAccount?.name }}</span>
79+
<VTooltip :auto-hide="isMobile" :popper-triggers="isMobile ? [] : ['hover']">
80+
<span
81+
class="sidebar__username"
82+
aria-label="Logged in as {{ $authStore.currentAccount?.username }}">
83+
{{ $authStore.currentAccount?.name }}
84+
</span>
85+
<template #popper>
86+
<div role="tooltip">Logged in as {{ $authStore.currentAccount?.username }}</div>
87+
</template>
88+
</VTooltip>
8089
<Button
8190
class="sidebar__sign-out-button"
8291
icon="pi pi-sign-out"
@@ -93,6 +102,12 @@
93102
<script lang="ts">
94103
export default {
95104
name: 'Sidebar',
105+
106+
data() {
107+
return {
108+
isMobile: window.screen.width < 950,
109+
};
110+
},
96111
};
97112
</script>
98113

src/ui/ManagementPortal/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default defineNuxtConfig({
1717
compatibilityDate: '2024-08-27',
1818
ssr: false,
1919
devtools: { enabled: true },
20-
modules: ['@pinia/nuxt', '@nuxtjs/eslint-module'],
20+
modules: ['@pinia/nuxt', '@nuxtjs/eslint-module', 'floating-vue/nuxt'],
2121
components: true,
2222
app: {
2323
head: {

src/ui/ManagementPortal/package-lock.json

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ui/ManagementPortal/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@pinia/nuxt": "^0.5.4",
4040
"@vue-js-cron/light": "^4.0.5",
4141
"@vueup/vue-quill": "^1.2.0",
42+
"floating-vue": "^2.0.0",
4243
"lodash": "^4.17.21",
4344
"md5": "^2.3.0",
4445
"pinia": "^2.2.2",

src/ui/ManagementPortal/plugins/primevue.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,4 @@ export default defineNuxtPlugin((nuxtApp) => {
5656
nuxtApp.vueApp.component('InputSwitch', InputSwitch);
5757

5858
nuxtApp.vueApp.use(ToastService);
59-
nuxtApp.vueApp.directive('tooltip', Tooltip);
6059
});

src/ui/UserPortal/components/ChatSidebar.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,16 @@
109109
<UserAvatar size="large" class="chat-sidebar__avatar" />
110110

111111
<div>
112-
<span class="chat-sidebar__username">{{ $authStore.currentAccount?.name }}</span>
112+
<VTooltip :auto-hide="isMobile" :popper-triggers="isMobile ? [] : ['hover']">
113+
<span
114+
class="chat-sidebar__username"
115+
aria-label="Logged in as {{ $authStore.currentAccount?.username }}">
116+
{{ $authStore.currentAccount?.name }}
117+
</span>
118+
<template #popper>
119+
<div role="tooltip">Logged in as {{ $authStore.currentAccount?.username }}</div>
120+
</template>
121+
</VTooltip>
113122
<div class="chat-sidebar__options">
114123
<Button
115124
class="chat-sidebar__sign-out chat-sidebar__button"
@@ -257,7 +266,7 @@
257266
</template>
258267

259268
<script lang="ts">
260-
import { hideAllPoppers } from 'floating-vue';
269+
import { hideAllPoppers, VTooltip } from 'floating-vue';
261270
import type { Session } from '@/js/types';
262271
declare const process: any;
263272

0 commit comments

Comments
 (0)