Add support for new "disabled" derived var

This commit is contained in:
Realmy 2024-11-12 13:15:33 +01:00
commit 71736035f6
1 changed files with 5 additions and 7 deletions

View File

@ -20,6 +20,8 @@
let converter = $derived(converters.find((c) => c.name === converterName))!;
let disabled = $derived(files.files.some((f) => !f.result));
onMount(() => {
finisheds.forEach((_, i) => {
const duration = 750 + i * 50 - 32;
@ -198,19 +200,15 @@
<button
onclick={convertAll}
class={clsx("btn flex-grow", {
"btn-highlight": !files.files.find((i) => i.result),
"btn-highlight": disabled,
})}
>Convert{files.files.length > 1 ? " All" : ""}</button
>
<button
onclick={() => downloadAll}
class={clsx("btn flex-grow", {
"opacity-50 pointer-events-none": files.files.find(
(i) => !i.result,
),
"btn-highlight": !files.files.find(
(i) => !i.result,
),
"opacity-50 pointer-events-none": disabled,
"btn-highlight": !disabled,
})}
>Download{files.files.length > 1 ? " All" : ""}</button
>