|
12 | 12 | :class=" |
13 | 13 | cn( |
14 | 14 | 'flex items-center gap-1 rounded-full hover:bg-interface-button-hover-surface justify-center', |
15 | | - compact && 'size-full aspect-square' |
| 15 | + compact && 'size-full ' |
16 | 16 | ) |
17 | 17 | " |
18 | 18 | > |
| 19 | + <Skeleton |
| 20 | + v-if="showWorkspaceSkeleton" |
| 21 | + shape="circle" |
| 22 | + width="32px" |
| 23 | + height="32px" |
| 24 | + /> |
19 | 25 | <WorkspaceProfilePic |
20 | | - v-if="showWorkspaceIcon" |
| 26 | + v-else-if="showWorkspaceIcon" |
21 | 27 | :workspace-name="workspaceName" |
22 | 28 | :class="compact && 'size-full'" |
23 | 29 | /> |
|
40 | 46 | } |
41 | 47 | }" |
42 | 48 | > |
43 | | - <!-- Workspace mode: workspace-aware popover --> |
| 49 | + <!-- Workspace mode: workspace-aware popover (only when ready) --> |
44 | 50 | <CurrentUserPopoverWorkspace |
45 | | - v-if="teamWorkspacesEnabled" |
| 51 | + v-if="teamWorkspacesEnabled && initState === 'ready'" |
46 | 52 | @close="closePopover" |
47 | 53 | /> |
48 | 54 | <!-- Legacy mode: original popover --> |
49 | | - <CurrentUserPopover v-else @close="closePopover" /> |
| 55 | + <CurrentUserPopover |
| 56 | + v-else-if="!teamWorkspacesEnabled" |
| 57 | + @close="closePopover" |
| 58 | + /> |
50 | 59 | </Popover> |
51 | 60 | </div> |
52 | 61 | </template> |
53 | 62 |
|
54 | 63 | <script setup lang="ts"> |
55 | 64 | import { storeToRefs } from 'pinia' |
56 | 65 | import Popover from 'primevue/popover' |
| 66 | +import Skeleton from 'primevue/skeleton' |
57 | 67 | import { computed, defineAsyncComponent, ref } from 'vue' |
58 | 68 |
|
59 | 69 | import UserAvatar from '@/components/common/UserAvatar.vue' |
@@ -85,12 +95,20 @@ const photoURL = computed<string | undefined>( |
85 | 95 | () => userPhotoUrl.value ?? undefined |
86 | 96 | ) |
87 | 97 |
|
88 | | -const showWorkspaceIcon = computed(() => isCloud && teamWorkspacesEnabled.value) |
| 98 | +const { workspaceName: teamWorkspaceName, initState } = storeToRefs( |
| 99 | + useTeamWorkspaceStore() |
| 100 | +) |
| 101 | +
|
| 102 | +const showWorkspaceSkeleton = computed( |
| 103 | + () => isCloud && teamWorkspacesEnabled.value && initState.value === 'loading' |
| 104 | +) |
| 105 | +const showWorkspaceIcon = computed( |
| 106 | + () => isCloud && teamWorkspacesEnabled.value && initState.value === 'ready' |
| 107 | +) |
89 | 108 |
|
90 | 109 | const workspaceName = computed(() => { |
91 | 110 | if (!showWorkspaceIcon.value) return '' |
92 | | - const { workspaceName } = storeToRefs(useTeamWorkspaceStore()) |
93 | | - return workspaceName.value |
| 111 | + return teamWorkspaceName.value |
94 | 112 | }) |
95 | 113 |
|
96 | 114 | const popover = ref<InstanceType<typeof Popover> | null>(null) |
|
0 commit comments