Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate title and location in day view #1516

Merged
merged 3 commits into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/features/calendar/components/CalendarDayView/Day/Event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import messageIds from 'features/events/l10n/messageIds';
import { removeOffset } from 'utils/dateUtils';
import StatusDot from 'features/events/components/EventPopper/StatusDot';
import theme from 'theme';
import { truncateOnMiddle } from 'utils/stringUtils';
import { useMessages } from 'core/i18n';
import useModel from 'core/useModel';
import { ZetkinEvent } from 'utils/types/zetkin';
Expand Down Expand Up @@ -61,13 +62,17 @@ const Event = ({ event }: { event: ZetkinEvent }) => {
<StatusDot state={getEventState(event)} />
{/* Title */}
<Typography
noWrap
sx={{
color: theme.palette.secondary.main,
}}
>
{event.title ||
event.activity?.title ||
messages.common.noTitle()}
{truncateOnMiddle(
event.title ||
event.activity?.title ||
messages.common.noTitle(),
50
)}
</Typography>
{/* Time */}
<Typography color={theme.palette.secondary.main} component={'div'}>
Expand Down Expand Up @@ -102,10 +107,11 @@ const Event = ({ event }: { event: ZetkinEvent }) => {
<Typography
color={theme.palette.secondary.main}
component={'div'}
noWrap
>
<Box alignItems="center" display="flex" gap={0.5}>
<PlaceOutlined />
{event.location?.title}
{truncateOnMiddle(event.location?.title, 40)}
</Box>
</Typography>
)}
Expand Down
Loading