-
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.
Merge pull request #99 from pvdthings/shifts-fixes
Shifts - Some fixes
- Loading branch information
Showing
4 changed files
with
67 additions
and
48 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,58 +1,81 @@ | ||
<script> | ||
import { getContext } from "svelte"; | ||
import { getContext } from 'svelte'; | ||
let { id, date, enrolled, removed, time, title, selected, volunteers, onAdd, onRemove } = $props(); | ||
let { | ||
id, | ||
date, | ||
description, | ||
enrolled, | ||
removed, | ||
time, | ||
title, | ||
selected, | ||
volunteers, | ||
onAdd, | ||
onRemove | ||
} = $props(); | ||
</script> | ||
|
||
<div class="card bg-white border border-base-300 p-4 lg:p-8 shadow-sm"> | ||
<div class="flex mb-4 lg:mb-6"> | ||
<div class="flex-grow"> | ||
<div class="font-display font-semibold lg:text-lg">{date}</div> | ||
<div class="mb-2 text-sm lg:text-base">{time}</div> | ||
<div class="mb-2 text-sm lg:text-base">{time}</div> | ||
<div class="font-display text-xl lg:text-2xl">{title}</div> | ||
{#if description?.length} | ||
<div class="mt-1 text-sm max-w-prose">{description}</div> | ||
{/if} | ||
</div> | ||
<div class="flex justify-end"> | ||
{#if (selected || enrolled) && !removed} | ||
<button onclick={() => onRemove(id)} class="font-display btn btn-sm lg:btn-md btn-success border border-success shadow-sm" class:btn-disabled={!onRemove}> | ||
<span class="ph-bold ph-check text-xl"></span> | ||
<span>Added</span> | ||
</button> | ||
{:else} | ||
<button onclick={() => onAdd(id)} class="font-display btn btn-sm lg:btn-md btn-secondary border border-base-300 shadow-sm" class:btn-disabled={!onAdd}> | ||
<span class="ph-bold ph-user-plus text-xl"></span> | ||
<span>Add me</span> | ||
</button> | ||
{/if} | ||
{#if (selected || enrolled) && !removed} | ||
<button | ||
onclick={() => onRemove(id)} | ||
class="font-display btn btn-sm lg:btn-md btn-success border border-success shadow-sm" | ||
class:btn-disabled={!onRemove} | ||
> | ||
<span class="ph-bold ph-check text-xl"></span> | ||
<span>Added</span> | ||
</button> | ||
{:else} | ||
<button | ||
onclick={() => onAdd(id)} | ||
class="font-display btn btn-sm lg:btn-md btn-secondary border border-base-300 shadow-sm" | ||
class:btn-disabled={!onAdd} | ||
> | ||
<span class="ph-bold ph-user-plus text-xl"></span> | ||
<span>Add me</span> | ||
</button> | ||
{/if} | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div class="mb-1 font-display font-semibold text-sm lg:text-base">Volunteers</div> | ||
<div class="flex flex-wrap items-center gap-2"> | ||
{#if !volunteers.some((v) => v.keyholder) && !enrolled} | ||
<div class="flex items-center gap-1"> | ||
<span class="ph-bold ph-warning text-warning lg:text-lg"></span> | ||
<span class="text-sm lg:text-lg">No Keyholder</span> | ||
</div> | ||
{/if} | ||
{#if !volunteers.some((v) => v.keyholder) && !enrolled} | ||
<div class="flex items-center gap-1"> | ||
<span class="ph-bold ph-warning text-warning lg:text-lg"></span> | ||
<span class="text-sm lg:text-lg">No Keyholder</span> | ||
</div> | ||
{/if} | ||
|
||
{#if enrolled} | ||
<div class="badge badge-success flex items-center gap-1 lg:p-4 lg:text-lg select-none"> | ||
{#if getContext('user')?.keyholder} | ||
<span class="ph-fill ph-key text-base-content"></span> | ||
{/if} | ||
Me | ||
</div> | ||
{/if} | ||
{#if enrolled} | ||
<div class="badge badge-success flex items-center gap-1 lg:p-4 lg:text-lg select-none"> | ||
{#if getContext('user')?.keyholder} | ||
<span class="ph-fill ph-key text-base-content"></span> | ||
{/if} | ||
Me | ||
</div> | ||
{/if} | ||
|
||
{#each volunteers as volunteer} | ||
<div class="badge flex items-center gap-1 lg:p-4 lg:text-lg select-none"> | ||
{#if volunteer.keyholder} | ||
<span class="ph-fill ph-key text-amber-500"></span> | ||
{/if} | ||
{volunteer.firstName} | ||
</div> | ||
{/each} | ||
{#each volunteers as volunteer} | ||
<div class="badge flex items-center gap-1 lg:p-4 lg:text-lg select-none"> | ||
{#if volunteer.keyholder} | ||
<span class="ph-fill ph-key text-amber-500"></span> | ||
{/if} | ||
{volunteer.firstName} | ||
</div> | ||
{/each} | ||
</div> | ||
</div> | ||
</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
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
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