mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Set default tab to chapters if there are no segments
This commit is contained in:
@@ -47,8 +47,13 @@ export const SegmentListComponent = (props: SegmentListComponentProps) => {
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
setTab(SegmentListTab.Segments);
|
||||
}, [props.videoID]);
|
||||
const hasNonChapter = props.segments.find(seg => seg.actionType !== ActionType.Chapter)
|
||||
if (!hasNonChapter && props.segments.length > 0) {
|
||||
setTab(SegmentListTab.Chapter);
|
||||
} else {
|
||||
setTab(SegmentListTab.Segments);
|
||||
}
|
||||
}, [props.videoID, props.segments]);
|
||||
|
||||
const tabFilter = (segment: SponsorTime) => {
|
||||
if (tab === SegmentListTab.Chapter) {
|
||||
|
||||
Reference in New Issue
Block a user