-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87a786e
commit 5a00452
Showing
16 changed files
with
141 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 16 additions & 13 deletions
29
front-end/src/apps/audience-display/displays/ad-default.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { FC } from 'react'; | ||
import { DisplayProps } from 'src/apps/audience-display/displays'; | ||
import { DisplayModeProps } from 'src/apps/audience-display/displays'; | ||
|
||
/** | ||
* Timer audience display that displays only the match timer and nothing else. | ||
*/ | ||
export const AudDisplayStream: FC<DisplayProps> = () => { | ||
export const AudDisplayStream: FC<DisplayModeProps> = () => { | ||
return null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { FC } from 'react'; | ||
import { DisplayProps } from 'src/apps/audience-display/displays'; | ||
import { DisplayModeProps } from 'src/apps/audience-display/displays'; | ||
|
||
/** | ||
* Timer audience display that displays only the match timer and nothing else. | ||
*/ | ||
export const AudDisplayTimer: FC<DisplayProps> = () => { | ||
export const AudDisplayTimer: FC<DisplayModeProps> = () => { | ||
return null; | ||
}; |
33 changes: 33 additions & 0 deletions
33
front-end/src/apps/audience-display/displays/display-switcher.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
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 DisplayModeProps { | ||
id: number; | ||
eventKey: string | null | undefined; | ||
} | ||
|
||
interface Props { | ||
id: number; | ||
eventKey: string | null | undefined; | ||
mode?: DisplayModes; | ||
} | ||
|
||
export const DisplaySwitcher: FC<Props> = ({ | ||
id, | ||
mode = DisplayModes.DEFAULT, | ||
eventKey | ||
}) => { | ||
switch (mode) { | ||
case DisplayModes.DEFAULT: | ||
return <AudDisplayDefault id={id} eventKey={eventKey} />; | ||
case DisplayModes.TIMER_ONLY: | ||
return <AudDisplayTimer id={id} eventKey={eventKey} />; | ||
case DisplayModes.STREAM: | ||
return <AudDisplayStream id={id} eventKey={eventKey} />; | ||
default: | ||
return <AudDisplayDefault id={id} eventKey={eventKey} />; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { FC } from 'react'; | ||
import { Event, Match, Ranking } from '@toa-lib/models'; | ||
import * as FRCDefault from './seasons/frc_default'; | ||
import * as FGCDefault from './seasons/fgc_default'; | ||
|
||
export interface DisplayProps { | ||
event: Event; | ||
match: Match<any>; | ||
ranks: Ranking[]; | ||
} | ||
|
||
interface SeasonDisplay { | ||
matchPreview: FC<DisplayProps>; | ||
matchPlay: FC<DisplayProps>; | ||
matchResults: FC<DisplayProps>; | ||
} | ||
|
||
export const frcDefault: SeasonDisplay = { | ||
matchPlay: FRCDefault.MatchPlay, | ||
matchPreview: FRCDefault.MatchPreview, | ||
matchResults: FRCDefault.MatchResults | ||
}; | ||
|
||
export const fgcDefault: SeasonDisplay = { | ||
matchPlay: FGCDefault.MatchPlay, | ||
matchPreview: FGCDefault.MatchPreview, | ||
matchResults: FGCDefault.MatchResults | ||
}; | ||
|
||
// Map that contains all the displays for their seasons. | ||
export const displayMap: Map<string, SeasonDisplay> = new Map(); | ||
displayMap.set('frc_default', frcDefault); | ||
displayMap.set('fgc_default', fgcDefault); | ||
|
||
const getDefaultDisplay = (seasonKey: string): SeasonDisplay => { | ||
const program = seasonKey.substring(0, 3); | ||
if (program === 'frc') { | ||
return frcDefault; | ||
} else if (program === 'fgc') { | ||
return fgcDefault; | ||
} | ||
return frcDefault; | ||
}; | ||
|
||
export const getDisplays = (seasonKey: string): SeasonDisplay => { | ||
const displays = displayMap.get(seasonKey); | ||
return displays ? displays : getDefaultDisplay(seasonKey); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,5 @@ | ||
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'; | ||
import { DisplaySwitcher, DisplayModeProps } from './display-switcher'; | ||
import { DisplayProps } from './displays'; | ||
|
||
export interface DisplayProps { | ||
id: number; | ||
eventKey: string | null | undefined; | ||
} | ||
|
||
interface Props { | ||
id: number; | ||
eventKey: string | null | undefined; | ||
mode?: DisplayModes; | ||
} | ||
|
||
const Displays: FC<Props> = ({ id, mode = DisplayModes.DEFAULT, eventKey }) => { | ||
switch (mode) { | ||
case DisplayModes.DEFAULT: | ||
return <AudDisplayDefault id={id} eventKey={eventKey} />; | ||
case DisplayModes.TIMER_ONLY: | ||
return <AudDisplayTimer id={id} eventKey={eventKey} />; | ||
case DisplayModes.STREAM: | ||
return <AudDisplayStream id={id} eventKey={eventKey} />; | ||
default: | ||
return <AudDisplayDefault id={id} eventKey={eventKey} />; | ||
} | ||
}; | ||
|
||
export default Displays; | ||
export { DisplaySwitcher }; | ||
export type { DisplayModeProps, DisplayProps }; |
5 changes: 5 additions & 0 deletions
5
front-end/src/apps/audience-display/displays/seasons/fgc_default/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { MatchPreview } from './match-preview'; | ||
import { MatchPlay } from './match-play'; | ||
import { MatchResults } from './match-results'; | ||
|
||
export { MatchPreview, MatchPlay, MatchResults }; |
6 changes: 6 additions & 0 deletions
6
front-end/src/apps/audience-display/displays/seasons/fgc_default/match-play.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { FC } from 'react'; | ||
import { DisplayProps } from '../../displays'; | ||
|
||
export const MatchPlay: FC<DisplayProps> = () => { | ||
return <div>FGC Match Play</div>; | ||
}; |
6 changes: 6 additions & 0 deletions
6
front-end/src/apps/audience-display/displays/seasons/fgc_default/match-preview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { FC } from 'react'; | ||
import { DisplayProps } from '../../displays'; | ||
|
||
export const MatchPreview: FC<DisplayProps> = () => { | ||
return <div>FGC Match Preview</div>; | ||
}; |
6 changes: 6 additions & 0 deletions
6
front-end/src/apps/audience-display/displays/seasons/fgc_default/match-results.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { FC } from 'react'; | ||
import { DisplayProps } from '../../displays'; | ||
|
||
export const MatchResults: FC<DisplayProps> = () => { | ||
return <div>FGC Match Results</div>; | ||
}; |
37 changes: 0 additions & 37 deletions
37
...src/apps/audience-display/displays/seasons/frc_default/components/match-timer-display.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
front-end/src/apps/audience-display/displays/seasons/frc_default/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { MatchPlay } from './match-play'; | ||
import { MatchPreview } from './match-preview'; | ||
import { MatchResults } from './match-results'; | ||
|
||
export { MatchPlay, MatchPreview, MatchResults }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters