diff --git a/src/modules/pre-stream/pre-stream-deep-dip.tsx b/src/modules/pre-stream/pre-stream-deep-dip.tsx index 98c30a8..f60a084 100644 --- a/src/modules/pre-stream/pre-stream-deep-dip.tsx +++ b/src/modules/pre-stream/pre-stream-deep-dip.tsx @@ -1,9 +1,7 @@ import * as React from 'react'; import clsx from 'clsx'; -import { useClock } from '~/lib/hooks/use-clock'; import { useOnMount } from '~/lib/hooks/use-on-mount'; import { DeepDip2Leaderboard } from '../deep-dip/leaderboard'; -import { useOverlayData } from '../overlay-data/use-overlay-data'; import { SceneWrapper } from '../scenes/scene-wrapper'; import { DD2Logo } from '../deep-dip/dd2-logo'; import { PreStreamSceneProps } from './pre-stream-scene'; @@ -13,26 +11,7 @@ import { PrestreamCountdown } from './pre-stream-countdown'; import { PrestreamDate } from './pre-stream-date'; export function PreStreamDeepDipScene({ headerText, variant }: PreStreamSceneProps) { - const time = useClock(); const [isClientReady, setIsClientReady] = React.useState(false); - const { overlayData } = useOverlayData(); - - const streamStart = React.useMemo( - () => (overlayData?.streamStart ? new Date(overlayData.streamStart) : undefined), - [overlayData?.streamStart], - ); - - const isAnimationActive = React.useMemo(() => { - if (variant !== 'pre-stream' && variant !== 'pre-stream-cerveza') { - return false; - } - - if (streamStart) { - return time.toISOString() >= streamStart.toISOString(); - } - - return false; - }, [streamStart, time, variant]); useOnMount(() => { setIsClientReady(true); @@ -96,20 +75,13 @@ export function PreStreamDeepDipScene({ headerText, variant }: PreStreamScenePro const renderWipeUpperLayer = () => { if (isClientReady) { - return ( - - ); + return ; } }; const renderWipeLowerLayer = () => { if (isClientReady) { - return ( - - ); + return ; } }; diff --git a/src/modules/pre-stream/pre-stream-scene.tsx b/src/modules/pre-stream/pre-stream-scene.tsx index 9e913c1..91f2c5f 100644 --- a/src/modules/pre-stream/pre-stream-scene.tsx +++ b/src/modules/pre-stream/pre-stream-scene.tsx @@ -1,8 +1,6 @@ /* eslint-disable no-negated-condition */ import * as React from 'react'; -import { useClock } from '~/lib/hooks/use-clock'; import { useOnMount } from '~/lib/hooks/use-on-mount'; -import { useOverlayData } from '../overlay-data/use-overlay-data'; import { SceneWrapper } from '../scenes/scene-wrapper'; import { useCurrentStream } from './utils/stream-schedule'; import { PrestreamCountdown } from './pre-stream-countdown'; @@ -17,28 +15,9 @@ export interface PreStreamSceneProps { } export function PreStreamScene({ headerText, variant = 'pre-stream' }: PreStreamSceneProps) { - const time = useClock(); const [isClientReady, setIsClientReady] = React.useState(false); - const { overlayData } = useOverlayData(); const { currentStream } = useCurrentStream(); - const streamStart = React.useMemo( - () => (overlayData?.streamStart ? new Date(overlayData.streamStart) : undefined), - [overlayData?.streamStart], - ); - - const isAnimationActive = React.useMemo(() => { - if (variant !== 'pre-stream' && variant !== 'pre-stream-cerveza') { - return false; - } - - if (streamStart) { - return time.toISOString() >= streamStart.toISOString(); - } - - return false; - }, [streamStart, time, variant]); - useOnMount(() => { setIsClientReady(true); }); @@ -96,20 +75,13 @@ export function PreStreamScene({ headerText, variant = 'pre-stream' }: PreStream const renderWipeUpperLayer = () => { if (isClientReady) { - return ( - - ); + return ; } }; const renderWipeLowerLayer = () => { if (isClientReady) { - return ( - - ); + return ; } }; diff --git a/src/modules/pre-stream/pre-stream-wipe-lower-layer.tsx b/src/modules/pre-stream/pre-stream-wipe-lower-layer.tsx index 6be1c42..c41d858 100644 --- a/src/modules/pre-stream/pre-stream-wipe-lower-layer.tsx +++ b/src/modules/pre-stream/pre-stream-wipe-lower-layer.tsx @@ -1,20 +1,24 @@ import * as React from 'react'; import { Transition } from '@headlessui/react'; import clsx from 'clsx'; +import { useAnimateStart } from './utils/use-animate-start'; +import { PreStreamVariants } from './types'; interface PreStreamWipeLowerLayerProps { className?: string; - isVisible?: boolean; + variant?: PreStreamVariants; } export function PreStreamWipeLowerLayer({ className, - isVisible = false, + variant = 'pre-stream', }: PreStreamWipeLowerLayerProps) { + const isAnimationActive = useAnimateStart(variant); + return ( <>
- + +
- {cerveza ? ( + {variant === 'pre-stream-cerveza' ? ( (overlayData?.streamStart ? new Date(overlayData.streamStart) : undefined), + [overlayData?.streamStart], + ); + + const isAnimationActive = useMemo(() => { + if (variant !== 'pre-stream' && variant !== 'pre-stream-cerveza') { + return false; + } + + if (streamStart) { + return time.toISOString() >= streamStart.toISOString(); + } + + return false; + }, [streamStart, time, variant]); + + return isAnimationActive; +}