update buttons when single time segment is edited

This commit is contained in:
Ajay 2022-10-11 18:30:53 -04:00
parent 6d05b2a849
commit 758b6f18db

View file

@ -541,9 +541,14 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
if (time === null) time = sponsorTime.segment[0];
const addedTime = sponsorTime.segment.length === 1;
sponsorTime.segment[index] = time;
if (sponsorTime.actionType === ActionType.Poi) sponsorTime.segment[1] = time;
if (addedTime) {
this.props.contentContainer().updateEditButtonsOnPlayer();
}
this.setState({
sponsorTimeEdits: this.getFormattedSponsorTimesEdits(sponsorTime)
}, () => this.saveEditTimes());
@ -583,7 +588,12 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
// Change segment time only if the format was correct
if (startTime !== null && endTime !== null) {
const addingTime = sponsorTimesSubmitting[this.props.index].segment.length === 1;
sponsorTimesSubmitting[this.props.index].segment = [startTime, endTime];
if (addingTime) {
this.props.contentContainer().updateEditButtonsOnPlayer();
}
}
} else if (this.state.sponsorTimeEdits[1] === null && category === "outro") {
sponsorTimesSubmitting[this.props.index].segment[1] = this.props.contentContainer().v.duration;