update
This commit is contained in:
@@ -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))',
|
||||
|
||||
Reference in New Issue
Block a user