config and ffmpeg bootstrap

This commit is contained in:
2026-05-11 23:48:23 +03:00
parent 472aa6f9ec
commit c64ec2045e
15 changed files with 8710 additions and 68 deletions
+34 -56
View File
@@ -1,61 +1,39 @@
<script lang="ts">
let recording = $state(false)
import { onMount } from "svelte"
import { api, type AppStatus } from "./lib/api"
import Loading from "./lib/Loading.svelte"
import Bootstrap from "./lib/Bootstrap.svelte"
import FirstRun from "./lib/FirstRun.svelte"
import Main from "./lib/Main.svelte"
function toggle() {
recording = !recording
type View = "loading" | "bootstrap" | "first-run" | "main"
let view: View = $state("loading")
async function refresh() {
view = "loading"
let status: AppStatus
try {
status = await api.getStatus()
} catch (e) {
console.error("get_status failed", e)
view = "bootstrap"
return
}
if (status.ffmpeg === "missing") view = "bootstrap"
else if (status.needs_first_run) view = "first-run"
else view = "main"
}
onMount(refresh)
</script>
<main>
<header>
<h1>ByteSize</h1>
<p>screen-to-clip recorder</p>
</header>
<section class="controls">
<button onclick={toggle} class:active={recording}>
{recording ? "stop" : "start"}
</button>
</section>
</main>
<style>
main {
padding: 1.5rem;
max-width: 480px;
margin: 0 auto;
}
header h1 {
margin: 0 0 0.25rem;
font-size: 1.5rem;
letter-spacing: -0.01em;
}
header p {
margin: 0 0 1.5rem;
color: #888;
font-size: 0.875rem;
}
.controls {
display: flex;
gap: 0.5rem;
}
button {
font: inherit;
padding: 0.5rem 1rem;
border: 1px solid currentColor;
background: transparent;
color: inherit;
cursor: pointer;
border-radius: 4px;
}
button.active {
background: #c33;
border-color: #c33;
color: white;
}
</style>
{#if view === "loading"}
<Loading />
{:else if view === "bootstrap"}
<Bootstrap onReady={refresh} />
{:else if view === "first-run"}
<FirstRun onDone={refresh} />
{:else}
<Main />
{/if}