Skip to content

Commit 162e93e

Browse files
committed
add flash timer style
1 parent 04d9ed2 commit 162e93e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

frontend/src/ts/test/timer-progress.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,17 @@ export function update(): void {
124124
if (textEl !== null) {
125125
textEl.innerHTML = "<div>" + displayTime + "</div>";
126126
}
127+
} else if (Config.timerStyle === "flash") {
128+
let displayTime = DateTime.secondsToString(maxtime - time);
129+
if (maxtime === 0) {
130+
displayTime = DateTime.secondsToString(time);
131+
}
132+
if (textEl !== null) {
133+
textEl.innerHTML =
134+
"<div>" +
135+
`${parseInt(displayTime) % 15 !== 0 ? "" : displayTime}` +
136+
"</div>";
137+
}
127138
} else if (Config.timerStyle === "mini") {
128139
let displayTime = DateTime.secondsToString(maxtime - time);
129140
if (maxtime === 0) {
@@ -163,6 +174,12 @@ export function update(): void {
163174
} else {
164175
textEl.innerHTML = `<div>${getCurrentCount()}/${outof}</div>`;
165176
}
177+
} else if (Config.timerStyle === "flash") {
178+
if (outof === 0) {
179+
textEl.innerHTML = `<div>${TestInput.input.getHistory().length}</div>`;
180+
} else {
181+
textEl.innerHTML = `<div>${getCurrentCount()}/${outof}</div>`;
182+
}
166183
} else if (Config.timerStyle === "mini") {
167184
if (outof === 0) {
168185
miniEl.innerHTML = `${TestInput.input.getHistory().length}`;
@@ -173,6 +190,8 @@ export function update(): void {
173190
} else if (Config.mode === "zen") {
174191
if (Config.timerStyle === "text") {
175192
textEl.innerHTML = `<div>${TestInput.input.getHistory().length}</div>`;
193+
} else if (Config.timerStyle === "flash") {
194+
textEl.innerHTML = `<div>${TestInput.input.getHistory().length}</div>`;
176195
} else {
177196
miniEl.innerHTML = `${TestInput.input.getHistory().length}`;
178197
}

packages/schemas/src/configs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export type ConfidenceMode = z.infer<typeof ConfidenceModeSchema>;
5454
export const IndicateTyposSchema = z.enum(["off", "below", "replace", "both"]);
5555
export type IndicateTypos = z.infer<typeof IndicateTyposSchema>;
5656

57-
export const TimerStyleSchema = z.enum(["off", "bar", "text", "mini"]);
57+
export const TimerStyleSchema = z.enum(["off", "bar", "text", "mini", "flash"]);
5858
export type TimerStyle = z.infer<typeof TimerStyleSchema>;
5959

6060
export const LiveSpeedAccBurstStyleSchema = z.enum(["off", "text", "mini"]);

0 commit comments

Comments
 (0)