From 3a488a9110be1c3d33edc09aa5cbf3450742837f Mon Sep 17 00:00:00 2001 From: Ajay Date: Tue, 26 Nov 2024 02:25:42 -0500 Subject: Fix upcoming notice behavior --- src/components/NoticeComponent.tsx | 3 +- src/components/SkipNoticeComponent.tsx | 34 ++++++---- src/components/UpcomingNoticeComponent.tsx | 99 ------------------------------ src/content.ts | 47 +++++++------- src/render/SkipNotice.tsx | 6 +- src/render/UpcomingNotice.tsx | 32 +++++++--- src/types.ts | 2 - 7 files changed, 76 insertions(+), 147 deletions(-) delete mode 100644 src/components/UpcomingNoticeComponent.tsx diff --git a/src/components/NoticeComponent.tsx b/src/components/NoticeComponent.tsx index 56a96378..a6dcb768 100644 --- a/src/components/NoticeComponent.tsx +++ b/src/components/NoticeComponent.tsx @@ -19,6 +19,7 @@ export interface NoticeProps { idSuffix?: string; fadeIn?: boolean; + fadeOut?: boolean; startFaded?: boolean; firstColumn?: React.ReactElement[] | React.ReactElement; firstRow?: React.ReactElement; @@ -326,7 +327,7 @@ class NoticeComponent extends React.Component { return; } - if (countdownTime == 3) { + if (countdownTime == 3 && this.props.fadeOut) { //start fade out animation const notice = document.getElementById("sponsorSkipNotice" + this.idSuffix); notice?.style.removeProperty("animation"); diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx index 32270f9c..73612d2a 100644 --- a/src/components/SkipNoticeComponent.tsx +++ b/src/components/SkipNoticeComponent.tsx @@ -6,7 +6,7 @@ import NoticeComponent from "./NoticeComponent"; import NoticeTextSelectionComponent from "./NoticeTextSectionComponent"; import Utils from "../utils"; const utils = new Utils(); -import { getSkippingText } from "../utils/categoryUtils"; +import { getSkippingText, getUpcomingText } from "../utils/categoryUtils"; import ThumbsUpSvg from "../svg-icons/thumbs_up_svg"; import ThumbsDownSvg from "../svg-icons/thumbs_down_svg"; @@ -28,12 +28,16 @@ export interface SkipNoticeProps { autoSkip: boolean; startReskip?: boolean; + upcomingNotice?: boolean; // Contains functions and variables from the content script needed by the skip notice contentContainer: ContentContainer; closeListener: () => void; showKeybindHint?: boolean; smaller: boolean; + fadeIn: boolean; + + componentDidMount?: () => void; unskipTime?: number; } @@ -97,9 +101,9 @@ class SkipNoticeComponent extends React.Component 0 && [...previousSkipNotices].some(notice => !notice.classList.contains("secondSkipNotice")); @@ -171,12 +175,7 @@ class SkipNoticeComponent extends React.Component= NoticeVisbilityMode.FadedForAll || (Config.config.noticeVisibilityMode >= NoticeVisbilityMode.FadedForAutoSkip && this.autoSkip)} timed={true} @@ -197,12 +197,20 @@ class SkipNoticeComponent extends React.Component this.onMouseEnter() } > ); } + componentDidMount(): void { + if (this.props.componentDidMount) { + this.props.componentDidMount(); + } + } + getBottomRow(): JSX.Element[] { return [ /* Bottom Row */ @@ -365,8 +373,10 @@ class SkipNoticeComponent extends React.Component +