-
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
170f2fb
commit 7f3a001
Showing
7 changed files
with
163 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"scoreboard": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"visible": { | ||
"type": "boolean", | ||
"default": false | ||
} | ||
}, | ||
"required": ["visible"] | ||
}, | ||
"matchStatusPopup": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"visible": { | ||
"type": "boolean", | ||
"default": false | ||
} | ||
}, | ||
"required": ["visible"] | ||
} | ||
}, | ||
"required": ["scoreboard", "matchStatusPopup"] | ||
} |
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,15 @@ | ||
/* tslint:disable */ | ||
/** | ||
* This file was automatically generated by json-schema-to-typescript. | ||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, | ||
* and run json-schema-to-typescript to regenerate this file. | ||
*/ | ||
|
||
export interface ControlRosesFencing { | ||
scoreboard: { | ||
visible: boolean; | ||
}; | ||
matchStatusPopup: { | ||
visible: boolean; | ||
}; | ||
} |
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,49 @@ | ||
import { useOnlyReplicantValue, useReplicantValue } from "common/useReplicant"; | ||
import produce from "immer"; | ||
|
||
import type { State } from "@ystv/scores/src/common/sports/hockey"; | ||
import { Container, Title } from "@mantine/core"; | ||
import { LiveKillButtons } from "../components/liveKill"; | ||
import { ControlRosesFencing } from "common/types/control-rosesFencing"; | ||
|
||
export function RosesFencingDashboard() { | ||
const state = useOnlyReplicantValue<State>("eventState"); | ||
const [control, setControl] = useReplicantValue<ControlRosesFencing>( | ||
"control-rosesFencing" | ||
); | ||
console.log(control); | ||
if (!state) { | ||
return <b>No state...?!</b>; | ||
} | ||
if (!control) { | ||
return <b>No control...?!</b>; | ||
} | ||
|
||
return ( | ||
<Container fluid> | ||
<Title order={3}>Bout {state.segment}</Title> | ||
<LiveKillButtons | ||
name="Scoreboard" | ||
live={control.scoreboard.visible} | ||
callback={(live) => | ||
setControl( | ||
produce(control, (val) => { | ||
val.scoreboard.visible = live; | ||
}) | ||
) | ||
} | ||
/> | ||
<LiveKillButtons | ||
name="Match Status Popup" | ||
live={control.matchStatusPopup.visible} | ||
callback={(live) => | ||
setControl( | ||
produce(control, (val) => { | ||
val.matchStatusPopup.visible = live; | ||
}) | ||
) | ||
} | ||
/> | ||
</Container> | ||
); | ||
} |
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
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,62 @@ | ||
import { useOnlyReplicantValue } from "common/useReplicant"; | ||
import type { State } from "@ystv/scores/src/common/sports/hockey"; | ||
import { ControlRosesFencing } from "../../common/types/control-rosesFencing"; | ||
import { GraphicContainer } from "../common/container"; | ||
import { Scoreboard } from "../americanFootball/Scoreboard/Scoreboard"; | ||
import { useTime } from "../hooks"; | ||
import { MatchStatusPopup } from "../common/matchStatusPopup"; | ||
import { EventMeta } from "@ystv/scores/src/common/types"; | ||
|
||
function bannerMsg(round: number) { | ||
return `Bout ${round}`; | ||
} | ||
|
||
export function AllRosesFencingGraphics() { | ||
const state = useOnlyReplicantValue<State & EventMeta>("eventState"); | ||
const control = useOnlyReplicantValue<ControlRosesFencing>("control-fencing"); | ||
|
||
const now = useTime(); | ||
|
||
if (!state || !control) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<GraphicContainer> | ||
<Scoreboard | ||
homeName={state.homeTeam.abbreviation} | ||
homePrimaryColor={state.homeTeam.primaryColour} | ||
homeCrestAttachmentID={state.homeTeam.crestAttachmentID} | ||
homeScore={state.scoreHome} | ||
awayName={state.awayTeam.abbreviation} | ||
awayPrimaryColor={state.awayTeam.primaryColour} | ||
awaySecondaryColor={state.awayTeam.secondaryColour} | ||
awayCrestAttachmentID={state.awayTeam.crestAttachmentID} | ||
awayScore={state.scoreAway} | ||
time={0} | ||
isTimerShown={false} | ||
isVisible={control.scoreboard.visible} | ||
quarter={state.segment} | ||
quarterTitle={"Bout"} | ||
/> | ||
</GraphicContainer> | ||
<GraphicContainer> | ||
{control.matchStatusPopup.visible && ( | ||
<MatchStatusPopup | ||
homeName={state.homeTeam.abbreviation} | ||
homePrimaryColor={state.homeTeam.primaryColour} | ||
homeCrestAttachmentID={state.homeTeam.crestAttachmentID} | ||
homeScore={state.scoreHome} | ||
awayName={state.awayTeam.abbreviation} | ||
awayPrimaryColor={state.awayTeam.primaryColour} | ||
awaySecondaryColor={state.awayTeam.secondaryColour} | ||
awayCrestAttachmentID={state.awayTeam.crestAttachmentID} | ||
awayScore={state.scoreAway} | ||
banner={bannerMsg(state.segment)} | ||
/> | ||
)} | ||
</GraphicContainer> | ||
</> | ||
); | ||
} |