diff --git a/frontend/src/SolutionCaptcha.svelte b/frontend/src/SolutionCaptcha.svelte new file mode 100644 index 0000000..12ae47d --- /dev/null +++ b/frontend/src/SolutionCaptcha.svelte @@ -0,0 +1,20 @@ + + +
+

Úlohu zatím nemáš vyřešenou, opravdu si chceš vyzradit řešení?

+ {a} + {b} = newValue(+e.currentTarget.value)}> +
diff --git a/frontend/src/TaskDisplay.svelte b/frontend/src/TaskDisplay.svelte index 9700a57..087f211 100644 --- a/frontend/src/TaskDisplay.svelte +++ b/frontend/src/TaskDisplay.svelte @@ -5,14 +5,17 @@ import App from "./App.svelte"; import { taskStatuses } from "./task-status-cache"; import type { TaskDescriptor } from "./tasks"; -import Odevzdavatko from "./Odevzdavatko.svelte"; + import Odevzdavatko from "./Odevzdavatko.svelte"; + import SolutionCaptcha from "./SolutionCaptcha.svelte"; export let task: TaskDescriptor | null | undefined + let wantsSolution = false export let showSolution: boolean = false $: { task showSolution = false + wantsSolution = false } let referenceId: string | null @@ -33,6 +36,14 @@ import Odevzdavatko from "./Odevzdavatko.svelte"; updateLoginUrl() window.addEventListener("onhashchange", updateLoginUrl) + function maybeShowSolution() { + if (status && status.points > status.maxPoints - 0.01) { + showSolution = true + } else { + wantsSolution = true + } + } +