Skip to content

Commit 730f7a9

Browse files
committed
Add page for FRC Nexus and add feature flag to disable legacy sync
1 parent cd57422 commit 730f7a9

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ node_modules
66
.firebase/hosting.*.cache
77
functions/*-debug.log
88
size-plugin.json
9+
.idea

functions/src/updateCurrentMatch.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@ import GenericApiClient from './api/GenericApiClient';
66
const functions = require('firebase-functions');
77
const admin = require('firebase-admin');
88

9-
// const { get } = require('./helpers/frcEventsApiClient');
109
const { updateQualSchedule } = require('./helpers/schedule');
1110
const {
1211
updatePlayoffBracket,
1312
} = require('./helpers/playoffs');
1413

1514
exports.updateCurrentMatch = async function updateCurrentMatch() {
15+
try {
16+
const enabled = (await admin.database().ref('/features/legacySync').get()).val();
17+
18+
if (enabled === false) return;
19+
} catch (_) {
20+
// pass, best to fall back to still syncing
21+
}
22+
1623
const season = (await admin.database().ref('/current_season').get())
1724
.val();
1825

src/components/Embeddable/styles.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.embeddable {
2-
height: 100vh;
2+
flex-grow: 1;
33

44
>div:last-child {
5-
height: 100vh;
5+
height: 100%;
66
}
77

88
iframe {

src/routes.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Embeddable, { EmbeddableRouteParams } from './components/Embeddable';
88
import PlayoffBracket from './components/PlayoffBracket';
99
import PlayoffQueueing from './components/PlayoffQueueing/Queueing';
1010
import Queueing from './components/QualDisplay/Queueing';
11-
// import KeyableTicker from './components/RankingDisplay/KeyableTicker';
1211
import TeamRankings from './components/RankingDisplay/TeamRankings';
1312
import UserLogin from './components/Manage/UserLogin';
1413
import Options from './components/Manage/Options';
@@ -62,12 +61,6 @@ const Routes: Route<any>[] = [
6261
component: PlayoffBracket,
6362
usedIn: ['playoff'],
6463
},
65-
// {
66-
// name: 'Rankings Ticker (Audience Display)',
67-
// url: '/ranking/ticker',
68-
// component: KeyableTicker,
69-
// usedIn: [],
70-
// },
7164
{
7265
name: 'FRC Pit Display',
7366
url: '/frcpitdisplay',
@@ -83,7 +76,20 @@ const Routes: Route<any>[] = [
8376
component: Embeddable,
8477
usedIn: ['qual', 'playoff'],
8578
params: {
86-
iframeUrl: (_, evt) => evt.streamEmbedLink?.replace('%HOST%', window?.location?.host),
79+
iframeUrl: (_, evt) => evt.streamEmbedLink?.replace('%HOST%', window?.location?.hostname),
80+
},
81+
} as Route<EmbeddableRouteParams>,
82+
{
83+
name: 'Nexus for FRC',
84+
url: '/nexus',
85+
component: Embeddable,
86+
usedIn: ['qual', 'playoff'],
87+
params: {
88+
iframeUrl: (season, evt) => `https://frc.nexus/en/event/${
89+
/^\d/.test(evt.eventCode)
90+
? evt.eventCode.toLowerCase()
91+
: `${season}${evt.eventCode.toLowerCase()}`
92+
}/display/pit`,
8793
},
8894
} as Route<EmbeddableRouteParams>,
8995
{

0 commit comments

Comments
 (0)