Skip to content

Commit

Permalink
more audience display updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-flynn committed Apr 9, 2024
1 parent 1a74b49 commit bb38880
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 13 deletions.
25 changes: 25 additions & 0 deletions front-end/src/apps/audience-display/audio/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import MATCH_START from './match_start.wav';
import MATCH_AUTO from './match_auto_end_warning.wav';
import MATCH_TRANSITION from './match_auto_end.wav';
import MATCH_TELE from './match_tele_start.wav';
import MATCH_PRE_TELE from './match_tele_pre_start.wav';
import MATCH_ENDGAME from './match_end_start.wav';
import MATCH_END from './match_end.wav';
import MATCH_ABORT from './match_estop.wav';

export {
MATCH_ABORT,
MATCH_AUTO,
MATCH_TRANSITION,
MATCH_END,
MATCH_ENDGAME,
MATCH_PRE_TELE,
MATCH_START,
MATCH_TELE
};

export function initAudio(url: any): any {
const audio = new Audio(url);
audio.volume = 0.5;
return audio;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions front-end/src/apps/audience-display/displays/ad-default.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { FC } from 'react';
import { DisplayProps } from 'src/apps/audience-display/displays';

/**
* Classic audience display that handles all scenarios.
*/
export const AudDisplayDefault: FC<DisplayProps> = () => {
return null;
};
9 changes: 9 additions & 0 deletions front-end/src/apps/audience-display/displays/ad-stream.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { FC } from 'react';
import { DisplayProps } from 'src/apps/audience-display/displays';

/**
* Timer audience display that displays only the match timer and nothing else.
*/
export const AudDisplayStream: FC<DisplayProps> = () => {
return null;
};
9 changes: 9 additions & 0 deletions front-end/src/apps/audience-display/displays/ad-timer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { FC } from 'react';
import { DisplayProps } from 'src/apps/audience-display/displays';

/**
* Timer audience display that displays only the match timer and nothing else.
*/
export const AudDisplayTimer: FC<DisplayProps> = () => {
return null;
};
13 changes: 0 additions & 13 deletions front-end/src/apps/audience-display/displays/index.ts

This file was deleted.

30 changes: 30 additions & 0 deletions front-end/src/apps/audience-display/displays/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { DisplayModes } from '@toa-lib/models';
import { FC } from 'react';
import { AudDisplayDefault } from './ad-default';
import { AudDisplayTimer } from './ad-timer';
import { AudDisplayStream } from './ad-stream';

export interface DisplayProps {
id: number;
}

interface Props {
id: number;
eventKey: string | null | undefined;
mode?: DisplayModes;
}

const Displays: FC<Props> = ({ id, mode = DisplayModes.DEFAULT }) => {
switch (mode) {
case DisplayModes.DEFAULT:
return <AudDisplayDefault id={id} />;
case DisplayModes.TIMER_ONLY:
return <AudDisplayTimer id={id} />;
case DisplayModes.STREAM:
return <AudDisplayStream id={id} />;
default:
return <AudDisplayDefault id={id} />;
}
};

export default Displays;
6 changes: 6 additions & 0 deletions lib/models/src/base/Audience.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ export enum Displays {
RANKINGS = 4,
BLANK = 5
}

export enum DisplayModes {
DEFAULT = 'default',
TIMER_ONLY = 'timer-only',
STREAM = 'stream'
}

0 comments on commit bb38880

Please sign in to comment.