refactor: extract shared EventCardBase component

- Create EventCardBase with common layout, icons (calendar, clock, repeat), and formatting functions
- Refactor EventCard and ProposedEventCard to use EventCardBase
- Add event details to delete action responses for better UX
- Include event title in delete confirmation message
This commit is contained in:
2026-01-05 19:27:33 +01:00
parent 24ab6f0420
commit 8e58ab4249
5 changed files with 235 additions and 192 deletions

View File

@@ -175,11 +175,17 @@ async function getTestResponse(
const jensEvent = events.find((e) => e.title === "Meeting mit Jens");
if (jensEvent) {
return {
content:
"Alles klar, ich lösche den Termin 'Meeting mit Jens' für dich:",
content: "Soll ich diesen Termin wirklich löschen?",
proposedChange: {
action: "delete",
eventId: jensEvent.id,
event: {
title: jensEvent.title,
startTime: jensEvent.startTime,
endTime: jensEvent.endTime,
description: jensEvent.description,
isRecurring: jensEvent.isRecurring,
},
},
};
}
@@ -285,7 +291,9 @@ export class ChatService {
: "Termin nicht gefunden.";
} else if (action === "delete" && eventId) {
await this.eventRepo.delete(eventId);
content = "Der Termin wurde gelöscht.";
content = event?.title
? `Der Termin "${event.title}" wurde gelöscht.`
: "Der Termin wurde gelöscht.";
} else {
content = "Ungültige Aktion.";
}