refactor: better description for event action

This commit is contained in:
alex-arc
2026-08-08 14:24:16 +02:00
parent e6a79af7fa
commit 25bb9a5d61
@@ -118,6 +118,15 @@ export default function RundownEvent({
const handleRef = useRef<null | HTMLSpanElement>(null); const handleRef = useRef<null | HTMLSpanElement>(null);
const [enableMatchDuration, groupTargetDurationDescription] = (() => {
if (!parentGroup || parentGroup.targetDuration === null || parentGroup.duration === parentGroup.targetDuration)
return [false, ''];
const { targetDuration, duration } = parentGroup;
return targetDuration > duration
? [true, 'Increase event duration to fit the group target']
: [true, 'Decrease event duration to fit the group target'];
})();
const [onContextMenu] = useContextMenu<HTMLDivElement>(() => const [onContextMenu] = useContextMenu<HTMLDivElement>(() =>
selectedEvents.size > 1 selectedEvents.size > 1
? [ ? [
@@ -179,16 +188,13 @@ export default function RundownEvent({
{ {
type: 'item', type: 'item',
label: 'Match Group Target Duration', label: 'Match Group Target Duration',
description: 'Change event duration to fill the group target', description: groupTargetDurationDescription,
icon: TbClockPin, icon: TbClockPin,
onClick: () => { onClick: () => {
if (!parent) return; if (!parent) return;
matchGroupDuration(eventId); matchGroupDuration(eventId);
}, },
disabled: disabled: !enableMatchDuration,
!parentGroup ||
parentGroup.targetDuration === null ||
parentGroup.duration === parentGroup.targetDuration,
}, },
{ type: 'divider' }, { type: 'divider' },
{ {