From 907bd68e4e87a5807659bdcfeca72e55ec19b6c0 Mon Sep 17 00:00:00 2001 From: FlorianZahn Date: Sat, 9 Oct 2021 02:43:39 +0200 Subject: [PATCH] Buttons now change color depending on state. Added colorPalette config entry --- public/_locales/en/messages.json | 5 ++- public/content.css | 9 +++- src/components/SkipNoticeComponent.tsx | 57 ++++++++++++++------------ src/config.ts | 8 +++- src/svg-icons/pencil_svg.tsx | 18 ++++++++ src/svg-icons/thumbs_down_svg.tsx | 23 +++++++++++ src/svg-icons/thumbs_up_svg.tsx | 22 ++++++++++ 7 files changed, 112 insertions(+), 30 deletions(-) create mode 100644 src/svg-icons/pencil_svg.tsx create mode 100644 src/svg-icons/thumbs_down_svg.tsx create mode 100644 src/svg-icons/thumbs_up_svg.tsx diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index da70cd4e..072f6a7e 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -700,7 +700,7 @@ "message": "Incorrect/Wrong Timing" }, "incorrectCategory": { - "message": "Wrong Category" + "message": "Change Category" }, "nonMusicCategoryOnMusic": { "message": "This video is categorized as music. Are you sure this has a sponsor? If this is actually a \"Non-Music segment\", open up the extension options and enable this category. Then, you can submit this segment as \"Non-Music\" instead of sponsor. Please read the guidelines if you are confused." @@ -822,5 +822,8 @@ }, "ContinueVoting": { "message": "Continue Voting" + }, + "ChangeCategoryTooltip": { + "message": "This will instantly apply to your segments" } } diff --git a/public/content.css b/public/content.css index 7c7a7760..85a6887a 100644 --- a/public/content.css +++ b/public/content.css @@ -254,12 +254,16 @@ .sponsorTimesVoteButtonsContainer { float: left; - + vertical-align:middle; padding: 2px 5px; margin-right: 4px; } +.sponsorTimesVoteButtonsContainer div{ + display: inline-block; +} + .sponsorSkipNoticeRightSection { right: 0; position: absolute; @@ -330,7 +334,8 @@ } .voteButton { - height: 17px; + height: 24px; + width: 24px; cursor: pointer; } .voteButton:hover { diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx index 00fca6ba..db0aca15 100644 --- a/src/components/SkipNoticeComponent.tsx +++ b/src/components/SkipNoticeComponent.tsx @@ -8,6 +8,10 @@ import SubmissionNotice from "../render/SubmissionNotice"; import { getCategoryActionType, getSkippingText } from "../utils/categoryUtils"; +import ThumbsUpSvg from "../svg-icons/thumbs_up_svg"; +import ThumbsDownSvg from "../svg-icons/thumbs_down_svg"; +import PencilSvg from "../svg-icons/pencil_svg"; + export enum SkipNoticeAction { None, Upvote, @@ -96,7 +100,7 @@ class SkipNoticeComponent extends React.Component a.segment[0] - b.segment[0]); } - //this is the suffix added at the end of every id + // This is the suffix added at the end of every id for (const segment of this.segments) { this.idSuffix += segment.UUID; } @@ -188,36 +192,37 @@ class SkipNoticeComponent extends React.Component {/* Vote Button Container */} - {!this.state.thanksForVotingText ? + {!this.state.thanksForVotingText ? {/* Upvote Button */} - this.prepAction(SkipNoticeAction.Upvote)}> - - +
this.prepAction(SkipNoticeAction.Upvote)}> + +
{/* Report Button */} - this.prepAction(SkipNoticeAction.Downvote)}> - +
this.prepAction(SkipNoticeAction.Downvote)}> + +
{/* Copy and Downvote Button */} - this.adjustEditingState(true)}> - +
this.adjustEditingState(true)}> + +
: @@ -250,7 +255,6 @@ class SkipNoticeComponent extends React.Component @@ -265,14 +269,15 @@ class SkipNoticeComponent extends React.Component this.prepAction(SkipNoticeAction.CopyDownvote)}> - {chrome.i18n.getMessage("CopyAndDownvote")} + {chrome.i18n.getMessage("CopyAndDownvote")} {/* Category vote */} diff --git a/src/config.ts b/src/config.ts index e8b64bf2..43345107 100644 --- a/src/config.ts +++ b/src/config.ts @@ -44,7 +44,8 @@ interface SBConfig { autoHideInfoButton: boolean, autoSkipOnMusicVideos: boolean, highlightCategoryUpdate: boolean, - wikiPages: SBMap + wikiPages: SBMap, + colorPalette: SBMap // What categories should be skipped categorySelections: CategorySelection[], @@ -211,6 +212,11 @@ const Config: SBObject = { ["mute", "https://wiki.sponsor.ajay.app/w/Mute_Segment"], ]), + colorPalette: new SBMap("colorPalette", [ + ["SponsorBlockRed", "#780303"], + ["SponsorBlockWhite", "#ffffff"] + ]), + // Preview bar barTypes: { "preview-chooseACategory": { diff --git a/src/svg-icons/pencil_svg.tsx b/src/svg-icons/pencil_svg.tsx new file mode 100644 index 00000000..866f908e --- /dev/null +++ b/src/svg-icons/pencil_svg.tsx @@ -0,0 +1,18 @@ +import * as React from "react"; + +const pencilSvg = ({ + fill = "#ffffff" +}) => ( + + + +); + +export default pencilSvg; diff --git a/src/svg-icons/thumbs_down_svg.tsx b/src/svg-icons/thumbs_down_svg.tsx new file mode 100644 index 00000000..4bb89d79 --- /dev/null +++ b/src/svg-icons/thumbs_down_svg.tsx @@ -0,0 +1,23 @@ +import * as React from "react"; + +const thumbsDownSvg = ({ + fill = "#ffffff" +}) => ( + + + + + +); + +export default thumbsDownSvg; diff --git a/src/svg-icons/thumbs_up_svg.tsx b/src/svg-icons/thumbs_up_svg.tsx new file mode 100644 index 00000000..8dd77c1c --- /dev/null +++ b/src/svg-icons/thumbs_up_svg.tsx @@ -0,0 +1,22 @@ +import * as React from "react"; + +const thumbsUpSvg = ({ + fill = "#ffffff" +}) => ( + + + + +); + +export default thumbsUpSvg;