This commit is contained in:
2026-10-23 03:02:55 +07:00
parent e2f8a3302e
commit 1ce8efeef5
21 changed files with 561 additions and 46 deletions
+21 -1
View File
@@ -14,6 +14,8 @@ const modes = [
'SCREEN_MODE_RESULTS',
'SCREEN_MODE_TIMER',
'SCREEN_MODE_TEXT',
'SCREEN_MODE_QR',
'SCREEN_MODE_TEAMS',
] as const satisfies readonly (ScreenMode | undefined)[]
const commands = [
'SCREEN_COMMAND_UNSPECIFIED',
@@ -40,5 +42,23 @@ export function apiScreenCommand(command: number): ScreenCommand {
return value
}
export function apiPlan(plan: ScreenPlan): Pick<SaveScreenPlanReq, 'steps' | 'currentStep'> {
return { ...plan, steps: plan.steps.map((step) => ({ ...step, mode: apiScreenMode(step.mode) })) }
return {
...plan,
steps: plan.steps.map((step) => ({
...step,
mode: apiScreenMode(step.mode),
qrUrl: step.qrUrl,
timerType: apiTimerType(step.timerType),
})),
}
}
export function apiTimerType(value = 0) {
return (
[
'SCREEN_TIMER_TYPE_BREAK',
'SCREEN_TIMER_TYPE_BEFORE_GAME',
'SCREEN_TIMER_TYPE_UNTIL_END',
] as const
)[value]!
}