[#583] removed useless icon and added proper translation for calendarName (#589)

This commit is contained in:
Camille Moussu
2026-03-02 11:15:24 +01:00
committed by GitHub
parent d130b1b50e
commit 7b31064a56
3 changed files with 31 additions and 30 deletions
+14 -9
View File
@@ -1,23 +1,28 @@
import { useAppSelector } from "@/app/hooks";
import { Calendar } from "@/features/Calendars/CalendarTypes"; import { Calendar } from "@/features/Calendars/CalendarTypes";
import { Box, Typography } from "@linagora/twake-mui";
import SquareRoundedIcon from "@mui/icons-material/SquareRounded";
import { defaultColors } from "@/utils/defaultColors"; import { defaultColors } from "@/utils/defaultColors";
import { makeDisplayName } from "@/utils/makeDisplayName"; import { makeDisplayName } from "@/utils/makeDisplayName";
import { renameDefault } from "@/utils/renameDefault";
import { Box, Typography } from "@linagora/twake-mui";
import SquareRoundedIcon from "@mui/icons-material/SquareRounded";
import { useI18n } from "twake-i18n";
import { OwnerCaption } from "./OwnerCaption"; import { OwnerCaption } from "./OwnerCaption";
import { useAppSelector } from "@/app/hooks";
export function CalendarName({ calendar }: { calendar: Calendar }) { export function CalendarName({ calendar }: { calendar: Calendar }) {
const userData = useAppSelector((state) => state.user.userData); const userData = useAppSelector((state) => state.user.userData);
const showCaption = const { t } = useI18n();
calendar.name !== "#default" &&
userData.openpaasId !== calendar.id.split("/")[0]; const ownerId = calendar.id.split("/")[0];
const ownerDisplayName = makeDisplayName(calendar) ?? "";
const isOwnCalendar = userData.openpaasId === ownerId;
const showCaption = calendar.name !== "#default" && !isOwnCalendar;
return ( return (
<Box <Box
style={{ style={{
display: "flex", display: "flex",
flexDirection: "row", flexDirection: "row",
gap: 8, gap: "16px",
alignItems: "center", alignItems: "center",
}} }}
> >
@@ -30,11 +35,11 @@ export function CalendarName({ calendar }: { calendar: Calendar }) {
/> />
<Box style={{ display: "flex", flexDirection: "column" }}> <Box style={{ display: "flex", flexDirection: "column" }}>
<Typography sx={{ wordBreak: "break-word" }}> <Typography sx={{ wordBreak: "break-word" }}>
{calendar.name} {renameDefault(calendar.name, ownerDisplayName, t, isOwnCalendar)}
</Typography> </Typography>
<OwnerCaption <OwnerCaption
showCaption={showCaption} showCaption={showCaption}
ownerDisplayName={makeDisplayName(calendar) ?? ""} ownerDisplayName={ownerDisplayName}
/> />
</Box> </Box>
</Box> </Box>
+17 -17
View File
@@ -4,6 +4,7 @@ import { userAttendee } from "@/features/User/models/attendee";
import iconCamera from "@/static/images/icon-camera.svg"; import iconCamera from "@/static/images/icon-camera.svg";
import { defaultColors } from "@/utils/defaultColors"; import { defaultColors } from "@/utils/defaultColors";
import { makeDisplayName } from "@/utils/makeDisplayName"; import { makeDisplayName } from "@/utils/makeDisplayName";
import { renameDefault } from "@/utils/renameDefault";
import { import {
addVideoConferenceToDescription, addVideoConferenceToDescription,
generateMeetingLink, generateMeetingLink,
@@ -193,6 +194,13 @@ export default function EventFormFields({
const personalCalendars = userPersonalCalendars.filter( const personalCalendars = userPersonalCalendars.filter(
(cal) => !cal.delegated (cal) => !cal.delegated
); );
const selectedCalendar = userPersonalCalendars.find(
(cal) => cal.id === calendarid
);
const selectedOwnerDisplayName = selectedCalendar
? (makeDisplayName(selectedCalendar) ?? "")
: "";
const isSelectedDelegated = !!selectedCalendar?.delegated;
// Reset hasEndDateChanged and hasClickedDateTimeSection when modal closes // Reset hasEndDateChanged and hasClickedDateTimeSection when modal closes
React.useEffect(() => { React.useEffect(() => {
@@ -786,29 +794,21 @@ export default function EventFormFields({
} }
onClick={() => setHasClickedCalendarSection(true)} onClick={() => setHasClickedCalendarSection(true)}
> >
{userPersonalCalendars.find((cal) => cal.id === calendarid) {selectedCalendar?.name ? (
?.name ? (
<Box style={{ display: "flex", flexDirection: "column" }}> <Box style={{ display: "flex", flexDirection: "column" }}>
<Typography sx={{ wordBreak: "break-word" }}> <Typography sx={{ wordBreak: "break-word" }}>
{ {renameDefault(
userPersonalCalendars.find((cal) => cal.id === calendarid) selectedCalendar.name,
?.name selectedOwnerDisplayName,
} t,
!isSelectedDelegated
)}
</Typography> </Typography>
<OwnerCaption <OwnerCaption
showCaption={ showCaption={
delegatedCalendars.find((cal) => cal.id === calendarid) !== isSelectedDelegated && selectedCalendar.name !== "#default"
undefined &&
userPersonalCalendars.find((cal) => cal.id === calendarid)
?.name !== "#default"
}
ownerDisplayName={
makeDisplayName(
userPersonalCalendars.find(
(cal) => cal.id === calendarid
) ?? ({} as Calendar)
) ?? ""
} }
ownerDisplayName={selectedOwnerDisplayName}
/> />
</Box> </Box>
) : ( ) : (
@@ -24,7 +24,6 @@ import {
Typography, Typography,
useTheme, useTheme,
} from "@linagora/twake-mui"; } from "@linagora/twake-mui";
import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
import CircleIcon from "@mui/icons-material/Circle"; import CircleIcon from "@mui/icons-material/Circle";
import CloseIcon from "@mui/icons-material/Close"; import CloseIcon from "@mui/icons-material/Close";
import EditIcon from "@mui/icons-material/Edit"; import EditIcon from "@mui/icons-material/Edit";
@@ -728,9 +727,6 @@ export default function EventPreviewModal({
mb: 2, mb: 2,
}} }}
> >
<Box sx={infoIconSx}>
<CalendarTodayIcon />
</Box>
<CalendarName calendar={calendar} /> <CalendarName calendar={calendar} />
</Box> </Box>
</ResponsiveDialog> </ResponsiveDialog>