Skip to content

Commit

Permalink
web/satellite: add project role for expired invitations
Browse files Browse the repository at this point in the history
Pending project members whose invitations have expired now appear with
the "Invite Expired" role in the Team page.

References #5752

Change-Id: Ic91289618ee02e65de29e986fa3205eccf39b267
  • Loading branch information
jewharton committed Jun 22, 2023
1 parent adbd4fb commit 25c21f0
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
6 changes: 5 additions & 1 deletion web/satellite/src/components/common/TableItem.vue
Expand Up @@ -27,7 +27,7 @@
</p>
<p v-else :class="{primary: index === 0}" :title="val" @click.stop="(e) => cellContentClicked(index, e)">
<middle-truncate v-if="keyVal === 'fileName'" :text="val" />
<project-ownership-tag v-else-if="keyVal === 'role'" :no-icon="itemType !== 'project' && val !== ProjectRole.Invited" :role="val" />
<project-ownership-tag v-else-if="keyVal === 'role'" :no-icon="!isProjectRoleIconShown(val)" :role="val" />
<span v-else>{{ val }}</span>
</p>
<div v-if="showBucketGuide(index)" class="animation">
Expand Down Expand Up @@ -92,6 +92,10 @@ const customIconClasses = computed(() => {
return classes;
});
function isProjectRoleIconShown(role: ProjectRole) {
return props.itemType === 'project' || role === ProjectRole.Invited || role === ProjectRole.InviteExpired;
}
function selectClicked(event: Event): void {
emit('selectClicked', event);
}
Expand Down
26 changes: 19 additions & 7 deletions web/satellite/src/components/project/ProjectOwnershipTag.vue
Expand Up @@ -2,9 +2,8 @@
// See LICENSE for copying information.

<template>
<div class="tag" :class="{[role.toLowerCase()]: true}">
<div class="tag" :class="{[role.toLowerCase().replaceAll(' ', '-')]: true}">
<component :is="icon" v-if="!noIcon" class="tag__icon" />

<span class="tag__text">{{ role }}</span>
</div>
</template>
Expand All @@ -16,6 +15,7 @@ import { ProjectRole } from '@/types/projectMembers';
import BoxIcon from '@/../static/images/navigation/project.svg';
import InviteIcon from '@/../static/images/navigation/quickStart.svg';
import ClockIcon from '@/../static/images/team/clock.svg';
const props = withDefaults(defineProps<{
role: ProjectRole,
Expand All @@ -26,7 +26,14 @@ const props = withDefaults(defineProps<{
});
const icon = computed((): string => {
return props.role === ProjectRole.Invited ? InviteIcon : BoxIcon;
switch (props.role) {
case ProjectRole.Invited:
return InviteIcon;
case ProjectRole.InviteExpired:
return ClockIcon;
default:
return BoxIcon;
}
});
</script>
Expand Down Expand Up @@ -65,13 +72,18 @@ const icon = computed((): string => {
}
}
&.invited {
&.invited,
&.invite-expired {
color: var(--c-grey-6);
border-color: var(--c-grey-4);
}
:deep(path) {
fill: var(--c-yellow-3);
}
&.invited :deep(path) {
fill: var(--c-yellow-3);
}
&.invite-expired :deep(path) {
fill: var(--c-grey-4);
}
}
</style>
8 changes: 6 additions & 2 deletions web/satellite/src/components/team/ProjectMemberListItem.vue
Expand Up @@ -16,7 +16,7 @@
<script setup lang="ts">
import { computed } from 'vue';
import { ProjectMember, ProjectMemberItemModel, ProjectRole } from '@/types/projectMembers';
import { ProjectInvitationItemModel, ProjectMember, ProjectMemberItemModel, ProjectRole } from '@/types/projectMembers';
import { useResize } from '@/composables/resize';
import { useProjectsStore } from '@/store/modules/projectsStore';
Expand All @@ -38,7 +38,11 @@ const isProjectOwner = computed((): boolean => {
const itemToRender = computed((): { [key: string]: unknown } => {
let role: ProjectRole = ProjectRole.Member;
if (props.model.isPending()) {
role = ProjectRole.Invited;
if ((props.model as ProjectInvitationItemModel).expired) {
role = ProjectRole.InviteExpired;
} else {
role = ProjectRole.Invited;
}
} else if (isProjectOwner.value) {
role = ProjectRole.Owner;
}
Expand Down
1 change: 1 addition & 0 deletions web/satellite/src/types/projectMembers.ts
Expand Up @@ -292,4 +292,5 @@ export enum ProjectRole {
Member = 'Member',
Owner = 'Owner',
Invited = 'Invited',
InviteExpired = 'Invite Expired',
}
3 changes: 3 additions & 0 deletions web/satellite/static/images/team/clock.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 25c21f0

Please sign in to comment.