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

Muti queue updates #63

Merged
merged 18 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# You can update this to suit your local development environment. Match info should be hosted by a different server
# since the dev server isn't keen to do it itself
PREACT_APP_RTDB_URL=https://your-rtdb-instance.firebaseio.com/
PREACT_APP_FIRE_KEY=your-key
PREACT_APP_FIRE_PROJ=your-project
PREACT_APP_FIRE_APPID=your-app-id
PREACT_APP_FIRE_MEASUREID=your-analytics-id
PREACT_APP_SIGNALR_SERVER=https://fim-admin.evandoes.dev # or remove
APP_RTDB_URL=https://your-rtdb-instance.firebaseio.com/
APP_FIRE_KEY=your-key
APP_FIRE_PROJ=your-project
APP_FIRE_APPID=your-app-id
APP_FIRE_MEASUREID=your-analytics-id
APP_SIGNALR_SERVER=https://fim-admin.evandoes.dev # or remove
17 changes: 4 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,16 @@ module.exports = {
env: {
es6: true,
},
extends: [
'airbnb',
'airbnb-typescript',
],
extends: ['airbnb', 'airbnb-typescript'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['tsconfig.eslint.json'],
sourceType: 'module',
},
ignorePatterns: [
'/functions/lib/**/*',
'/build/**/*',
'**/node_modules',
],
plugins: [
'@typescript-eslint',
'import',
],
ignorePatterns: ['/functions/lib/**/*', '/build/**/*', '**/node_modules'],
plugins: ['@typescript-eslint', 'import'],
rules: {
'linebreak-style': 'off',
'no-console': 'off',
'import/extensions': [
'error',
Expand Down
46 changes: 42 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"build": "vite build",
"serve": "sirv build --port 8080 --cors --single",
"dev": "vite",
"lint": "eslint './src/**/*.{js,jsx,ts,tsx}' './functions/src/**/*.{js,ts}'"
"lint": "eslint './src/**/*.{js,jsx,ts,tsx}' './functions/src/**/*.{js,ts}'",
"lint-win": "eslint src/ functions/"
},
"dependencies": {
"@gmurph91/react-textfit": "^1.1.4",
"@microsoft/signalr": "^7.0.7",
"@preact/preset-vite": "^2.5.0",
"@react-spring/web": "^9.7.3",
Expand All @@ -31,6 +33,7 @@
"@types/color": "^3.0.3",
"@types/js-cookie": "^3.0.3",
"@types/react": "^18.2.14",
"@types/react-textfit": "^1.1.4",
"@types/styled-components": "^5.1.26",
"babel-plugin-module-resolver": "^5.0.0",
"dotenv-webpack": "^7.1.0",
Expand Down
68 changes: 42 additions & 26 deletions shared/DbTypes.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,65 @@
import { BracketMatchNumber } from './DoubleEliminationBracketMapping';

export type EventState = 'Pending' | 'AwaitingQualSchedule' | 'QualsInProgress'
| 'AwaitingAlliances' | 'PlayoffsInProgress' | 'EventOver';
export type EventState =
| 'Pending'
| 'AwaitingQualSchedule'
| 'QualsInProgress'
| 'AwaitingAlliances'
| 'PlayoffsInProgress'
| 'EventOver';

export type AppMode = 'automatic' | 'assisted';

export type Event = {
// TODO: temporary
dataSource?: string,
start: string,
end: string,
name: string,
eventCode: string,
currentMatchNumber: number | null,
playoffMatchNumber: BracketMatchNumber | null
dataSource?: string;
start: string;
end: string;
name: string;
nameShort?: string;
eventCode: string;
currentMatchNumber: number | null;
playoffMatchNumber: BracketMatchNumber | null;
streamEmbedLink?: string;
numQualMatches: number | null,
mode: AppMode,
state: EventState,
numQualMatches: number | null;
mode: AppMode;
state: EventState;
/**
* The timestamp of the most recent data we have from the FRC API, in ms since
* the Unix epoch. This number will only ever stay the same or get bigger
*/
lastModifiedMs: number | null,
lastModifiedMs: number | null;
message?: string;
options: {
showRankings: boolean,
showEventName: boolean,
maxQueueingToShow?: number,
},
sponsorLogoUrl?: string,
showRankings: boolean;
showEventName: boolean;
maxQueueingToShow?: number;
};
branding?: {
logo: string;
bgColor: string;
textColor: string;
};
};

export type DriverStation = 'Red1' | 'Red2' | 'Red3' | 'Blue1' | 'Blue2'
| 'Blue3';
export type DriverStation =
| 'Red1'
| 'Red2'
| 'Red3'
| 'Blue1'
| 'Blue2'
| 'Blue3';

export type PlayoffMatch = {
winner: 'red' | 'blue' | null,
participants: Record<DriverStation, number>,
redAlliance: number | null,
blueAlliance: number | null
winner: 'red' | 'blue' | null;
participants: Record<DriverStation, number>;
redAlliance: number | null;
blueAlliance: number | null;
};

export type QualMatch = {
number: number,
participants: Record<DriverStation, number>,
number: number;
participants: Record<DriverStation, number>;
};

export type Break = {
Expand Down
33 changes: 33 additions & 0 deletions src/components/MultiDisplay/EventRow/AllianceFader/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { h } from 'preact';
import styles from './styles.module.scss';

const AllianceFader = ({
red,
blue,
showLine,
}: {
red: string;
blue: string;
showLine: 0 | 1;
}) => (
<div className={styles.faderBase}>
<div
className={styles.red}
style={{
opacity: showLine ? 0 : 1,
}}
>
R: {red}
</div>
<div
className={styles.blue}
style={{
opacity: showLine,
}}
>
B: {blue}
</div>
</div>
);

export default AllianceFader;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

$teamlist-size: 5.5vh;

.faderBase {

display: flex;
flex-direction: column;
// Center items
justify-content: center;
align-items: center;

&> div {
position: absolute;
transition: all ease .5s;
text-align: center;
width: 30vw;
font-weight: bold;
border-radius: 1em;
font-size: $teamlist-size;
}
}

.red {
background: rgba(255, 0, 0, .5);
}

.blue {
background: rgba(84, 84, 255, .5);
}
56 changes: 56 additions & 0 deletions src/components/MultiDisplay/EventRow/MessageRow/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { h } from 'preact';
import { Event } from '@shared/DbTypes';
// @ts-ignore
import { Textfit } from '@gmurph91/react-textfit';
import styles from './styles.module.scss';

const MessageRow = ({ event, showLine }: { event: Event; showLine: 0 | 1 }) => (
<div
className={styles.messageContainer}
style={event.message ? { left: 0 } : {}}
>
<div
className={styles.messageMover}
style={{
color: event.branding?.textColor,
backgroundColor: event.branding?.bgColor,
}}
>
{/* Logo/Event Name Short Fader */}
<div className={styles.faderContainer}>
{/* Logo */}
<div style={{ opacity: !event.branding?.logo ? 0 : showLine }}>
<img
src={event.branding?.logo}
alt={event.name}
className={styles.sponsorLogo}
/>
</div>
{/* Text */}
<span
className={`${styles.textCenter} ${styles.bold}`}
// eslint-disable-next-line no-nested-ternary
style={{ opacity: !event.branding?.logo ? 1 : showLine ? 0 : 1 }}
>
<Textfit
mode="single"
forceSingleModeWidth={false}
max="300"
style={{ height: '22vh', width: '25vw' }}
>
{event.nameShort || event.name}
</Textfit>
</span>
</div>

{/* Message */}
<span className={styles.messageText}>
<Textfit mode="single" forceSingleModeWidth max="300">
{event.message || event.name}
</Textfit>
</span>
</div>
</div>
);

export default MessageRow;
Loading
Loading