This commit is contained in:
Luc Mcgrady 2025-09-04 00:26:10 +01:00
parent c7fd7a0965
commit 1e67a773c6
No known key found for this signature in database
GPG key ID: 4F3D7A0B17CC3D9C
5 changed files with 20 additions and 20 deletions

View file

@ -11,7 +11,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
let reviewerInfo: null | ReturnType<typeof setupBottomBar> = null; let reviewerInfo: null | ReturnType<typeof setupBottomBar> = null;
onMount(() => { onMount(() => {
reviewerInfo = setupBottomBar() reviewerInfo = setupBottomBar();
}); });
</script> </script>

View file

@ -1,6 +1,6 @@
import { bridgeCommand } from "@tslib/bridgecommand";
import { writable } from "svelte/store"; import { writable } from "svelte/store";
import type { AnswerButtonInfo } from "./types"; import type { AnswerButtonInfo } from "./types";
import { bridgeCommand } from "@tslib/bridgecommand";
export function setupBottomBar() { export function setupBottomBar() {
/* /*
@ -77,7 +77,7 @@ export function setupBottomBar() {
} }
*/ */
// TODO This should probably be a "ready" command now that it is part of the actual reviewer, // TODO This should probably be a "ready" command now that it is part of the actual reviewer,
// Currently this depends on this component mounting after the reviewer which it should but seems hacky. // Currently this depends on this component mounting after the reviewer which it should but seems hacky.
// Maybe use a counter with a counter.subscribe($counter == 2 then call("ready")) // Maybe use a counter with a counter.subscribe($counter == 2 then call("ready"))
bridgeCommand("bottomReady"); bridgeCommand("bottomReady");
@ -87,4 +87,4 @@ export function setupBottomBar() {
remaining, remaining,
remainingIndex, remainingIndex,
}; };
} }

View file

@ -1,8 +1,8 @@
<script lang="ts"> <script lang="ts">
import type { Writable } from "svelte/store"; import type { Writable } from "svelte/store";
export let html: Writable<string> export let html: Writable<string>;
export let cardClass: Writable<string> export let cardClass: Writable<string>;
</script> </script>
<div id="qa" class={$cardClass}> <div id="qa" class={$cardClass}>
@ -11,6 +11,6 @@
<style lang="scss"> <style lang="scss">
#qa { #qa {
flex: 1 flex: 1;
} }
</style> </style>

View file

@ -1,18 +1,18 @@
import { writable } from "svelte/store" import { writable } from "svelte/store";
import { preloadAnswerImages } from "../../reviewer/images" import { preloadAnswerImages } from "../../reviewer/images";
export function setupReviewer() { export function setupReviewer() {
const html = writable("") const html = writable("");
const cardClass = writable("") const cardClass = writable("");
function showQuestion(q, a, cc) { function showQuestion(q, a, cc) {
html.set(q) html.set(q);
cardClass.set(cc) cardClass.set(cc);
preloadAnswerImages(a) preloadAnswerImages(a);
} }
globalThis._showAnswer = html.set globalThis._showAnswer = html.set;
globalThis._showQuestion = showQuestion globalThis._showQuestion = showQuestion;
return {html, cardClass} return { html, cardClass };
} }

View file

@ -7,12 +7,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { setupReviewer } from "./reviewer"; import { setupReviewer } from "./reviewer";
import Reviewer from "./reviewer.svelte"; import Reviewer from "./reviewer.svelte";
import "../../reviewer/reviewer.scss" import "../../reviewer/reviewer.scss";
let reviewerInfo: null | ReturnType<typeof setupReviewer> = null; let reviewerInfo: null | ReturnType<typeof setupReviewer> = null;
onMount(() => { onMount(() => {
reviewerInfo = setupReviewer() reviewerInfo = setupReviewer();
}); });
</script> </script>