-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a component that displays information about a project member an offers actions to change their role or to remove them from the project
- Loading branch information
1 parent
61af41c
commit 744c92f
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/lib/components/composites/project-components/settings/ProjectMemberListEntry.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<script lang="ts"> | ||
import Button from "$lib/components/primitives/button/button.svelte"; | ||
import type { User } from "$lib/model/backend"; | ||
import { getNameAsString } from "$lib/utils/common-helper"; | ||
import { cn } from "$lib/utils/shadcn-helper"; | ||
import Trash from "lucide-svelte/icons/trash"; | ||
interface Props { | ||
member: User; | ||
isCurrentUser: boolean; | ||
isInvitationPending: boolean; | ||
isAdminView: boolean; | ||
} | ||
let { member, isCurrentUser, isInvitationPending, isAdminView }: Props = $props(); | ||
const role = member.isAdmin ? "Admin" : "Member"; | ||
const isRoleReadonly = isCurrentUser || !isAdminView; | ||
</script> | ||
|
||
<div class="flex flex-col md:flex-row items-center justify-between px-4 gap-4"> | ||
<div class="flex flex-col"> | ||
<h3> | ||
{getNameAsString(member)} | ||
{#if isCurrentUser} | ||
<span class="text-gray-400"> - You</span> | ||
{/if} | ||
</h3> | ||
<span class="text-hint text-primary">{member.email}</span> | ||
</div> | ||
<div class="flex flex-row gap-2.5 items-center"> | ||
{#if isInvitationPending} | ||
<span class="text-hint">Invitation Pending ...</span> | ||
{/if} | ||
<Button | ||
class={cn( | ||
"w-[7.7rem]", | ||
isRoleReadonly | ||
? "hover:bg-transparent hover:cursor-default" | ||
: "bg-gray-100 border border-gray-300 hover:bg-gray-200", | ||
)} | ||
variant={isRoleReadonly ? "ghost" : "secondary"} | ||
> | ||
<!-- Take maximum space so that text is left aligned --> | ||
<span class="flex w-full">Role: {role}</span> | ||
</Button> | ||
{#if isAdminView} | ||
<Button | ||
class="bg-gray-100 border border-gray-300 hover:bg-gray-200 size-10" | ||
disabled={isCurrentUser} | ||
> | ||
<Trash class=" text-red-500 !size-6" /> | ||
</Button> | ||
{/if} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters