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:
@@ -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.";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user