feat: sentence trainer custom prompt

resolves #162
This commit is contained in:
2025-02-14 15:31:17 +01:00
parent f319714489
commit fb5959998a
2 changed files with 24 additions and 9 deletions

View File

@@ -30,8 +30,6 @@
return a + (b - a) * t;
}
$inspect(chords);
$effect(() => {
const [chord] = chords;
if (!chord) return;

View File

@@ -11,7 +11,8 @@
import { onMount } from "svelte";
import TrackText from "$lib/charrecorder/TrackText.svelte";
import { browser } from "$app/environment";
import { expoIn, expoOut } from "svelte/easing";
import { expoOut } from "svelte/easing";
import { goto } from "$app/navigation";
function viaLocalStorage<T>(key: string, initial: T) {
try {
@@ -66,18 +67,18 @@
let idleTimeout: ReturnType<typeof setTimeout> | null = null;
let cooldown = $state(false);
onMount(() => {
selectNextWord();
});
$effect(() => {
if (wpm > bestWPM) {
bestWPM = wpm;
}
});
$effect(() => {
if (browser && $page.url.searchParams) {
selectNextWord();
}
});
$effect(() => {
localStorage.setItem("idle-timeout", idleTime.toString());
});
@@ -219,6 +220,15 @@
<div>
<h1>Sentence Trainer</h1>
<input
type="text"
value={inputSentence}
onchange={(it) => {
const params = new URLSearchParams(window.location.search);
params.set("sentence", (it.target as HTMLInputElement).value);
goto(`?${params.toString()}`);
}}
/>
<div class="levels">
{#each masteryThresholds as [, , title], i}
@@ -577,4 +587,11 @@
opacity: 1;
}
}
input[type="text"] {
background: none;
color: inherit;
font: inherit;
border: none;
}
</style>