import { InfoRow } from "@/components/Event/InfoRow"; import { Box, Button, Typography } from "@linagora/twake-mui"; import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline"; import LocationOnOutlinedIcon from "@mui/icons-material/LocationOnOutlined"; import NotificationsNoneIcon from "@mui/icons-material/NotificationsNone"; import RepeatIcon from "@mui/icons-material/Repeat"; import SubjectIcon from "@mui/icons-material/Subject"; import VideocamOutlinedIcon from "@mui/icons-material/VideocamOutlined"; import { alpha, useTheme } from "@mui/material/styles"; import { useI18n } from "twake-i18n"; import { CalendarEvent } from "../EventsTypes"; import { EventPreviewAttendees } from "./EventPreviewAttendees"; import { makeRecurrenceString } from "./utils/makeRecurrenceString"; interface EventPreviewDetailsProps { event: CalendarEvent; isOwn: boolean; isNotPrivate: boolean; } export function EventPreviewDetails({ event, isOwn, isNotPrivate, }: EventPreviewDetailsProps) { const { t } = useI18n(); const theme = useTheme(); const infoIconColor = alpha(theme.palette.grey[900], 0.9); const infoIconSx = { minWidth: "25px", marginRight: 2, color: infoIconColor }; const attendees = event.attendee?.filter( (a) => a.cal_address !== event.organizer?.cal_address ) || []; const organizer = event.attendee?.find( (a) => a.cal_address === event.organizer?.cal_address ); const showDetails = isNotPrivate || isOwn; if (!showDetails) { return ( {t("eventPreview.privateEvent.hiddenDetails")} ); } return ( <> {/* Video */} {event.x_openpass_videoconference && ( } content={ } /> )} {/* Attendees */} {attendees.length > 0 && ( )} {/* Location */} {event.location && ( } text={event.location} /> )} {/* Description */} {event.description && ( } text={event.description} /> )} {/* Alarm */} {event.alarm && ( } text={t("eventPreview.alarmText", { trigger: t(`event.form.notifications.${event.alarm.trigger}`), action: (() => { if (!event.alarm.action) return ""; const translationKey = `event.form.notifications.${event.alarm.action}`; const translated = t(translationKey); return translated === translationKey ? event.alarm.action : translated; })(), })} /> )} {/* Repetition */} {event.repetition && ( } text={makeRecurrenceString(event, t)} /> )} {/* Error */} {event.error && ( } text={event.error} error /> )} ); }