Skip to content

Commit 27802ee

Browse files
committed
update
1 parent dfa0d7c commit 27802ee

24 files changed

Lines changed: 19962 additions & 36 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ node_modules/
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
24+
25+
# parcel
26+
.cache

client/.eslintrc.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true
5+
},
6+
"extends": [
7+
"eslint:recommended"
8+
],
9+
"globals": {
10+
"Atomics": "readonly",
11+
"SharedArrayBuffer": "readonly"
12+
},
13+
"parserOptions": {
14+
"ecmaVersion": 2018,
15+
"sourceType": "module"
16+
},
17+
"rules": {
18+
"indent": [
19+
"error",
20+
2
21+
],
22+
"linebreak-style": [
23+
"error",
24+
"windows"
25+
],
26+
"quotes": [
27+
"error",
28+
"double"
29+
],
30+
"semi": [
31+
"error",
32+
"never"
33+
]
34+
}
35+
}

client/OBScore.ts

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { emittable, receivable } from "./events"
22
import Scoreboard from "../controller/src/model/Scoreboard"
3+
import Level from "../controller/src/model/Level"
4+
import Player from "../controller/src/model/Player"
5+
import Commentator from "../controller/src/model/Commentator"
36
import io from "socket.io-client"
47

58
export default class OBS {
@@ -20,14 +23,17 @@ export default class OBS {
2023
onUpdate: (scoreboard: Scoreboard) => void,
2124
timeout = 500
2225
) {
23-
if (typeof name !== "string")
26+
if (typeof name !== "string") {
2427
throw new Error("name must be a string")
28+
}
2529

26-
if (typeof onUpdate !== "function")
30+
if (typeof onUpdate !== "function") {
2731
throw new Error("onUpdate must be a function")
32+
}
2833

29-
if (typeof timeout !== "number")
34+
if (typeof timeout !== "number") {
3035
throw new Error("timeout must be a number")
36+
}
3137

3238
this.name = name
3339
this.timeout = timeout
@@ -95,4 +101,36 @@ export default class OBS {
95101
this.sendError(event.error)
96102
})
97103
}
104+
105+
static stringifyLevel = (level: Level) => {
106+
if (!level.bracket) {
107+
return "n/a"
108+
}
109+
110+
if (!level.round) {
111+
return level.bracket.long
112+
}
113+
114+
if (level.number) {
115+
return `${level.bracket.long} ${level.round.long} ${level.number}`
116+
} else {
117+
return `${level.bracket.long} ${level.round.long}`
118+
}
119+
}
120+
121+
static stringifyPlayer = (player: Player) => {
122+
if (!player.sponsor) {
123+
return player.tag
124+
}
125+
126+
return `${player.sponsor} | ${player.tag}`
127+
}
128+
129+
static stringifyCommentator = (commentator: Commentator) => {
130+
if (!commentator.sponsor) {
131+
return commentator.tag
132+
}
133+
134+
return `${commentator.sponsor} | ${commentator.tag}`
135+
}
98136
}

client/package-lock.json

Lines changed: 199 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)