mirror of https://github.com/VERT-sh/VERT.git
change gradient colour depending on category
This commit is contained in:
parent
a3250a25df
commit
2529e5d687
|
@ -218,3 +218,4 @@ class Theme {
|
||||||
export const files = new Files();
|
export const files = new Files();
|
||||||
export const theme = new Theme();
|
export const theme = new Theme();
|
||||||
export const showGradient = writable(true);
|
export const showGradient = writable(true);
|
||||||
|
export const gradientColor = writable("");
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import Navbar from "$lib/components/functional/Navbar.svelte";
|
import Navbar from "$lib/components/functional/Navbar.svelte";
|
||||||
import Footer from "$lib/components/visual/Footer.svelte";
|
import Footer from "$lib/components/visual/Footer.svelte";
|
||||||
import Logo from "$lib/components/visual/svg/Logo.svelte";
|
import Logo from "$lib/components/visual/svg/Logo.svelte";
|
||||||
import { files, showGradient } from "$lib/store/index.svelte";
|
import { files, gradientColor, showGradient } from "$lib/store/index.svelte";
|
||||||
import {
|
import {
|
||||||
InfoIcon,
|
InfoIcon,
|
||||||
RefreshCw,
|
RefreshCw,
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
<div
|
<div
|
||||||
id="gradient-bg"
|
id="gradient-bg"
|
||||||
class="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"
|
class="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"
|
||||||
style="background: var(--bg-gradient-pink);"
|
style="background: var(--bg-gradient-{$gradientColor || 'pink'});"
|
||||||
></div>
|
></div>
|
||||||
{:else if data.pathname === "/settings"}
|
{:else if data.pathname === "/settings"}
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -6,8 +6,11 @@
|
||||||
import ProgressiveBlur from "$lib/components/visual/effects/ProgressiveBlur.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 { log } from "$lib/logger";
|
import {
|
||||||
import { files, showGradient } from "$lib/store/index.svelte";
|
files,
|
||||||
|
gradientColor,
|
||||||
|
showGradient,
|
||||||
|
} from "$lib/store/index.svelte";
|
||||||
import { VertFile } from "$lib/types";
|
import { VertFile } from "$lib/types";
|
||||||
import {
|
import {
|
||||||
Disc2Icon,
|
Disc2Icon,
|
||||||
|
@ -21,17 +24,26 @@
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (files.files.length === 1 && files.files[0].blobUrl) {
|
if (files.files.length === 1 && files.files[0].blobUrl) {
|
||||||
log("blur", "Applying blur effect");
|
|
||||||
showGradient.set(false);
|
showGradient.set(false);
|
||||||
} else {
|
} else {
|
||||||
log("blur", "Removing blur effect");
|
|
||||||
showGradient.set(true);
|
showGradient.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set gradient color depending on the file types
|
||||||
|
// 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 allImages = files.files.every((file) => file.converter?.name !== "ffmpeg");
|
||||||
|
|
||||||
|
if (files.files.length === 0 || (!allAudio && !allImages)) {
|
||||||
|
gradientColor.set("");
|
||||||
|
} else {
|
||||||
|
gradientColor.set(allAudio ? "purple" : "blue");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#snippet fileItem(file: VertFile, index: number)}
|
{#snippet fileItem(file: VertFile, index: number)}
|
||||||
{@const isAudio = file.converter?.name === "ffmpeg" || false}
|
{@const isAudio = file.converter?.name === "ffmpeg"}
|
||||||
<Panel class="p-5 flex flex-col min-w-0 gap-4 relative">
|
<Panel class="p-5 flex flex-col min-w-0 gap-4 relative">
|
||||||
<div class="flex-shrink-0 h-8 w-full flex items-center gap-2">
|
<div class="flex-shrink-0 h-8 w-full flex items-center gap-2">
|
||||||
{#if !file.converter}
|
{#if !file.converter}
|
||||||
|
@ -101,7 +113,9 @@
|
||||||
/>
|
/>
|
||||||
<div class="w-full flex items-center justify-between">
|
<div class="w-full flex items-center justify-between">
|
||||||
<button
|
<button
|
||||||
class="btn p-0 w-14 h-14"
|
class="btn p-0 w-14 h-14 {isAudio
|
||||||
|
? 'bg-accent-purple'
|
||||||
|
: 'bg-accent-blue'}"
|
||||||
disabled={!files.ready}
|
disabled={!files.ready}
|
||||||
onclick={file.convert}
|
onclick={file.convert}
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue