mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 02:46:42 +02:00
feat(calendar): add default calendars and event indicators
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
c6677a8a1b
commit
7ff8213bd6
2 changed files with 80 additions and 6 deletions
|
|
@ -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<Calendar[]> {
|
||||
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<void> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue