diff --git a/src/components/Calendar/CalendarSelection.tsx b/src/components/Calendar/CalendarSelection.tsx
index 272f4aa..908c9f2 100644
--- a/src/components/Calendar/CalendarSelection.tsx
+++ b/src/components/Calendar/CalendarSelection.tsx
@@ -4,7 +4,7 @@ import AccordionSummary from "@mui/material/AccordionSummary";
import Typography from "@mui/material/Typography";
import { useAppDispatch, useAppSelector } from "../../app/hooks";
import AddIcon from "@mui/icons-material/Add";
-import { useState } from "react";
+import { useState, useMemo } from "react";
import CalendarPopover from "./CalendarModal";
import { Calendars } from "../../features/Calendars/CalendarTypes";
import MoreVertIcon from "@mui/icons-material/MoreVert";
@@ -15,6 +15,7 @@ import CalendarSearch from "./CalendarSearch";
import { Divider, ListItem, Menu, MenuItem } from "@mui/material";
import { removeCalendarAsync } from "../../features/Calendars/CalendarSlice";
import { DeleteCalendarDialog } from "./DeleteCalendarDialog";
+import { trimLongTextWithoutSpace } from "../../utils/textUtils";
function CalendarAccordion({
title,
@@ -223,6 +224,11 @@ function CalendarSelector({
setDeletePopupOpen(false);
handleClose();
};
+
+ const trimmedName = useMemo(
+ () => trimLongTextWithoutSpace(calendars[id].name),
+ [calendars, id]
+ );
return (
<>
-
diff --git a/src/features/Events/EventDisplayPreview.tsx b/src/features/Events/EventDisplayPreview.tsx
index 8031614..764986d 100644
--- a/src/features/Events/EventDisplayPreview.tsx
+++ b/src/features/Events/EventDisplayPreview.tsx
@@ -655,7 +655,9 @@ export default function EventPreviewModal({
height: 12,
}}
/>
- {calendar.name}
+
+ {calendar.name}
+
word.length > 25);
+
+ if (!hasLongWord) {
+ return text;
+ }
+
+ let result = "";
+ for (const word of words) {
+ if (word.length > 25) {
+ const remaining = 20 - result.length;
+ result += word.substring(0, Math.max(remaining - 3, 5)) + "...";
+ break;
+ } else {
+ result += (result ? " " : "") + word;
+ }
+ }
+
+ return result;
+}