feat: warning when selecting animated webp/gif

This commit is contained in:
JovannMC 2025-02-11 23:49:27 +03:00
parent 8bcd7d4e5c
commit ff2e5b1866
No known key found for this signature in database
1 changed files with 14 additions and 2 deletions

View File

@ -4,7 +4,6 @@
import Uploader from "$lib/components/functional/Uploader.svelte"; import Uploader from "$lib/components/functional/Uploader.svelte";
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 { converters } from "$lib/converters";
import { import {
effects, effects,
files, files,
@ -12,6 +11,7 @@
showGradient, showGradient,
vertdLoaded, vertdLoaded,
} from "$lib/store/index.svelte"; } from "$lib/store/index.svelte";
import { addToast } from "$lib/store/ToastProvider";
import { VertFile } from "$lib/types"; import { VertFile } from "$lib/types";
import { import {
AudioLines, AudioLines,
@ -26,6 +26,18 @@
XIcon, XIcon,
} from "lucide-svelte"; } from "lucide-svelte";
const handleSelect = (option: string, file: VertFile) => {
file.result = null;
switch (option) {
case ".webp":
case ".gif":
addToast(
"warning",
`Converting this file to "${option}" may take some time if animated.`,
);
}
};
$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
@ -173,7 +185,7 @@
<Dropdown <Dropdown
options={file.converter?.supportedFormats || []} options={file.converter?.supportedFormats || []}
bind:selected={file.to} bind:selected={file.to}
onselect={() => file.result && (file.result = null)} onselect={(option) => handleSelect(option, file)}
/> />
<div class="w-full flex items-center justify-between"> <div class="w-full flex items-center justify-between">
<button <button