Add warning for submitting multiple highlights

This commit is contained in:
Ajay Ramachandran
2021-09-10 19:07:16 -04:00
parent cad5cd97fc
commit 1083520666
2 changed files with 8 additions and 0 deletions

View File

@@ -656,6 +656,9 @@
"message": "To submit segments with the category of \"{0}\", you must enable it in the options. You will be redirected to the options now.", "message": "To submit segments with the category of \"{0}\", you must enable it in the options. You will be redirected to the options now.",
"description": "Used when submitting segments to only let them select a certain category if they have it enabled in the options." "description": "Used when submitting segments to only let them select a certain category if they have it enabled in the options."
}, },
"poiOnlyOneSegment": {
"message": "Warning: This type of segment can have a maximum of one active at a time. Submitting multiple will cause a random one to be shown."
},
"youMustSelectACategory": { "youMustSelectACategory": {
"message": "You must select a category for all segments you are submitting!" "message": "You must select a category for all segments you are submitting!"
}, },

View File

@@ -279,6 +279,11 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
if (getCategoryActionType(event.target.value as Category) === CategoryActionType.POI) { if (getCategoryActionType(event.target.value as Category) === CategoryActionType.POI) {
this.setTimeTo(1, null); this.setTimeTo(1, null);
this.props.contentContainer().updateEditButtonsOnPlayer(); this.props.contentContainer().updateEditButtonsOnPlayer();
if (this.props.contentContainer().sponsorTimesSubmitting
.some((segment, i) => segment.category === event.target.value && i !== this.props.index)) {
alert(chrome.i18n.getMessage("poiOnlyOneSegment"));
}
} }
this.saveEditTimes(); this.saveEditTimes();