up
This commit is contained in:
+21
-1
@@ -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]!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user