Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
@@ -48,6 +48,8 @@ import { dlEvent } from "./EventApi";
|
||||
import { CalendarEvent } from "./EventsTypes";
|
||||
import EventUpdateModal from "./EventUpdateModal";
|
||||
import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
|
||||
import { userAttendee } from "../User/userDataTypes";
|
||||
|
||||
export default function EventPreviewModal({
|
||||
eventId,
|
||||
calId,
|
||||
@@ -89,6 +91,7 @@ export default function EventPreviewModal({
|
||||
undefined
|
||||
);
|
||||
const [afterChoiceFunc, setAfterChoiceFunc] = useState<Function>();
|
||||
const attendeePreview = makeAttendeePreview(event.attendee, t);
|
||||
|
||||
const [toggleActionMenu, setToggleActionMenu] = useState<Element | null>(
|
||||
null
|
||||
@@ -494,23 +497,13 @@ export default function EventPreviewModal({
|
||||
<Box sx={{ marginRight: 2 }}>
|
||||
<Typography>
|
||||
{t("eventPreview.guests", {
|
||||
count: attendees.length,
|
||||
count: event.attendee.length,
|
||||
})}
|
||||
</Typography>
|
||||
<Typography
|
||||
sx={{ fontSize: "13px", color: "text.secondary" }}
|
||||
>
|
||||
{t("eventPreview.yesCount", {
|
||||
count: attendees.filter(
|
||||
(a) => a.partstat === "ACCEPTED"
|
||||
).length,
|
||||
})}
|
||||
,{" "}
|
||||
{t("eventPreview.noCount", {
|
||||
count: attendees.filter(
|
||||
(a) => a.partstat === "DECLINED"
|
||||
).length,
|
||||
})}
|
||||
{attendeePreview}
|
||||
</Typography>
|
||||
</Box>
|
||||
{!showAllAttendees && (
|
||||
@@ -843,3 +836,30 @@ function formatEnd(
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function makeAttendeePreview(attendees: userAttendee[], t: Function) {
|
||||
const attendeePreview = [];
|
||||
const yesCount = attendees?.filter((a) => a.partstat === "ACCEPTED").length;
|
||||
const noCount = attendees?.filter((a) => a.partstat === "DECLINED").length;
|
||||
const maybeCount = attendees?.filter(
|
||||
(a) => a.partstat === "TENTATIVE"
|
||||
).length;
|
||||
const needActionCount = attendees?.filter(
|
||||
(a) => a.partstat === "NEEDS-ACTION"
|
||||
).length;
|
||||
if (yesCount) {
|
||||
attendeePreview.push(t("eventPreview.yesCount", { count: yesCount }));
|
||||
}
|
||||
if (maybeCount) {
|
||||
attendeePreview.push(t("eventPreview.maybeCount", { count: maybeCount }));
|
||||
}
|
||||
if (needActionCount) {
|
||||
attendeePreview.push(
|
||||
t("eventPreview.needActionCount", { count: needActionCount })
|
||||
);
|
||||
}
|
||||
if (noCount) {
|
||||
attendeePreview.push(t("eventPreview.noCount", { count: noCount }));
|
||||
}
|
||||
return attendeePreview.join(", ");
|
||||
}
|
||||
|
||||
@@ -207,6 +207,8 @@
|
||||
"joinVideo": "Join the video conference",
|
||||
"guests": "%{count} guests",
|
||||
"yesCount": "%{count} yes",
|
||||
"maybeCount": "%{count} maybe",
|
||||
"needActionCount": "%{count} waiting",
|
||||
"noCount": "%{count} no",
|
||||
"recurrentEvent": "Recurrent Event",
|
||||
"freq": {
|
||||
|
||||
+3
-1
@@ -205,8 +205,10 @@
|
||||
"showMore": "Afficher plus",
|
||||
"showLess": "Afficher moins",
|
||||
"joinVideo": "Rejoindre la visioconférence",
|
||||
"guests": "%{count} invités",
|
||||
"guests": "%{count} participants",
|
||||
"yesCount": "%{count} oui",
|
||||
"maybeCount": "%{count} peut-être",
|
||||
"needActionCount": "%{count} en attente",
|
||||
"noCount": "%{count} non",
|
||||
"recurrentEvent": "Événement récurrent",
|
||||
"freq": {
|
||||
|
||||
@@ -207,6 +207,8 @@
|
||||
"joinVideo": "Присоединиться к видеоконференции",
|
||||
"guests": "%{count} гостей",
|
||||
"yesCount": "%{count} да",
|
||||
"maybeCount": "%{count} может быть",
|
||||
"needActionCount": "%{count} в ожидании",
|
||||
"noCount": "%{count} нет",
|
||||
"recurrentEvent": "Повторяющееся событие",
|
||||
"freq": {
|
||||
|
||||
@@ -207,6 +207,8 @@
|
||||
"joinVideo": "Tham gia cuộc họp video",
|
||||
"guests": "%{count} khách",
|
||||
"yesCount": "%{count} đồng ý",
|
||||
"maybeCount": "%{count} có thể",
|
||||
"needActionCount": "%{count} đang chờ",
|
||||
"noCount": "%{count} từ chối",
|
||||
"recurrentEvent": "Sự kiện lặp lại",
|
||||
"freq": {
|
||||
|
||||
Reference in New Issue
Block a user