feat: add delete button, improve loading bar contrast

This commit is contained in:
not-nullptr 2024-11-14 14:42:19 +00:00
parent 86a893209e
commit d55230f1ef
4 changed files with 23 additions and 12 deletions

View File

@ -10,9 +10,11 @@
const percent = $derived(((progress - min) / (max - min)) * 100);
</script>
<div class="w-full h-1 bg-foreground-muted rounded-full overflow-hidden">
<div
class="w-full h-1 dynadark:bg-foreground-muted-alt bg-foreground-muted rounded-full overflow-hidden"
>
<div
class="h-full bg-accent-background"
class="h-full bg-accent-background dynadark:bg-accent-foreground"
style="width: {percent}%; transition: 500ms linear width;"
></div>
</div>

View File

@ -45,10 +45,6 @@ export class FFmpegConverter extends Converter {
if (!to.startsWith(".")) to = `.${to}`;
const ffmpeg = new FFmpeg();
ffmpeg.on("progress", (progress) => {
log(
["converters", this.name],
`progress for "${input.name}": ${progress.progress * 100}%`,
);
input.progress = progress.progress * 100;
});
const baseURL =

View File

@ -88,7 +88,6 @@ export class VipsConverter extends Converter {
this.worker.addEventListener("message", onMessage);
const msg = { ...message, id, worker: null };
log(["converters", this.name], `sending message`, msg);
try {
this.worker.postMessage(msg);
} catch (e) {

View File

@ -138,6 +138,11 @@
URL.revokeObjectURL(url);
a.remove();
};
const deleteAll = () => {
files.files = [];
goto("/");
};
</script>
<svelte:head>
@ -210,13 +215,15 @@
</div>
</div>
<div class="grid md:grid-cols-2 gap-3 mt-4">
<div class="flex sm:flex-row flex-col gap-3 mt-4">
<button
onclick={convertAll}
class={clsx("btn flex-grow", {
"btn-highlight": disabled,
"btn-highlight":
disabled && !processings.some((p) => p),
})}
disabled={!allConvertersReady}
disabled={!allConvertersReady ||
processings.some((p) => p)}
>
{#if allConvertersReady}
Convert {files.files.length > 1 ? "All" : ""}
@ -232,6 +239,13 @@
{disabled}
>Download {files.files.length > 1 ? "All" : ""}</button
>
<button
onclick={deleteAll}
disabled={processings.some((p) => p)}
class="btn flex-grow"
>
Delete All
</button>
</div>
</div>
<div
@ -276,7 +290,7 @@
<div class="w-full lg:flex-grow">
<div
class={clsx(
"py-2 px-3 lg:w-full lg:flex rounded-xl transition-colors duration-300 sm:w-fit w-full flex-shrink sm:text-left text-center",
"py-2 px-3 lg:justify-between lg:w-full lg:flex rounded-xl transition-colors duration-300 sm:w-fit w-full flex-shrink sm:text-left text-center",
{
"bg-accent-background text-accent-foreground":
file.result,
@ -286,7 +300,7 @@
)}
>
<h3
class="lg:flex-grow flex-shrink whitespace-nowrap overflow-hidden text-ellipsis sm:max-w-96"
class="lg:flex-grow lg:w-full flex-shrink whitespace-nowrap overflow-hidden text-ellipsis sm:max-w-96"
>
{file.file.name}
</h3>