-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
245 additions
and
38 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export function humanReadableDate(d: Date): string { | ||
// Sat Feb 17, 2024, 18:00 (EST) | ||
let options: Intl.DateTimeFormatOptions = { | ||
weekday: "short", | ||
year: "numeric", | ||
month: "short", | ||
day: "numeric", | ||
hour: "2-digit", | ||
minute: "2-digit", | ||
timeZoneName: "short", | ||
}; | ||
|
||
return new Intl.DateTimeFormat("en-US", options).format(d); | ||
} |
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
46 changes: 46 additions & 0 deletions
46
src/routes/dashboard/vaccs/[id]/events/data-table-actions.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,46 @@ | ||
<script lang="ts"> | ||
import * as DropdownMenu from "$lib/components/ui/dropdown-menu"; | ||
import type {Event} from "@prisma/client"; | ||
import {MoreHorizontal} from "lucide-svelte"; | ||
import {Button} from "$lib/components/ui/button"; | ||
import {toast} from "svelte-sonner"; | ||
export let event: Event; | ||
export let canManageEvents: boolean; | ||
</script> | ||
|
||
<DropdownMenu.Root> | ||
<DropdownMenu.Trigger asChild let:builder> | ||
<Button | ||
variant="ghost" | ||
builders={[builder]} | ||
size="icon" | ||
class="relative w-8 h-8 p-0"> | ||
<span class="sr-only">Open menu</span> | ||
<MoreHorizontal class="w-4 h-4" /> | ||
</Button> | ||
</DropdownMenu.Trigger> | ||
<DropdownMenu.Content> | ||
<DropdownMenu.Group> | ||
<DropdownMenu.Label>Actions</DropdownMenu.Label> | ||
<DropdownMenu.Item | ||
on:click={() => {navigator.clipboard.writeText(event.id); toast.success("Event ID copied to clipboard");}}> | ||
Copy ID | ||
</DropdownMenu.Item> | ||
{#if canManageEvents} | ||
<DropdownMenu.Separator /> | ||
{#if event.public} | ||
<DropdownMenu.Item>Make Private</DropdownMenu.Item> | ||
{:else} | ||
<DropdownMenu.Item>Make Public</DropdownMenu.Item> | ||
{/if} | ||
<DropdownMenu.Item> | ||
Edit | ||
</DropdownMenu.Item> | ||
<DropdownMenu.Item class="text-red-500 data-[highlighted]:bg-red-500/30 data-[highlighted]:text-red-500"> | ||
Delete | ||
</DropdownMenu.Item> | ||
{/if} | ||
</DropdownMenu.Group> | ||
</DropdownMenu.Content> | ||
</DropdownMenu.Root> |
18 changes: 18 additions & 0 deletions
18
src/routes/dashboard/vaccs/[id]/events/data-table-banner.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,18 @@ | ||
<script lang="ts"> | ||
import {page} from "$app/stores"; | ||
import Image from "$lib/components/Image.svelte"; | ||
export let eventId: string; | ||
export let bannerUrl: string; | ||
export let blurhash: string; | ||
</script> | ||
|
||
<a href="/dashboard/vaccs/{$page.params.id}/events/{eventId}/"> | ||
<Image | ||
width="480px" | ||
class="rounded" | ||
src={bannerUrl} | ||
{blurhash} | ||
style="aspect-ratio: 16/9;" | ||
alt="" /> | ||
</a> |