diff --git a/docker-compose.yml b/docker-compose.yml
index 86fcc75..10a68da 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,6 @@
services:
website:
- image: ghcr.io/bewcloud/bewcloud:v2.5.1
+ image: ghcr.io/bewcloud/bewcloud:v2.5.2
restart: always
ports:
- 127.0.0.1:8000:8000
diff --git a/islands/calendar/Calendars.tsx b/islands/calendar/Calendars.tsx
index b17e9df..c383f79 100644
--- a/islands/calendar/Calendars.tsx
+++ b/islands/calendar/Calendars.tsx
@@ -278,8 +278,15 @@ export default function Calendars({ initialCalendars }: CalendarsProps) {
onChange={(event) =>
openCalendar.value = { ...openCalendar.value!, calendarColor: event.currentTarget.value }}
>
- {CALENDAR_COLOR_OPTIONS.map((color) => )}
+ {CALENDAR_COLOR_OPTIONS.map((color) => (
+
+ ))}
= {
const requestBody = await request.clone().json() as RequestBody;
if (requestBody.name) {
- await CalendarModel.create(context.state.user.id, requestBody.name, getColorAsHex('bg-gray-700'));
+ const randomColor = CALENDAR_COLOR_OPTIONS[Math.floor(Math.random() * CALENDAR_COLOR_OPTIONS.length)];
+ await CalendarModel.create(context.state.user.id, requestBody.name, getColorAsHex(randomColor));
}
const newCalendars = await CalendarModel.list(context.state.user.id);
diff --git a/routes/calendar.tsx b/routes/calendar.tsx
index 0847317..2891082 100644
--- a/routes/calendar.tsx
+++ b/routes/calendar.tsx
@@ -4,7 +4,7 @@ import { FreshContextState } from '/lib/types.ts';
import { Calendar, CalendarEvent, CalendarEventModel, CalendarModel } from '/lib/models/calendar.ts';
import CalendarWrapper from '/islands/calendar/CalendarWrapper.tsx';
import { AppConfig } from '/lib/config.ts';
-import { getColorAsHex, getDateRangeForCalendarView } from '/lib/utils/calendar.ts';
+import { CALENDAR_COLOR_OPTIONS, getColorAsHex, getDateRangeForCalendarView } from '/lib/utils/calendar.ts';
interface Data {
userCalendars: Calendar[];
@@ -42,7 +42,8 @@ export const handler: Handlers = {
// Create default calendar if none exists
if (userCalendars.length === 0) {
- await CalendarModel.create(userId, 'Calendar', getColorAsHex('bg-red-700'));
+ const randomColor = CALENDAR_COLOR_OPTIONS[Math.floor(Math.random() * CALENDAR_COLOR_OPTIONS.length)];
+ await CalendarModel.create(userId, 'Calendar', getColorAsHex(randomColor));
userCalendars = await CalendarModel.list(userId);
}