feat: add calendar export endpoints for ICS and Google Calendar

This commit is contained in:
2026-01-30 04:08:16 -06:00
parent a767a3f8be
commit 7b8c11ac13
7 changed files with 654 additions and 1 deletions
+47 -1
View File
@@ -16,7 +16,16 @@ import { useClipboard } from "$lib/composables/useClipboard.svelte";
import { cn, tooltipContentClass, formatNumber } from "$lib/utils";
import { Tooltip } from "bits-ui";
import SimpleTooltip from "./SimpleTooltip.svelte";
import { Info, Copy, Check, Star, Triangle, ExternalLink } from "@lucide/svelte";
import {
Info,
Copy,
Check,
Star,
Triangle,
ExternalLink,
Calendar,
Download,
} from "@lucide/svelte";
let { course }: { course: CourseResponse } = $props();
@@ -302,5 +311,42 @@ const clipboard = useClipboard();
>
</div>
{/if}
<!-- Calendar Export -->
{#if course.meetingTimes.length > 0}
<div>
<h4 class="text-sm text-foreground mb-2">
<span class="inline-flex items-center gap-1">
Calendar
<SimpleTooltip
text="Export this course schedule to your calendar app"
delay={150}
passthrough
>
<Info class="size-3 text-muted-foreground/50" />
</SimpleTooltip>
</span>
</h4>
<div class="flex flex-wrap gap-1.5">
<a
href="/api/courses/{course.termCode}/{course.crn}/calendar.ics"
download
class="inline-flex items-center gap-1.5 text-sm font-medium bg-card border border-border rounded-md px-2.5 py-1 text-foreground hover:border-foreground/20 hover:bg-card/80 transition-colors"
>
<Download class="size-3.5" />
ICS File
</a>
<a
href="/api/courses/{course.termCode}/{course.crn}/gcal"
target="_blank"
rel="noopener"
class="inline-flex items-center gap-1.5 text-sm font-medium bg-card border border-border rounded-md px-2.5 py-1 text-foreground hover:border-foreground/20 hover:bg-card/80 transition-colors"
>
<Calendar class="size-3.5" />
Google Calendar
</a>
</div>
</div>
{/if}
</div>
</div>