[#265] prefills title + trad + test (#293)

Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
Camille Moussu
2025-11-12 20:42:05 +01:00
committed by GitHub
parent 991cb6e56e
commit f886846a2b
10 changed files with 188 additions and 179 deletions
+14 -2
View File
@@ -6,6 +6,7 @@ import { SlotLabelContentArg } from "@fullcalendar/core";
import moment from "moment-timezone";
import { refreshSingularCalendar } from "../../Event/utils/eventUtils";
import { ThunkDispatch } from "@reduxjs/toolkit";
import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
export const updateSlotLabelVisibility = (
currentTime: Date,
@@ -58,13 +59,24 @@ export const eventToFullCalendarFormat = (
filteredTempEvents: CalendarEvent[],
userId: string | undefined
) => {
const { t } = useI18n();
return filteredEvents
.concat(filteredTempEvents.map((e) => ({ ...e, temp: true })))
.map((e) => {
if (e.calId.split("/")[0] === userId) {
return { ...e, colors: e.color, editable: true };
return {
...e,
title: e.title ? e.title : t("event.untitled"),
colors: e.color,
editable: true,
};
}
return { ...e, colors: e.color, editable: false };
return {
...e,
title: e.title ? e.title : t("event.untitled"),
colors: e.color,
editable: false,
};
});
};