Fix creating and deleting calendars

This fixes the creation and deletion of calendars to include a color and the proper chosen name.
This commit is contained in:
Bruno Bernardino
2025-09-06 19:17:48 +01:00
parent 24944de0f6
commit 49dbc724c8
8 changed files with 30 additions and 10 deletions

View File

@@ -21,6 +21,7 @@ export const CALENDAR_COLOR_OPTIONS = [
'bg-fuchsia-700',
'bg-pink-800',
'bg-rose-700',
'bg-gray-700',
] as const;
const CALENDAR_COLOR_OPTIONS_HEX = [
@@ -44,9 +45,12 @@ const CALENDAR_COLOR_OPTIONS_HEX = [
'#9D21B1',
'#9C174D',
'#BC133D',
'#384354',
] as const;
export function getColorAsHex(calendarColor: string) {
export function getColorAsHex(
calendarColor: (typeof CALENDAR_COLOR_OPTIONS)[number],
): (typeof CALENDAR_COLOR_OPTIONS_HEX)[number] {
const colorIndex = CALENDAR_COLOR_OPTIONS.findIndex((color) => color === calendarColor);
return CALENDAR_COLOR_OPTIONS_HEX[colorIndex] || '#384354';