876a0ee217
* New middleware. New page structure * Changes from designs * New workspace creation flow * FF Hide SSO * No middleware with no FF * When to show join * Update Join description text based on count * Use new FF * Major changes * Update join text * New FF in middleware * Discoverable Banners * Fix cache warning * Undo merge conflict * Revert merge conflicts * Remove unneeded change * Rename * Revert merge issues * Fix error * Remove FF * Check workspaces is enabled * Use FF to show old onboarding flow * Remove unused FF * Fixes from PR * Remove Region & SSO * Revert workspace wizard changes * WorkspaceDiscoverableWorkspacesCard * Remove old code that was hidden with FF * Fix * Changes from call with Mike * Fix typo * Fix typo * Update JoinPage.vue --------- Co-authored-by: Mike Tasset <mike.tasset@gmail.com>
88 lines
2.5 KiB
Vue
88 lines
2.5 KiB
Vue
<template>
|
|
<div>
|
|
<div v-if="hasBanners" class="mb-8 empty:mb-0">
|
|
<ProjectsInviteBanner
|
|
v-for="item in projectsInvites?.projectInvites"
|
|
:key="item?.id"
|
|
:invite="item"
|
|
:invites="projectsInvites"
|
|
/>
|
|
<WorkspaceInviteBanner
|
|
v-for="invite in workspaceInvites"
|
|
:key="invite.id"
|
|
:invite="invite"
|
|
/>
|
|
<WorkspaceInviteDiscoverableWorkspaceBanner
|
|
v-for="workspace in filteredDiscoverableWorkspaces"
|
|
:key="workspace.id"
|
|
:workspace="workspace"
|
|
@dismiss="handleDismiss"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import type { MaybeNullOrUndefined } from '@speckle/shared'
|
|
import { useSynchronizedCookie } from '~/lib/common/composables/reactiveCookie'
|
|
import { graphql } from '~/lib/common/generated/gql'
|
|
import type {
|
|
ProjectsDashboardHeaderProjects_UserFragment,
|
|
ProjectsDashboardHeaderWorkspaces_UserFragment
|
|
} from '~/lib/common/generated/gql/graphql'
|
|
import { CookieKeys } from '~/lib/common/helpers/constants'
|
|
import { useDiscoverableWorkspaces } from '~/lib/workspaces/composables/discoverableWorkspaces'
|
|
|
|
graphql(`
|
|
fragment ProjectsDashboardHeaderProjects_User on User {
|
|
projectInvites {
|
|
...ProjectsInviteBanner
|
|
}
|
|
}
|
|
`)
|
|
|
|
graphql(`
|
|
fragment ProjectsDashboardHeaderWorkspaces_User on User {
|
|
workspaceInvites {
|
|
...WorkspaceInviteBanner_PendingWorkspaceCollaborator
|
|
}
|
|
}
|
|
`)
|
|
|
|
const props = defineProps<{
|
|
projectsInvites: MaybeNullOrUndefined<ProjectsDashboardHeaderProjects_UserFragment>
|
|
workspacesInvites: MaybeNullOrUndefined<ProjectsDashboardHeaderWorkspaces_UserFragment>
|
|
}>()
|
|
|
|
const dismissedDiscoverableWorkspaces = useSynchronizedCookie<string[]>(
|
|
CookieKeys.DismissedDiscoverableWorkspaces,
|
|
{
|
|
default: () => []
|
|
}
|
|
)
|
|
|
|
const { discoverableWorkspaces } = useDiscoverableWorkspaces()
|
|
|
|
const workspaceInvites = computed(() => props.workspacesInvites?.workspaceInvites || [])
|
|
const filteredDiscoverableWorkspaces = computed(
|
|
() =>
|
|
discoverableWorkspaces.value?.filter(
|
|
(workspace) => !dismissedDiscoverableWorkspaces.value.includes(workspace.id)
|
|
) || []
|
|
)
|
|
|
|
const hasBanners = computed(() => {
|
|
return (
|
|
props.projectsInvites?.projectInvites?.length ||
|
|
workspaceInvites.value.length ||
|
|
filteredDiscoverableWorkspaces.value.length
|
|
)
|
|
})
|
|
|
|
const handleDismiss = (workspaceId: string) => {
|
|
dismissedDiscoverableWorkspaces.value = [
|
|
...dismissedDiscoverableWorkspaces.value,
|
|
workspaceId
|
|
]
|
|
}
|
|
</script>
|