This commit is contained in:
Joyce
2026-02-05 13:45:32 -05:00
parent 7a0f11ee88
commit 26e553bfd0
10 changed files with 569 additions and 57 deletions

View File

@@ -5,6 +5,20 @@ export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function getCalendarNameFromUrl(icsUrl: string | null | undefined): string | null {
if (!icsUrl) return null;
try {
const url = new URL(icsUrl);
const pathname = url.pathname;
const filename = pathname.split('/').pop() || '';
// Decode URL encoding (e.g., %20 -> space) and remove .ics extension
const decoded = decodeURIComponent(filename).replace(/\.ics$/i, '');
return decoded || null;
} catch {
return null;
}
}
export function getAvatarColor(name?: string): string {
const colors = [
'hsl(var(--tag-green))',