Skip to content

Commit

Permalink
fix: members align and missing assign button
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoRCD committed Mar 29, 2024
1 parent 9f77fbb commit 1697e83
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
48 changes: 23 additions & 25 deletions apps/app/components/team/Members.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,32 +91,30 @@ async function remove_member(teamId: number, memberId: number) {
</UCard>
</template>
</UPopover>
<div v-if="user?.role === Role.ADMIN || user?.role === Role.OWNER" class="flex items-center justify-center">
<UPopover :popper="{ arrow: true }">
<UTooltip text="Add member" :ui="{ popper: { placement: 'top' } }">
<span class="flex size-8 cursor-pointer items-center justify-center rounded-full border border-dashed border-gray-400">+</span>
</UTooltip>
<template #panel>
<UCard>
<form @submit.prevent="upsert_member(teamId, newMember.email, newMember.role)">
<div class="flex flex-col gap-2">
<UInput v-model="newMember.email" label="Email" placeholder="Email" />
<div class="flex gap-2">
<USelect
v-model="newMember.role"
label="Role"
:options="roles"
value-attribute="value"
option-attribute="label"
/>
<UButton label="Add member" :loading="loadingMembers" type="submit" />
</div>
<UPopover v-if="members.find(member => member.user.id === user?.id)?.role === TeamRole.OWNER" :popper="{ arrow: true }">
<UTooltip text="Add member" :ui="{ popper: { placement: 'top' } }">
<span class="flex size-8 cursor-pointer items-center justify-center rounded-full border border-dashed border-gray-400">+</span>
</UTooltip>
<template #panel>
<UCard>
<form @submit.prevent="upsert_member(teamId, newMember.email, newMember.role)">
<div class="flex flex-col gap-2">
<UInput v-model="newMember.email" label="Email" placeholder="Email" />
<div class="flex gap-2">
<USelect
v-model="newMember.role"
label="Role"
:options="roles"
value-attribute="value"
option-attribute="label"
/>
<UButton label="Add member" :loading="loadingMembers" type="submit" />
</div>
</form>
</UCard>
</template>
</UPopover>
</div>
</div>
</form>
</UCard>
</template>
</UPopover>
</UAvatarGroup>
<UAvatarGroup v-else :ui="{ ring: 'ring-0' }">
<TeamMember v-for="member in members" :key="member.id" :member="member" />
Expand Down
4 changes: 2 additions & 2 deletions apps/app/pages/app/project/[projectId]/index/settings.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { Project } from "@shelve/types";
import { type Project, TeamRole } from "@shelve/types";
import type { Ref } from "vue";
const { projectId } = useRoute().params;
Expand Down Expand Up @@ -81,7 +81,7 @@ async function removeTeamFromProject(teamId: number) {
<div v-if="project && projectTeam" class="flex items-center justify-between">
<TeamMembers :team-id="project.teamId" :members="projectTeam.members" />
<UButton
v-if="projectTeam.members.find(member => member.userId === user.value?.id)?.role === 'OWNER'"
v-if="projectTeam.members.find(member => member.userId === user?.id)?.role === TeamRole.OWNER"
variant="soft"
color="red"
class="text-xs"
Expand Down
4 changes: 3 additions & 1 deletion packages/shelve-types/src/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export type CreateProjectInput = {
name: string;
description: string;
avatar: string;
ownerId: number;
repository: string;
projectManager: string;
homepage: string;
team?: Team;
};

Expand Down

0 comments on commit 1697e83

Please sign in to comment.