Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ export default function MaximumEventSignupsPreview({
);

const maximumEventSignups: EditingScheduledValue<string> = useMemo(() => {
const parsedSignupRounds = parseSignupRounds(signupRounds);
const parsedSignupRounds = parseSignupRounds(signupRounds, timezoneName);
return {
timespans: parsedSignupRounds.map((round) => ({
start: round.timespan.start?.toISO(),
finish: round.timespan.finish?.toISO(),
value: round.maximum_event_signups?.toString() ?? 'not_yet',
})),
};
}, [signupRounds]);
}, [signupRounds, timezoneName]);

return (
<ScheduledValuePreview
Expand Down
6 changes: 6 additions & 0 deletions app/javascript/UIComponents/ScheduledValuePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ function ScheduledValuePreviewCalendar<ValueType>({
return <></>;
}

// If there's only a single change point (not a range), don't render a calendar
if (earliestChange.toMillis() === latestChange.toMillis()) {
return <></>;
}

if (latestChange.diff(earliestChange, 'months').months > 6) {
return <>{t('scheduledValuePreview.tooLong')}</>;
}
Expand Down Expand Up @@ -259,6 +264,7 @@ function ScheduledValuePreview<ValueType>({
const [arrow, setArrow] = useState<HTMLDivElement | null>(null);
const dateElementMapRef = useRef(new Map<number, HTMLElement>());

// eslint-disable-next-line react-hooks/refs
const focusedDateElement = focusedDate ? (dateElementMapRef.current.get(focusedDate.valueOf()) ?? null) : null;

const { styles, attributes, state } = useLitformPopper(tooltip, focusedDateElement, arrow);
Expand Down
Loading