mirror of https://github.com/VERT-sh/VERT.git
feat: tooltip for partial support info
This commit is contained in:
parent
55ed8dd440
commit
92b1ac29b3
|
@ -1,12 +1,11 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Uploader from "$lib/components/functional/Uploader.svelte";
|
import Uploader from "$lib/components/functional/Uploader.svelte";
|
||||||
|
import Tooltip from "$lib/components/visual/Tooltip.svelte";
|
||||||
import { converters } from "$lib/converters";
|
import { converters } from "$lib/converters";
|
||||||
import { vertdLoaded } from "$lib/store/index.svelte";
|
import { vertdLoaded } from "$lib/store/index.svelte";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { AudioLines, BookText, Check, Film, Image } from "lucide-svelte";
|
import { AudioLines, BookText, Check, Film, Image } from "lucide-svelte";
|
||||||
|
|
||||||
const { data } = $props();
|
|
||||||
|
|
||||||
const getSupportedFormats = (name: string) =>
|
const getSupportedFormats = (name: string) =>
|
||||||
converters
|
converters
|
||||||
.find((c) => c.name === name)
|
.find((c) => c.name === name)
|
||||||
|
@ -46,6 +45,23 @@
|
||||||
icon: Film,
|
icon: Film,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getTooltip = (format: string) => {
|
||||||
|
const converter = converters.find((c) =>
|
||||||
|
c.supportedFormats.some((sf) => sf.name === format),
|
||||||
|
);
|
||||||
|
|
||||||
|
const formatInfo = converter?.supportedFormats.find(
|
||||||
|
(sf) => sf.name === format,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (formatInfo) {
|
||||||
|
return `This format can only be converted as ${
|
||||||
|
formatInfo.fromSupported ? "input (from)" : "output (to)"
|
||||||
|
}.`;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="max-w-6xl w-full mx-auto px-6 md:px-8">
|
<div class="max-w-6xl w-full mx-auto px-6 md:px-8">
|
||||||
|
@ -62,9 +78,9 @@
|
||||||
<p
|
<p
|
||||||
class="font-normal px-5 md:p-0 text-lg md:text-xl text-black text-muted dynadark:text-muted"
|
class="font-normal px-5 md:p-0 text-lg md:text-xl text-black text-muted dynadark:text-muted"
|
||||||
>
|
>
|
||||||
All image, audio, and document processing is done on your device.
|
All image, audio, and document processing is done on your
|
||||||
Videos are converted on our lightning-fast servers. No file
|
device. Videos are converted on our lightning-fast servers.
|
||||||
size limit, no ads, and completely open source.
|
No file size limit, no ads, and completely open source.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow w-full h-72">
|
<div class="flex-grow w-full h-72">
|
||||||
|
@ -119,7 +135,31 @@
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<b>Supported formats:</b>
|
<b>Supported formats:</b>
|
||||||
{s.formats}
|
{#each s.formats.split(", ") as format, index}
|
||||||
|
{@const isPartial = format.endsWith("*")}
|
||||||
|
{@const formatName = isPartial
|
||||||
|
? format.slice(0, -1)
|
||||||
|
: format}
|
||||||
|
{#if isPartial}
|
||||||
|
<Tooltip text={getTooltip(formatName)}>
|
||||||
|
<span class="whitespace-pre-wrap">
|
||||||
|
{formatName}<span
|
||||||
|
class="text-red-500">*</span
|
||||||
|
>{index <
|
||||||
|
s.formats.split(", ").length - 1
|
||||||
|
? ", "
|
||||||
|
: ""}
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
{:else}
|
||||||
|
<span class="whitespace-pre-wrap">
|
||||||
|
{formatName}{index <
|
||||||
|
s.formats.split(", ").length - 1
|
||||||
|
? ", "
|
||||||
|
: ""}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue