Only show mute option for supported categories

This commit is contained in:
Ajay Ramachandran
2021-09-04 01:44:09 -04:00
parent 0e7a298967
commit 2c1f5f16c2
2 changed files with 15 additions and 5 deletions

View File

@@ -2,5 +2,15 @@
"serverAddress": "https://sponsor.ajay.app",
"testingServerAddress": "https://sponsor.ajay.app/test",
"serverAddressComment": "This specifies the default SponsorBlock server to connect to",
"categoryList": ["sponsor", "selfpromo", "interaction", "poi_highlight", "intro", "outro", "preview", "music_offtopic"]
"categoryList": ["sponsor", "selfpromo", "interaction", "poi_highlight", "intro", "outro", "preview", "music_offtopic"],
"categorySupport": {
"sponsor": ["skip", "mute"],
"selfpromo": ["skip", "mute"],
"interaction": ["skip", "mute"],
"intro": ["skip"],
"outro": ["skip"],
"preview": ["skip"],
"music_offtopic": ["skip"],
"poi_highlight": ["skip"]
}
}

View File

@@ -191,14 +191,14 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
</div>
{/* Action Type */}
{getCategoryActionType(sponsorTime.category) === CategoryActionType.Skippable ? (
{CompileConfig.categorySupport[sponsorTime.category]?.length > 1 ? (
<div style={{position: "relative"}}>
<select id={"sponsorTimeActionTypes" + this.idSuffix}
className="sponsorTimeEditSelector sponsorTimeActionTypes"
defaultValue={sponsorTime.actionType}
ref={this.actionTypeOptionRef}
onChange={() => this.saveEditTimes()}>
{this.getActionTypeOptions()}
{this.getActionTypeOptions(sponsorTime)}
</select>
</div>
): ""}
@@ -284,10 +284,10 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
this.saveEditTimes();
}
getActionTypeOptions(): React.ReactElement[] {
getActionTypeOptions(sponsorTime: SponsorTime): React.ReactElement[] {
const elements = [];
for (const actionType of ActionTypes) {
for (const actionType of CompileConfig.categorySupport[sponsorTime.category]) {
elements.push(
<option value={actionType}
key={actionType}>