diff --git a/src/components/playerButtons/PlayerButtonGroupComponent.tsx b/src/components/playerButtons/PlayerButtonGroupComponent.tsx index 7c1ee9a5..afc2338e 100644 --- a/src/components/playerButtons/PlayerButtonGroupComponent.tsx +++ b/src/components/playerButtons/PlayerButtonGroupComponent.tsx @@ -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 { + const segment = sponsorTimesSubmitting[sponsorTimesSubmitting.length - 1]; + return segment && segment?.segment?.length !== 2; + } + function getPopconfirmDescription() { const message = chrome.i18n.getMessage("confirmMSG").split("\n"); return ( @@ -35,15 +48,6 @@ function PlayerButtonGroupComponent({
- {/* */} - 0;