mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-13 15:07:02 +03:00
simplify tabFilter
This commit is contained in:
@@ -68,14 +68,6 @@ export const SegmentListComponent = (props: SegmentListComponentProps) => {
|
|||||||
}
|
}
|
||||||
}, [props.videoID, hasSegments]);
|
}, [props.videoID, hasSegments]);
|
||||||
|
|
||||||
const tabFilter = (segment: SponsorTime) => {
|
|
||||||
if (tab === SegmentListTab.Chapter) {
|
|
||||||
return isChapter(segment);
|
|
||||||
} else {
|
|
||||||
return isSegment(segment);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const segmentsWithNesting = React.useMemo(() => {
|
const segmentsWithNesting = React.useMemo(() => {
|
||||||
const result: SegmentWithNesting[] = [];
|
const result: SegmentWithNesting[] = [];
|
||||||
let nbTrailingNonChapters = 0;
|
let nbTrailingNonChapters = 0;
|
||||||
@@ -141,7 +133,7 @@ export const SegmentListComponent = (props: SegmentListComponentProps) => {
|
|||||||
isVip={isVip}
|
isVip={isVip}
|
||||||
loopedChapter={props.loopedChapter} // UUID instead of boolean so it can be passed down to nested chapters
|
loopedChapter={props.loopedChapter} // UUID instead of boolean so it can be passed down to nested chapters
|
||||||
|
|
||||||
tabFilter={tabFilter}
|
tabFilter={tab === SegmentListTab.Chapter ? isChapter : isSegment}
|
||||||
sendMessage={props.sendMessage}
|
sendMessage={props.sendMessage}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user