Skip to content

Commit ba948cd

Browse files
authored
Add support for displaying unplayed yet matches (#6)
* Update preview sc in readme to include PUN 🌲 * Update asset name * add support for displaying unplayed matches
1 parent 1f0c931 commit ba948cd

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

package-lock.json

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

src/extension.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function parseStandings(standings: Standing[]) {
6262
}
6363

6464
function standingComponent(standing: Standing) {
65-
return /*html*/ `
65+
return /*html*/ `
6666
<tr>
6767
<td class="team-info">
6868
<div class="image-wrapper">
@@ -93,9 +93,11 @@ function parseLastResults(lastResults: MATCH_RESULT[]) {
9393
}
9494

9595
function dotComponent(result: MATCH_RESULT) {
96-
return /*html*/ `
97-
<div class="dot" style="background-color: #${resultToColor(result)}"></div>
98-
`;
96+
return /*html*/ `<div class="${
97+
result === MATCH_RESULT.UNKNOWN ? "empty-dot" : "dot"
98+
}" style="${
99+
result === MATCH_RESULT.UNKNOWN ? "border-color" : "background-color"
100+
}: #${resultToColor(result)}"></div>`;
99101
}
100102

101103
function resultToColor(result: MATCH_RESULT) {
@@ -106,6 +108,10 @@ function resultToColor(result: MATCH_RESULT) {
106108
return "A5A5A5";
107109
case MATCH_RESULT.WON:
108110
return "00E100";
111+
case MATCH_RESULT.UNKNOWN:
112+
return "A5A5A5";
113+
default:
114+
return "A5A5A5";
109115
}
110116
}
111117

@@ -118,7 +124,7 @@ function styles() {
118124
margin-right: 10%;
119125
width: 80%;
120126
}
121-
}
127+
}
122128
table {
123129
border-collapse: collapse;
124130
width: 100%;
@@ -142,7 +148,7 @@ function styles() {
142148
justify-content: center;
143149
margin-right: 8px;
144150
}
145-
.img {
151+
.img {
146152
width: auto;
147153
height: auto;
148154
}
@@ -156,6 +162,13 @@ function styles() {
156162
width: 15px;
157163
border-radius: 50%;
158164
}
165+
.empty-dot {
166+
height: 13px;
167+
width: 13px;
168+
border-radius: 50%;
169+
border-style: solid;
170+
border-width: 2px;
171+
}
159172
</style>
160173
`;
161174
}

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export enum MATCH_RESULT {
22
LOST = 0,
33
DRAW = 1,
44
WON = 2,
5+
UNKNOWN = 3,
56
}
67

78
export type Standing = {

0 commit comments

Comments
 (0)