fix: fix gradients changing due to new format selected

This commit is contained in:
JovannMC 2025-04-15 19:47:39 +03:00
parent 6e853276bc
commit 3ad8244e97
No known key found for this signature in database
1 changed files with 26 additions and 17 deletions

View File

@ -5,7 +5,7 @@
import Panel from "$lib/components/visual/Panel.svelte"; import Panel from "$lib/components/visual/Panel.svelte";
import ProgressBar from "$lib/components/visual/ProgressBar.svelte"; import ProgressBar from "$lib/components/visual/ProgressBar.svelte";
import Tooltip from "$lib/components/visual/Tooltip.svelte"; import Tooltip from "$lib/components/visual/Tooltip.svelte";
import { converters } from "$lib/converters"; import { converters, byNative } from "$lib/converters";
import { import {
effects, effects,
files, files,
@ -44,21 +44,30 @@
$effect(() => { $effect(() => {
// Set gradient color depending on the file types // Set gradient color depending on the file types
// TODO: if more file types added, add a "fileType" property to the file object // TODO: if more file types added, add a "fileType" property to the file object
const allAudio = files.files.every( const allAudio = files.files.every((file) => {
(file) => file.findConverter()?.name === "ffmpeg", const converter = file
); .findConverters()
const allImages = files.files.every( .sort(byNative(file.from))[0];
(file) => return converter?.name === "ffmpeg";
file.findConverter()?.name !== "ffmpeg" && });
file.findConverter()?.name !== "vertd", const allImages = files.files.every((file) => {
); const converter = file
const allVideos = files.files.every( .findConverters()
(file) => file.findConverter()?.name === "vertd", .sort(byNative(file.from))[0];
); return converter?.name === "libvips";
});
const allDocuments = files.files.every( const allVideos = files.files.every((file) => {
(file) => file.findConverter()?.name === "pandoc", const converter = file
); .findConverters()
.sort(byNative(file.from))[0];
return converter?.name === "vertd";
});
const allDocuments = files.files.every((file) => {
const converter = file
.findConverters()
.sort(byNative(file.from))[0];
return converter?.name === "pandoc";
});
if (files.files.length === 1 && files.files[0].blobUrl && !allVideos) { if (files.files.length === 1 && files.files[0].blobUrl && !allVideos) {
showGradient.set(false); showGradient.set(false);
@ -68,7 +77,7 @@
if ( if (
files.files.length === 0 || files.files.length === 0 ||
(!allAudio && !allImages && !allVideos) (!allAudio && !allImages && !allVideos && !allDocuments)
) { ) {
gradientColor.set(""); gradientColor.set("");
} else { } else {