diff options
author | Ajay <[email protected]> | 2022-02-21 11:17:58 -0500 |
---|---|---|
committer | Ajay <[email protected]> | 2022-02-21 11:17:58 -0500 |
commit | 930bc113fe8276cdb7d24432e9ee4551b20d95ca (patch) | |
tree | e76ff0d708286b923bc66279d077167529df641f /src/components/SubmissionNoticeComponent.tsx | |
parent | 7aaa28b5c2dce7c15bbb5679757c7fa4ecbad5a1 (diff) | |
download | SponsorBlock-930bc113fe8276cdb7d24432e9ee4551b20d95ca.tar.gz SponsorBlock-930bc113fe8276cdb7d24432e9ee4551b20d95ca.zip |
Add sort segments button
Diffstat (limited to 'src/components/SubmissionNoticeComponent.tsx')
-rw-r--r-- | src/components/SubmissionNoticeComponent.tsx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/components/SubmissionNoticeComponent.tsx b/src/components/SubmissionNoticeComponent.tsx index 82aa0cca..08b60dd5 100644 --- a/src/components/SubmissionNoticeComponent.tsx +++ b/src/components/SubmissionNoticeComponent.tsx @@ -68,12 +68,19 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S } render(): React.ReactElement { + const sortButton = + <img id={"sponsorSkipSortButton" + this.state.idSuffix} + className="sponsorSkipObject sponsorSkipNoticeButton sponsorSkipSmallButton" + onClick={() => this.sortSegments()} + src={chrome.extension.getURL("icons/sort.svg")}> + </img>; return ( <NoticeComponent noticeTitle={this.state.noticeTitle} idSuffix={this.state.idSuffix} ref={this.noticeRef} closeListener={this.cancel.bind(this)} - zIndex={5000}> + zIndex={5000} + firstColumn={sortButton}> {/* Text Boxes */} {this.getMessageBoxes()} @@ -190,6 +197,16 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S this.cancel(); } + + sortSegments(): void { + let sponsorTimesSubmitting = this.props.contentContainer().sponsorTimesSubmitting; + sponsorTimesSubmitting = sponsorTimesSubmitting.sort((a, b) => a.segment[0] - b.segment[0]); + + Config.config.unsubmittedSegments[this.props.contentContainer().sponsorVideoID] = sponsorTimesSubmitting; + Config.forceSyncUpdate("unsubmittedSegments"); + + this.forceUpdate(); + } } export default SubmissionNoticeComponent; |