Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide audience displays after match #162

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions front-end/src/apps/audience-display/displays/ad-default.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import { FC } from 'react';
import { DisplayModeProps } from 'src/apps/audience-display/displays';
import { useRecoilValue } from 'recoil';
import { matchOccurringAtom, matchOccurringRanksAtom } from 'src/stores/recoil';
import {
matchOccurringAtom,
matchOccurringRanksAtom,
matchStateAtom
} from 'src/stores/recoil';
import { useEvent } from 'src/api/use-event-data';
import { AudienceScreens, Displays, LayoutMode } from '@toa-lib/models';
import {
AudienceScreens,
Displays,
LayoutMode,
MatchState
} from '@toa-lib/models';
import { getDisplays } from './displays';
import {
FadeInOut,
Expand All @@ -20,6 +29,7 @@ import { useTeamsForEvent } from 'src/api/use-team-data';
export const AudDisplayDefault: FC<DisplayModeProps> = ({ id }) => {
const match = useRecoilValue(matchOccurringAtom);
const ranks = useRecoilValue(matchOccurringRanksAtom);
const matchState = useRecoilValue(matchStateAtom);
const [searchParams] = useSearchParams();

const { data: teams } = useTeamsForEvent(match?.eventKey);
Expand Down Expand Up @@ -92,16 +102,25 @@ export const AudDisplayDefault: FC<DisplayModeProps> = ({ id }) => {
);
}
}
const afterMatchBeforeScore =
matchState > MatchState.MATCH_IN_PROGRESS &&
matchState < MatchState.RESULTS_POSTED;

const showPreviewFull =
layout[0] === LayoutMode.FULL || layout[1] === LayoutMode.FULL;

return (
<>
{/* Displays.BLANK (show nothing) */}
{id === Displays.BLANK && <></>}

{/* Displays.MATCH_PREVIEW */}
{layout[0] === LayoutMode.FULL && (
{showPreviewFull && (
<AbsolouteLocator top={0} left={0}>
<FadeInOut in={id === Displays.MATCH_PREVIEW} duration={0.5}>
<FadeInOut
in={id === Displays.MATCH_PREVIEW || afterMatchBeforeScore}
duration={0.5}
>
<displays.matchPreview
event={event}
match={match}
Expand Down Expand Up @@ -131,7 +150,10 @@ export const AudDisplayDefault: FC<DisplayModeProps> = ({ id }) => {
{/* Displays.MATCH_START */}
{layout[1] === LayoutMode.FULL && (
<AbsolouteLocator top={0} left={0}>
<FadeInOut in={id === Displays.MATCH_START} duration={0.5}>
<FadeInOut
in={id === Displays.MATCH_START && !afterMatchBeforeScore}
duration={0.5}
>
<displays.matchPlay
event={event}
match={match}
Expand All @@ -144,7 +166,7 @@ export const AudDisplayDefault: FC<DisplayModeProps> = ({ id }) => {
{layout[1] === LayoutMode.STREAM && (
<AbsolouteLocator bottom={0} left={0}>
<SlideInBottom
in={id === Displays.MATCH_START}
in={id === Displays.MATCH_START && !afterMatchBeforeScore}
duration={1.25}
inDelay={0.75}
>
Expand Down
Loading