mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-31 05:19:53 +00:00
## Summary Add team workspace member management and invite system. ## Changes - Add members panel with role management (owner/admin/member) and member removal - Add invite system with email invites, pending invite display, and revoke functionality - Add invite URL loading for accepting invites - Add subscription panel updates for member management - Add i18n translations for member and invite features ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8245-Workspaces-4-members-invites-2f06d73d36508176b2caf852a1505c4a) by [Unito](https://www.unito.io) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: GitHub Action <action@github.com>
102 lines
2.9 KiB
Vue
102 lines
2.9 KiB
Vue
<!-- A button that shows workspace icon (Cloud) or user avatar -->
|
|
<template>
|
|
<div>
|
|
<Button
|
|
v-if="isLoggedIn"
|
|
class="p-1 hover:bg-transparent"
|
|
variant="muted-textonly"
|
|
:aria-label="$t('g.currentUser')"
|
|
@click="popover?.toggle($event)"
|
|
>
|
|
<div
|
|
:class="
|
|
cn(
|
|
'flex items-center gap-1 rounded-full hover:bg-interface-button-hover-surface justify-center',
|
|
compact && 'size-full aspect-square'
|
|
)
|
|
"
|
|
>
|
|
<WorkspaceProfilePic
|
|
v-if="showWorkspaceIcon"
|
|
:workspace-name="workspaceName"
|
|
:class="compact && 'size-full'"
|
|
/>
|
|
<UserAvatar
|
|
v-else
|
|
:photo-url="photoURL"
|
|
:class="compact && 'size-full'"
|
|
/>
|
|
|
|
<i v-if="showArrow" class="icon-[lucide--chevron-down] size-4 px-1" />
|
|
</div>
|
|
</Button>
|
|
|
|
<Popover
|
|
ref="popover"
|
|
:show-arrow="false"
|
|
:pt="{
|
|
root: {
|
|
class: 'rounded-lg w-80'
|
|
}
|
|
}"
|
|
>
|
|
<!-- Workspace mode: workspace-aware popover -->
|
|
<CurrentUserPopoverWorkspace
|
|
v-if="teamWorkspacesEnabled"
|
|
@close="closePopover"
|
|
/>
|
|
<!-- Legacy mode: original popover -->
|
|
<CurrentUserPopover v-else @close="closePopover" />
|
|
</Popover>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { storeToRefs } from 'pinia'
|
|
import Popover from 'primevue/popover'
|
|
import { computed, defineAsyncComponent, ref } from 'vue'
|
|
|
|
import UserAvatar from '@/components/common/UserAvatar.vue'
|
|
import WorkspaceProfilePic from '@/components/common/WorkspaceProfilePic.vue'
|
|
import Button from '@/components/ui/button/Button.vue'
|
|
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
|
|
import { useFeatureFlags } from '@/composables/useFeatureFlags'
|
|
import { isCloud } from '@/platform/distribution/types'
|
|
import { useTeamWorkspaceStore } from '@/platform/workspace/stores/teamWorkspaceStore'
|
|
import { cn } from '@/utils/tailwindUtil'
|
|
|
|
import CurrentUserPopover from './CurrentUserPopover.vue'
|
|
|
|
const CurrentUserPopoverWorkspace = defineAsyncComponent(
|
|
() => import('./CurrentUserPopoverWorkspace.vue')
|
|
)
|
|
|
|
const { showArrow = true, compact = false } = defineProps<{
|
|
showArrow?: boolean
|
|
compact?: boolean
|
|
}>()
|
|
|
|
const { flags } = useFeatureFlags()
|
|
const teamWorkspacesEnabled = computed(() => flags.teamWorkspacesEnabled)
|
|
|
|
const { isLoggedIn, userPhotoUrl } = useCurrentUser()
|
|
|
|
const photoURL = computed<string | undefined>(
|
|
() => userPhotoUrl.value ?? undefined
|
|
)
|
|
|
|
const showWorkspaceIcon = computed(() => isCloud && teamWorkspacesEnabled.value)
|
|
|
|
const workspaceName = computed(() => {
|
|
if (!showWorkspaceIcon.value) return ''
|
|
const { workspaceName } = storeToRefs(useTeamWorkspaceStore())
|
|
return workspaceName.value
|
|
})
|
|
|
|
const popover = ref<InstanceType<typeof Popover> | null>(null)
|
|
|
|
const closePopover = () => {
|
|
popover.value?.hide()
|
|
}
|
|
</script>
|