diff --git a/src/app.html b/src/app.html index 6313582..934dd18 100644 --- a/src/app.html +++ b/src/app.html @@ -4,7 +4,7 @@ - Tauri + SvelteKit + Typescript App + EZPPLauncher %sveltekit.head% diff --git a/src/lib/userAuthentication.ts b/src/lib/userAuthentication.ts new file mode 100644 index 0000000..c74c681 --- /dev/null +++ b/src/lib/userAuthentication.ts @@ -0,0 +1,7 @@ +import { writable } from 'svelte/store'; +import { Config } from './config'; + +export const userAuth = writable(new Config(true)); + +export const username = writable(""); +export const password = writable("") diff --git a/src/pages/Launch.svelte b/src/pages/Launch.svelte index 0917eb3..a556575 100644 --- a/src/pages/Launch.svelte +++ b/src/pages/Launch.svelte @@ -25,10 +25,45 @@ import { fade, fly, scale } from 'svelte/transition'; import { Checkbox } from '@/components/ui/checkbox'; import Label from '@/components/ui/label/label.svelte'; - import { cursorSmoothening, customCursor, reduceAnimations, userSettings } from '@/userSettings'; + import { + cursorSmoothening, + customCursor, + osuInstallationPath, + reduceAnimations, + userSettings, + } from '@/userSettings'; + import Input from '@/components/ui/input/input.svelte'; + import { open } from '@tauri-apps/plugin-dialog'; + import { invoke } from '@tauri-apps/api/core'; + import { toast } from 'svelte-sonner'; let selectedTab = $state('home'); let launching = $state(false); + + const browse_osu_installation = async () => { + const selectedPath = await open({ + directory: true, + multiple: false, + title: 'Select osu! Installation Folder', + }); + + if (typeof selectedPath === 'string') { + /* if (selectedPath === $osuInstallationPath) { + return; + } */ + const validFolder: boolean = await invoke('valid_osu_folder', { folder: selectedPath }); + if (!validFolder) { + toast.error( + 'The selected folder is not a valid osu! installation folder. Please select the correct folder.' + ); + return; + } + osuInstallationPath.set(selectedPath); + $userSettings.value('osu_installation_path').set(selectedPath); + $userSettings.save(); + toast.success('osu! installation path set successfully.'); + } + }; @@ -370,62 +405,26 @@ EZPPLauncher Settings
- -
- Enable a custom cursor in the Launcher like in the lazer build of osu! -
+ +
The path to your osu! installation.
- { - if (!e) { - cursorSmoothening.set(false); - } - customCursor.set(e); - - $userSettings.save(); - }} - class="flex items-center justify-center w-5 h-5" - > - -
- -
- Makes the custom cursor movement smoother. -
+
+ +
- { - if (!$customCursor) return; - cursorSmoothening.set(e); - $userSettings.save(); - }} - disabled={!$customCursor} - class="flex items-center justify-center w-5 h-5" - > - -
- -
- Disables some animations in the Launcher to improve performance on low-end devices. -
-
- { - reduceAnimations.set(e); - $userSettings.save(); - }} - disabled={!$customCursor} - class="flex items-center justify-center w-5 h-5" - >
{/if} diff --git a/src/pages/Loading.svelte b/src/pages/Loading.svelte index 106a12d..ccc7ffa 100644 --- a/src/pages/Loading.svelte +++ b/src/pages/Loading.svelte @@ -10,11 +10,13 @@ let ezppLogo: HTMLImageElement; let spinnerCircle: SVGCircleElement; + let animateInterval: number | undefined; //TODO: use this to check for updates upon launch const doBPMAnimation = () => { - setInterval(async () => { + if (animateInterval) return; + animateInterval = window.setInterval(async () => { animate(ezppLogo, { scale: 1.1, duration: 900, @@ -83,7 +85,7 @@ prepare(); return () => { - utils.remove(ezppLogo); + window.clearInterval(animateInterval); utils.remove(spinnerCircle); }; });