diff --git a/src/components/PlayerButtonComponent.tsx b/src/components/playerButtons/PlayerButtonGroupComponent.tsx similarity index 71% rename from src/components/PlayerButtonComponent.tsx rename to src/components/playerButtons/PlayerButtonGroupComponent.tsx index d54ea8cb..8ce4c326 100644 --- a/src/components/PlayerButtonComponent.tsx +++ b/src/components/playerButtons/PlayerButtonGroupComponent.tsx @@ -1,39 +1,7 @@ import { ConfigProvider, Popconfirm, theme } from "antd"; import * as React from "react"; -import { forwardRef } from "react"; - -interface PlayerButtonProps { - baseID: string; - title: string; - imageName: string; - isDraggable?: boolean; - onClick?: () => void; -} - -const PlayerButtonComponent = forwardRef(function ( - { baseID, title, imageName, isDraggable = false, onClick }, - ref -) { - return ( - - ); -}); -PlayerButtonComponent.displayName = "PlayerButtonComponent"; +import Config from "../../config"; +import PlayerButtonComponent from "./playerButtonComponent"; interface PlayerButtonGroupProps { startSegmentCallback: () => void; @@ -43,7 +11,7 @@ interface PlayerButtonGroupProps { infoCallback: () => void; } -export function PlayerButtonGroupComponent({ +function PlayerButtonGroupComponent({ startSegmentCallback, cancelSegmentCallback, deleteCallback, @@ -68,6 +36,7 @@ export function PlayerButtonGroupComponent({ title="openPopup" imageName="PlayerInfoIconSponsorBlocker.svg" isDraggable={false} + show={!Config.config.hideInfoButtonPlayerControls && !document.URL.includes("/embed/")} onClick={infoCallback} > @@ -112,3 +81,5 @@ export function PlayerButtonGroupComponent({ ); } + +export default PlayerButtonGroupComponent; diff --git a/src/components/playerButtons/playerButtonComponent.tsx b/src/components/playerButtons/playerButtonComponent.tsx new file mode 100644 index 00000000..9668aa02 --- /dev/null +++ b/src/components/playerButtons/playerButtonComponent.tsx @@ -0,0 +1,38 @@ +import * as React from "react"; +import { forwardRef } from "react"; + +interface PlayerButtonProps { + baseID: string; + title: string; + imageName: string; + isDraggable?: boolean; + show?: boolean; + onClick?: () => void; +} + +const PlayerButtonComponent = forwardRef(function ( + { baseID, title, imageName, isDraggable = false, show = true, onClick }, + ref +) { + return ( + + ); +}); +PlayerButtonComponent.displayName = "PlayerButtonComponent"; + +export default PlayerButtonComponent; diff --git a/src/content.ts b/src/content.ts index 442a7d2f..04e0d0bd 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1918,17 +1918,6 @@ async function updateVisibilityOfPlayerControlsButton(): Promise { playerButtons = await playerButton.createButtons(); updateEditButtonsOnPlayer(); - - // Don't show the info button on embeds - if ( - Config.config.hideInfoButtonPlayerControls || - document.URL.includes("/embed/") || - document.getElementById("sponsorBlockPopupContainer") != null - ) { - playerButtons.info.button.style.display = "none"; - } else { - playerButtons.info.button.style.removeProperty("display"); - } } /** Updates the visibility of buttons on the player related to creating segments. */ diff --git a/src/render/PlayerButton.tsx b/src/render/PlayerButton.tsx index 69caff47..2e898950 100644 --- a/src/render/PlayerButton.tsx +++ b/src/render/PlayerButton.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { createRoot, Root } from "react-dom/client"; -import { PlayerButtonGroupComponent } from "../components/PlayerButtonComponent"; +import PlayerButtonGroupComponent from "../components/playerButtons/PlayerButtonGroupComponent"; import Config from "../config"; import { AnimationUtils } from "../utils/animationUtils"; import { waitForElement } from "../utils/dom";