Skip to content

Commit ac282e2

Browse files
committed
fix: hide 'set part as next' context menu for invalid parts
1 parent 0420570 commit ac282e2

1 file changed

Lines changed: 44 additions & 40 deletions

File tree

packages/webui/src/client/ui/SegmentTimeline/SegmentContextMenu.tsx

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -181,55 +181,59 @@ export function SegmentContextMenu({
181181
)}
182182
{part && isPartNext !== undefined && isPartOrphaned !== undefined && timecode !== null && (
183183
<>
184-
<MenuItem
185-
onClick={(e) => onSetNext(part.instance.part, e)}
186-
disabled={!!part.instance.orphaned || !canSetAsNext}
187-
>
188-
<span
189-
dangerouslySetInnerHTML={{
190-
__html: t(`Set part as <strong>Next</strong>`),
191-
}}
192-
></span>
193-
</MenuItem>
194-
{startsAt !== undefined && part && enablePlayFromAnywhere ? (
184+
{!part.instance.part.invalid && (
195185
<>
196186
<MenuItem
197-
onClick={(e) =>
198-
onSetAsNextFromHere(
199-
part.instance,
200-
playlist?.nextPartInfo?.partInstanceId ?? null,
201-
playlist?.currentPartInfo?.partInstanceId ?? null,
202-
e
203-
)
204-
}
205-
disabled={getIsPlayFromHereDisabled()}
187+
onClick={(e) => onSetNext(part.instance.part, e)}
188+
disabled={!!part.instance.orphaned || !canSetAsNext}
206189
>
207190
<span
208191
dangerouslySetInnerHTML={{
209-
__html: t(
210-
`Set part from ${RundownUtils.formatTimeToShortTime(Math.floor(timecode / 1000) * 1000)} as <strong>Next</strong>`
211-
),
192+
__html: t(`Set part as <strong>Next</strong>`),
212193
}}
213194
></span>
214195
</MenuItem>
215-
<MenuItem
216-
onClick={(e) =>
217-
onSetAsNextFromHere(
218-
part.instance,
219-
playlist?.nextPartInfo?.partInstanceId ?? null,
220-
playlist?.currentPartInfo?.partInstanceId ?? null,
221-
e,
222-
true
223-
)
224-
}
225-
disabled={getIsPlayFromHereDisabled(true)}
226-
>
227-
<span>
228-
{t(`Play part from ${RundownUtils.formatTimeToShortTime(Math.floor(timecode / 1000) * 1000)}`)}
229-
</span>
230-
</MenuItem>
196+
{startsAt !== undefined && part && enablePlayFromAnywhere ? (
197+
<>
198+
<MenuItem
199+
onClick={(e) =>
200+
onSetAsNextFromHere(
201+
part.instance,
202+
playlist?.nextPartInfo?.partInstanceId ?? null,
203+
playlist?.currentPartInfo?.partInstanceId ?? null,
204+
e
205+
)
206+
}
207+
disabled={getIsPlayFromHereDisabled()}
208+
>
209+
<span
210+
dangerouslySetInnerHTML={{
211+
__html: t(
212+
`Set part from ${RundownUtils.formatTimeToShortTime(Math.floor(timecode / 1000) * 1000)} as <strong>Next</strong>`
213+
),
214+
}}
215+
></span>
216+
</MenuItem>
217+
<MenuItem
218+
onClick={(e) =>
219+
onSetAsNextFromHere(
220+
part.instance,
221+
playlist?.nextPartInfo?.partInstanceId ?? null,
222+
playlist?.currentPartInfo?.partInstanceId ?? null,
223+
e,
224+
true
225+
)
226+
}
227+
disabled={getIsPlayFromHereDisabled(true)}
228+
>
229+
<span>
230+
{t(`Play part from ${RundownUtils.formatTimeToShortTime(Math.floor(timecode / 1000) * 1000)}`)}
231+
</span>
232+
</MenuItem>
233+
</>
234+
) : null}
231235
</>
232-
) : null}
236+
)}
233237
{enableQuickLoop && !isLoopLocked(playlist) && (
234238
<>
235239
{isQuickLoopStart(part.partId, playlist) ? (

0 commit comments

Comments
 (0)