From 7ff8213bd688f34bee5ebf5cd2edf8eefc99ab92 Mon Sep 17 00:00:00 2001 From: Till-JS <101404291+Till-JS@users.noreply.github.com> Date: Fri, 12 Dec 2025 03:51:53 +0100 Subject: [PATCH] feat(calendar): add default calendars and event indicators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create 4 default calendars for new users: Persรถnlich, Beruf, Familie, Freizeit - Add event count dots below dates in DateStrip (max 5 dots) - Show blue dots for events, white dots on today ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../backend/src/calendar/calendar.service.ts | 56 +++++++++++++++++-- .../lib/components/calendar/DateStrip.svelte | 30 ++++++++++ 2 files changed, 80 insertions(+), 6 deletions(-) diff --git a/apps/calendar/apps/backend/src/calendar/calendar.service.ts b/apps/calendar/apps/backend/src/calendar/calendar.service.ts index c13adbbee..dea77d014 100644 --- a/apps/calendar/apps/backend/src/calendar/calendar.service.ts +++ b/apps/calendar/apps/backend/src/calendar/calendar.service.ts @@ -113,12 +113,56 @@ export class CalendarService { return updated; } - // Create a new default calendar - return this.create(userId, { - name: 'Mein Kalender', - isDefault: true, - color: '#3B82F6', - }); + // Create default calendars for new user + await this.createDefaultCalendars(userId); + + // Return the default one + const defaultCal = await this.db + .select() + .from(calendars) + .where(and(eq(calendars.userId, userId), eq(calendars.isDefault, true))); + + return defaultCal[0]; + } + + /** + * Create default calendars for a new user + */ + async createDefaultCalendars(userId: string): Promise { + const defaultCalendars = [ + { + name: 'Persรถnlich', + color: '#3B82F6', // Blue + isDefault: true, + description: 'Private Termine', + }, + { + name: 'Beruf', + color: '#10B981', // Green + isDefault: false, + description: 'Arbeit, Meetings, Projekte', + }, + { + name: 'Familie', + color: '#F97316', // Orange + isDefault: false, + description: 'Familientermine, Geburtstage', + }, + { + name: 'Freizeit', + color: '#8B5CF6', // Violet + isDefault: false, + description: 'Hobbies, Sport, Events', + }, + ]; + + const created: Calendar[] = []; + for (const cal of defaultCalendars) { + const calendar = await this.create(userId, cal); + created.push(calendar); + } + + return created; } private async clearDefaultCalendar(userId: string): Promise { diff --git a/apps/calendar/apps/web/src/lib/components/calendar/DateStrip.svelte b/apps/calendar/apps/web/src/lib/components/calendar/DateStrip.svelte index c5cb6daa4..a4abe650a 100644 --- a/apps/calendar/apps/web/src/lib/components/calendar/DateStrip.svelte +++ b/apps/calendar/apps/web/src/lib/components/calendar/DateStrip.svelte @@ -1,5 +1,6 @@