Skip to content

Commit

Permalink
Separate info button into component
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Sep 9, 2024
1 parent 0a916a0 commit cd07d6b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
37 changes: 37 additions & 0 deletions src/components/playerButtons/InfoButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as React from "react";
import { forwardRef } from "react";
import Config from "../../config";
import PlayerButtonComponent from "./playerButtonComponent";

interface InfoButtonProps {
popupOpen: boolean;
infoCallback: () => void;
}

const InfoButtonComponent = forwardRef<HTMLButtonElement, InfoButtonProps>(function (
{ popupOpen = false, infoCallback },

Check failure on line 12 in src/components/playerButtons/InfoButton.tsx

View workflow job for this annotation

GitHub Actions / Create artifacts

'popupOpen' is assigned a value but never used
ref
) {
function initialShowInfoButton() {
return !Config.config.hideInfoButtonPlayerControls && !document.URL.includes("/embed/");
}

function showInfoButton() {
return initialShowInfoButton();
}

return (
<PlayerButtonComponent
ref={ref}
baseID="info"
title="openPopup"
imageName="PlayerInfoIconSponsorBlocker.svg"
isDraggable={false}
show={showInfoButton()}
onClick={infoCallback}
></PlayerButtonComponent>
);
});
InfoButtonComponent.displayName = "InfoButtonComponent";

export default InfoButtonComponent;
8 changes: 5 additions & 3 deletions src/components/playerButtons/PlayerButtonGroupComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ConfigProvider, Popconfirm, theme } from "antd";
import * as React from "react";
import Config from "../../config";
import InfoButtonComponent from "./InfoButton";
import PlayerButtonComponent from "./playerButtonComponent";

interface PlayerButtonGroupProps {
Expand Down Expand Up @@ -31,14 +31,16 @@ function PlayerButtonGroupComponent({

return (
<ConfigProvider theme={{ token: { colorPrimary: "#00aeec" }, algorithm: theme.darkAlgorithm }}>
<PlayerButtonComponent
<InfoButtonComponent popupOpen={false} infoCallback={infoCallback}></InfoButtonComponent>

{/* <PlayerButtonComponent
baseID="info"
title="openPopup"
imageName="PlayerInfoIconSponsorBlocker.svg"
isDraggable={false}
show={!Config.config.hideInfoButtonPlayerControls && !document.URL.includes("/embed/")}
onClick={infoCallback}
></PlayerButtonComponent>
></PlayerButtonComponent> */}

<PlayerButtonComponent
baseID="submit"
Expand Down

0 comments on commit cd07d6b

Please sign in to comment.