Skip to content

Commit 518159e

Browse files
committed
fix: hide 'set part as next' context menu for invalid parts
1 parent 55046d0 commit 518159e

File tree

1 file changed

+44
-40
lines changed

1 file changed

+44
-40
lines changed

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

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -177,55 +177,59 @@ export function SegmentContextMenu({
177177
)}
178178
{part && isPartNext !== undefined && isPartOrphaned !== undefined && timecode !== null && (
179179
<>
180-
<MenuItem
181-
onClick={(e) => onSetNext(part.instance.part, e)}
182-
disabled={!!part.instance.orphaned || !canSetAsNext}
183-
>
184-
<span
185-
dangerouslySetInnerHTML={{
186-
__html: t(`Set part as <strong>Next</strong>`),
187-
}}
188-
></span>
189-
</MenuItem>
190-
{startsAt !== undefined && part && enablePlayFromAnywhere ? (
180+
{!part.instance.part.invalid && (
191181
<>
192182
<MenuItem
193-
onClick={(e) =>
194-
onSetAsNextFromHere(
195-
part.instance,
196-
playlist?.nextPartInfo?.partInstanceId ?? null,
197-
playlist?.currentPartInfo?.partInstanceId ?? null,
198-
e
199-
)
200-
}
201-
disabled={getIsPlayFromHereDisabled()}
183+
onClick={(e) => onSetNext(part.instance.part, e)}
184+
disabled={!!part.instance.orphaned || !canSetAsNext}
202185
>
203186
<span
204187
dangerouslySetInnerHTML={{
205-
__html: t(
206-
`Set part from ${RundownUtils.formatTimeToShortTime(Math.floor(timecode / 1000) * 1000)} as <strong>Next</strong>`
207-
),
188+
__html: t(`Set part as <strong>Next</strong>`),
208189
}}
209190
></span>
210191
</MenuItem>
211-
<MenuItem
212-
onClick={(e) =>
213-
onSetAsNextFromHere(
214-
part.instance,
215-
playlist?.nextPartInfo?.partInstanceId ?? null,
216-
playlist?.currentPartInfo?.partInstanceId ?? null,
217-
e,
218-
true
219-
)
220-
}
221-
disabled={getIsPlayFromHereDisabled(true)}
222-
>
223-
<span>
224-
{t(`Play part from ${RundownUtils.formatTimeToShortTime(Math.floor(timecode / 1000) * 1000)}`)}
225-
</span>
226-
</MenuItem>
192+
{startsAt !== undefined && part && enablePlayFromAnywhere ? (
193+
<>
194+
<MenuItem
195+
onClick={(e) =>
196+
onSetAsNextFromHere(
197+
part.instance,
198+
playlist?.nextPartInfo?.partInstanceId ?? null,
199+
playlist?.currentPartInfo?.partInstanceId ?? null,
200+
e
201+
)
202+
}
203+
disabled={getIsPlayFromHereDisabled()}
204+
>
205+
<span
206+
dangerouslySetInnerHTML={{
207+
__html: t(
208+
`Set part from ${RundownUtils.formatTimeToShortTime(Math.floor(timecode / 1000) * 1000)} as <strong>Next</strong>`
209+
),
210+
}}
211+
></span>
212+
</MenuItem>
213+
<MenuItem
214+
onClick={(e) =>
215+
onSetAsNextFromHere(
216+
part.instance,
217+
playlist?.nextPartInfo?.partInstanceId ?? null,
218+
playlist?.currentPartInfo?.partInstanceId ?? null,
219+
e,
220+
true
221+
)
222+
}
223+
disabled={getIsPlayFromHereDisabled(true)}
224+
>
225+
<span>
226+
{t(`Play part from ${RundownUtils.formatTimeToShortTime(Math.floor(timecode / 1000) * 1000)}`)}
227+
</span>
228+
</MenuItem>
229+
</>
230+
) : null}
227231
</>
228-
) : null}
232+
)}
229233
{enableQuickLoop && !RundownResolver.isLoopLocked(playlist) && (
230234
<>
231235
{RundownResolver.isQuickLoopStart(part.partId, playlist) ? (

0 commit comments

Comments
 (0)