Added end button to submission notice

This commit is contained in:
Ajay Ramachandran
2020-04-20 00:37:25 -04:00
parent 89f72c185c
commit 9a70599e60
2 changed files with 18 additions and 1 deletions

View File

@@ -531,5 +531,8 @@
}, },
"moreCategories": { "moreCategories": {
"message": "More Categories" "message": "More Categories"
},
"bracketEnd": {
"message": "(End)"
} }
} }

View File

@@ -133,6 +133,12 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
onClick={() => this.setTimeToNow(1)}> onClick={() => this.setTimeToNow(1)}>
{chrome.i18n.getMessage("bracketNow")} {chrome.i18n.getMessage("bracketNow")}
</span> </span>
<span id={"endButton" + this.idSuffix}
className="sponsorNowButton"
onClick={() => this.setTimeToEnd()}>
{chrome.i18n.getMessage("bracketEnd")}
</span>
</div> </div>
); );
} else { } else {
@@ -230,10 +236,18 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
} }
setTimeToNow(index: number) { setTimeToNow(index: number) {
this.setTimeTo(index, this.props.contentContainer().v.currentTime);
}
setTimeToEnd() {
this.setTimeTo(1, this.props.contentContainer().v.duration);
}
setTimeTo(index: number, time: number) {
let sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index]; let sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
sponsorTime.segment[index] = sponsorTime.segment[index] =
this.props.contentContainer().v.currentTime; time;
this.setState({ this.setState({
sponsorTimeEdits: this.getFormattedSponsorTimesEdits(sponsorTime) sponsorTimeEdits: this.getFormattedSponsorTimesEdits(sponsorTime)