mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 04:27:15 +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(() => {
|
React.useEffect(() => {
|
||||||
|
const hasNonChapter = props.segments.find(seg => seg.actionType !== ActionType.Chapter)
|
||||||
|
if (!hasNonChapter && props.segments.length > 0) {
|
||||||
|
setTab(SegmentListTab.Chapter);
|
||||||
|
} else {
|
||||||
setTab(SegmentListTab.Segments);
|
setTab(SegmentListTab.Segments);
|
||||||
}, [props.videoID]);
|
}
|
||||||
|
}, [props.videoID, props.segments]);
|
||||||
|
|
||||||
const tabFilter = (segment: SponsorTime) => {
|
const tabFilter = (segment: SponsorTime) => {
|
||||||
if (tab === SegmentListTab.Chapter) {
|
if (tab === SegmentListTab.Chapter) {
|
||||||
|
|||||||
Reference in New Issue
Block a user