Skip to content

Commit

Permalink
Stash
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Sep 9, 2024
1 parent fdc790f commit bae707e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/components/playerButtons/PlayerButtonGroupComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ function PlayerButtonGroupComponent({
submitCallback,
infoCallback,
}: PlayerButtonGroupProps) {
const [sponsorTimesSubmitting, setSponsorTimesSubmitting] = React.useState([]);

React.useEffect(() => {
const handleShowInfoButton = (e: CustomEvent) => setSponsorTimesSubmitting(e.detail);
window.addEventListener("sponsorTimesSubmittingChange", handleShowInfoButton);
return () => window.removeEventListener("sponsorTimesSubmittingChange", handleShowInfoButton);
}, []);

function isSegmentCreationInProgress(): boolean {

Check failure on line 30 in src/components/playerButtons/PlayerButtonGroupComponent.tsx

View workflow job for this annotation

GitHub Actions / Create artifacts

'isSegmentCreationInProgress' is defined but never used
const segment = sponsorTimesSubmitting[sponsorTimesSubmitting.length - 1];
return segment && segment?.segment?.length !== 2;
}

function getPopconfirmDescription() {
const message = chrome.i18n.getMessage("confirmMSG").split("\n");
return (
Expand All @@ -35,15 +48,6 @@ function PlayerButtonGroupComponent({
<div style={{ display: Config.config.hideVideoPlayerControls ? "none" : "contents" }}>
<InfoButtonComponent 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
baseID="submit"
title="OpenSubmissionMenu"
Expand Down
2 changes: 2 additions & 0 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,8 @@ function updateEditButtonsOnPlayer(): void {
// Don't try to update the buttons if we aren't on a Bilibili video page
if (!getVideoID()) return;

window.dispatchEvent(new CustomEvent("sponsorTimesSubmittingChange", { detail: sponsorTimesSubmitting }));

const creatingSegment = isSegmentCreationInProgress();
// Show only if there are any segments to submit
const submitButtonVisible = sponsorTimesSubmitting.length > 0;
Expand Down

0 comments on commit bae707e

Please sign in to comment.