Compare commits

..

No commits in common. "splashScreen" and "master" have entirely different histories.

2 changed files with 30 additions and 81 deletions

View File

@ -1,34 +0,0 @@
<script>
let { loadingState } = $props();
</script>
<div class="splash">
{#if loadingState == 'loading'}
<div class="spinner">
<pre class="monospace">
▄▄▄▄▄
██▀▀▀▀█▄ █▄ █▄
▀██▄ ▄▀ ▄ ▄██▄██ ▀▀
▀██▄▄ ███▄███▄ ▄███▄ ▄███▄ ██ ████▄ ██ ▄█▀█▄
▄ ▀██▄ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▄█▀
▀██████▀▄██ ██ ▀█▄▀███▀▄▀███▀▄██▄██ ██▄██▄▀█▄▄▄
</pre>
</div>
{/if}
</div>
<style>
.splash {
align-items: center;
justify-content: center;
display: flex;
width: 100%;
height: 100%;
}
.spinner {
}
.monospace {
font-family: monospace;
color: var(--black);
}
</style>

View File

@ -1,38 +1,28 @@
<script> <script>
// LIBS
import { getVersion } from '@tauri-apps/api/app';
import { onMount } from 'svelte';
import { fade } from 'svelte/transition';
import '@webtui/css/components/spinner.css'; import '@webtui/css/components/spinner.css';
// MODULES
import { setupTrayIcon } from '$lib/trayicon'; import { setupTrayIcon } from '$lib/trayicon';
import { getSettings, currentSettings } from '$lib/settings'; import { fade } from 'svelte/transition';
import { getInstalledVersions, currentInstalledVersions } from '$lib/library'; import { onMount } from 'svelte';
import { getSettings, currentSettings } from '$lib/settings.js';
import { getBlenderReleases, blenderReleases } from '$lib/blenderfetch'; import { getBlenderReleases, blenderReleases } from '$lib/blenderfetch';
import { downloadTasksStore } from '$lib/download'; import { getInstalledVersions, currentInstalledVersions } from '$lib/library.js';
import { downloadTasksStore } from '$lib/download.js';
// COMPONENTS
import Library from '$lib/components/Library.svelte'; import Library from '$lib/components/Library.svelte';
import Download from '$lib/components/Download.svelte'; import Download from '$lib/components/Download.svelte';
import Settings from '$lib/components/Settings.svelte'; import Settings from '$lib/components/Settings.svelte';
import Popup from '$lib/components/Popup.svelte'; import Popup from '$lib/components/Popup.svelte';
import Dialog from '$lib/components/Dialog.svelte'; import Dialog from '$lib/components/Dialog.svelte';
import Splash from '$lib/components/Splash.svelte';
// states
let fadeInSettings = { duration: 100 }; let fadeInSettings = { duration: 100 };
let fadeOutSettings = { duration: 100, delay: fadeInSettings.duration }; let fadeOutSettings = { duration: 100, delay: fadeInSettings.duration };
let activeTab = $state('library'); let activeTab = 'library';
let blenderVersions = $state([]); let blenderVersions = [];
let installedVersions = $state([]); let installedVersions = [];
let downloadTasks = $state([]); let downloadTasks = [];
let settings = $state(); let settings = {};
let initialized = $state(false); let initialized = false;
let version = $state('');
let loadingState = $state('loading'); // load, update, initialized
async function initStoresListeners() { function initStoresListeners() {
currentSettings.subscribe((value) => { currentSettings.subscribe((value) => {
settings = value; settings = value;
console.log('Loaded settings:', settings); console.log('Loaded settings:', settings);
@ -52,13 +42,26 @@
} }
onMount(async () => { onMount(async () => {
version = await getVersion(); const startTime = Date.now();
await getSettings(); await getSettings();
await getBlenderReleases(); await getBlenderReleases();
await getInstalledVersions(); await getInstalledVersions();
await setupTrayIcon(); await setupTrayIcon();
await initStoresListeners();
loadingState = 'initialized'; initStoresListeners();
const elapsed = Date.now() - startTime;
if (elapsed < 2000) {
initialized = true;
/* setTimeout(() => {
initialized = true;
}, 2000 - elapsed);*/
} else {
initialized = true;
}
//await getInstalledVersions();
//
}); });
</script> </script>
@ -66,7 +69,7 @@
<Dialog /> <Dialog />
<div id="main"> <div id="main">
{#if loadingState == 'initialized'} {#if initialized}
<div class="tablist" role="tablist"> <div class="tablist" role="tablist">
<div <div
role="tab" role="tab"
@ -119,11 +122,8 @@
{/if} {/if}
</div> </div>
</div> </div>
<div class="version">v{version}</div>
{:else} {:else}
<div class="splash-wrapper" in:fade={{ duration: 100 }} out:fade={{ delay: 50, duration: 200 }}> LOADING...
<Splash {loadingState} />
</div>
{/if} {/if}
</div> </div>
@ -207,21 +207,4 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.version {
position: fixed;
bottom: 2rem;
right: 2rem;
z-index: 2;
text-align: right;
color: var(--light-accent);
}
.splash-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: var(--white);
z-index: 1;
}
</style> </style>