From ec9f1efd55f262629fea222354c01e92cd6ac09a Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 4 Apr 2020 12:58:02 -0400 Subject: [PATCH] Added category skip option to just show an overlay without skipping --- public/_locales/en/messages.json | 4 +- .../CategorySkipOptionsComponent.tsx | 47 ++++++++++++++----- src/config.ts | 4 +- src/types.ts | 9 +++- 4 files changed, 47 insertions(+), 17 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 8beb64f1..cc008f02 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -505,7 +505,7 @@ "manualSkip": { "message": "Manual Skip" }, - "autoSkip": { - "message": "Auto Skip" + "showOverlay": { + "message": "Show Overlay On Player" } } diff --git a/src/components/CategorySkipOptionsComponent.tsx b/src/components/CategorySkipOptionsComponent.tsx index e0604418..58301d7b 100644 --- a/src/components/CategorySkipOptionsComponent.tsx +++ b/src/components/CategorySkipOptionsComponent.tsx @@ -1,6 +1,7 @@ import * as React from "react"; import Config from "../config" +import { CategorySkipOption } from "../types"; export interface CategorySkipOptionsProps { category: string; @@ -27,7 +28,17 @@ class CategorySkipOptionsComponent extends React.Component): void { + let option: CategorySkipOption; + + this.removeCurrentCategorySelection(); + switch (event.target.value) { case "disable": - this.removeCurrentCategorySelection(); + return; + case "showOverlay": + option = CategorySkipOption.ShowOverlay; break; - default: - this.removeCurrentCategorySelection(); + case "manualSkip": + option = CategorySkipOption.ManualSkip; - Config.config.categorySelections.push({ - name: this.props.category, - autoSkip: event.target.value === "autoSkip" - }); + break; + case "autoSkip": + option = CategorySkipOption.AutoSkip; - // Forces the Proxy to send this to the chrome storage API - Config.config.categorySelections = Config.config.categorySelections; + break; } + + Config.config.categorySelections.push({ + name: this.props.category, + option: option + }); + + // Forces the Proxy to send this to the chrome storage API + Config.config.categorySelections = Config.config.categorySelections; } /** Removes this category from the config list of category selections */ @@ -89,8 +112,8 @@ class CategorySkipOptionsComponent extends React.Component