Add placeholder BGs for files

This commit is contained in:
JovannMC 2025-02-06 07:54:59 +03:00
parent b1f135df4c
commit ba4288b3be
No known key found for this signature in database
2 changed files with 51 additions and 13 deletions

View File

@ -54,21 +54,41 @@
var(--accent-pink), var(--accent-pink),
hsla(303, 100%, 50%, 0) 25% hsla(303, 100%, 50%, 0) 25%
); );
--bg-gradient-pink-alt: linear-gradient(
to top,
var(--accent-pink),
hsl(303, 100%, 91%) 100%
);
--bg-gradient-red: linear-gradient( --bg-gradient-red: linear-gradient(
to bottom, to bottom,
var(--accent-red), var(--accent-red),
hsla(348, 100%, 50%, 0) 25% hsla(348, 100%, 50%, 0) 25%
); );
--bg-gradient-red-alt: linear-gradient(
to top,
var(--accent-red),
hsl(348, 100%, 91%) 100%
);
--bg-gradient-purple: linear-gradient( --bg-gradient-purple: linear-gradient(
to bottom, to bottom,
var(--accent-purple), var(--accent-purple),
hsla(264, 100%, 50%, 0) 25% hsla(264, 100%, 50%, 0) 25%
); );
--bg-gradient-purple-alt: linear-gradient(
to top,
var(--accent-purple),
hsl(264, 100%, 91%) 100%
);
--bg-gradient-blue: linear-gradient( --bg-gradient-blue: linear-gradient(
to bottom, to bottom,
var(--accent-blue), var(--accent-blue),
hsla(220, 100%, 50%, 0) 25% hsla(220, 100%, 50%, 0) 25%
); );
--bg-gradient-blue-alt: linear-gradient(
to top,
var(--accent-blue),
hsl(220, 100%, 91%) 100%
);
--bg-panel: hsl(0, 0%, 100%); --bg-panel: hsl(0, 0%, 100%);
--bg-panel-accented: hsl(0, 0%, 92%); --bg-panel-accented: hsl(0, 0%, 92%);
--bg-separator: hsl(0, 0%, 88%); --bg-separator: hsl(0, 0%, 88%);

View File

@ -1,9 +1,7 @@
<script lang="ts"> <script lang="ts">
import { duration, fade } from "$lib/animation";
import ConversionPanel from "$lib/components/functional/ConversionPanel.svelte"; import ConversionPanel from "$lib/components/functional/ConversionPanel.svelte";
import Dropdown from "$lib/components/functional/Dropdown.svelte"; import Dropdown from "$lib/components/functional/Dropdown.svelte";
import Uploader from "$lib/components/functional/Uploader.svelte"; import Uploader from "$lib/components/functional/Uploader.svelte";
import ProgressiveBlur from "$lib/components/visual/effects/ProgressiveBlur.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 { import {
@ -13,14 +11,15 @@
} from "$lib/store/index.svelte"; } from "$lib/store/index.svelte";
import { VertFile } from "$lib/types"; import { VertFile } from "$lib/types";
import { import {
Disc2Icon, AudioLines,
DownloadIcon, DownloadIcon,
FileMusicIcon,
FileQuestionIcon, FileQuestionIcon,
ImageIcon, ImageIcon,
ImageOffIcon,
RotateCwIcon, RotateCwIcon,
XIcon, XIcon,
} from "lucide-svelte"; } from "lucide-svelte";
import { quintOut } from "svelte/easing";
$effect(() => { $effect(() => {
if (files.files.length === 1 && files.files[0].blobUrl) { if (files.files.length === 1 && files.files[0].blobUrl) {
@ -31,8 +30,12 @@
// 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((file) => file.converter?.name === "ffmpeg"); const allAudio = files.files.every(
const allImages = files.files.every((file) => file.converter?.name !== "ffmpeg"); (file) => file.converter?.name === "ffmpeg",
);
const allImages = files.files.every(
(file) => file.converter?.name !== "ffmpeg",
);
if (files.files.length === 0 || (!allAudio && !allImages)) { if (files.files.length === 0 || (!allAudio && !allImages)) {
gradientColor.set(""); gradientColor.set("");
@ -49,7 +52,7 @@
{#if !file.converter} {#if !file.converter}
<FileQuestionIcon size="24" class="flex-shrink-0" /> <FileQuestionIcon size="24" class="flex-shrink-0" />
{:else if isAudio} {:else if isAudio}
<Disc2Icon size="24" class="flex-shrink-0" /> <AudioLines size="24" class="flex-shrink-0" />
{:else} {:else}
<ImageIcon size="24" class="flex-shrink-0" /> <ImageIcon size="24" class="flex-shrink-0" />
{/if} {/if}
@ -93,11 +96,26 @@
class="flex gap-4 w-full h-[152px] overflow-hidden relative" class="flex gap-4 w-full h-[152px] overflow-hidden relative"
> >
<div class="w-1/2 h-full overflow-hidden rounded-xl"> <div class="w-1/2 h-full overflow-hidden rounded-xl">
<img {#if file.blobUrl}
class="object-cover w-full h-full" <img
src={file.blobUrl} class="object-cover w-full h-full"
alt={file.name} src={file.blobUrl}
/> alt={file.name}
/>
{:else}
<div
class="w-full h-full flex items-center justify-center"
style="background: var({isAudio
? '--bg-gradient-purple-alt'
: '--bg-gradient-blue-alt'})"
>
{#if isAudio}
<FileMusicIcon size="56" />
{:else}
<ImageOffIcon size="56" />
{/if}
</div>
{/if}
</div> </div>
</div> </div>
<div <div