aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/SkipNoticeComponent.tsx
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2021-04-05 23:35:05 -0400
committerAjay Ramachandran <[email protected]>2021-04-05 23:35:05 -0400
commita08dbf4da17ff21b397a8cf1e3077a2ad95a5949 (patch)
treeb1c4e1c98e6b4433c5ee2dd29eac2fb663d7f726 /src/components/SkipNoticeComponent.tsx
parentedcda31db4581b262fcd8cff4c7a173cb15fee9b (diff)
downloadSponsorBlock-a08dbf4da17ff21b397a8cf1e3077a2ad95a5949.tar.gz
SponsorBlock-a08dbf4da17ff21b397a8cf1e3077a2ad95a5949.zip
Add submitting for highlight category
Diffstat (limited to 'src/components/SkipNoticeComponent.tsx')
-rw-r--r--src/components/SkipNoticeComponent.tsx12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx
index 2990eee3..f042bcd5 100644
--- a/src/components/SkipNoticeComponent.tsx
+++ b/src/components/SkipNoticeComponent.tsx
@@ -1,10 +1,13 @@
import * as React from "react";
import * as CompileConfig from "../../config.json";
import Config from "../config"
-import { ContentContainer, SponsorHideType, SponsorTime } from "../types";
+import { Category, ContentContainer, CategoryActionType, SponsorHideType, SponsorTime } from "../types";
import NoticeComponent from "./NoticeComponent";
import NoticeTextSelectionComponent from "./NoticeTextSectionComponent";
+import Utils from "../utils";
+const utils = new Utils();
+
export enum SkipNoticeAction {
None,
Upvote,
@@ -342,7 +345,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
this.contentContainer().vote(0, this.segments[index].UUID, undefined, this);
break;
case SkipNoticeAction.CategoryVote:
- this.contentContainer().vote(undefined, this.segments[index].UUID, this.categoryOptionRef.current.value, this)
+ this.contentContainer().vote(undefined, this.segments[index].UUID, this.categoryOptionRef.current.value as Category, this)
break;
case SkipNoticeAction.Unskip:
this.state.unskipCallback(index);
@@ -389,7 +392,8 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
getCategoryOptions(): React.ReactElement[] {
const elements = [];
- for (const category of Config.config.categorySelections) {
+ const categories = Config.config.categorySelections.filter((cat => utils.getCategoryActionType(cat.name as Category) === CategoryActionType.Skippable));
+ for (const category of categories) {
elements.push(
<option value={category.name}
key={category.name}>
@@ -476,7 +480,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
});
}
- afterVote(segment: SponsorTime, type: number, category: string): void {
+ afterVote(segment: SponsorTime, type: number, category: Category): void {
this.addVoteButtonInfo(chrome.i18n.getMessage("voted"));
if (type === 0) {