frontend: working on the settings page

This commit is contained in:
Tyler Wilding 2023-02-15 01:28:27 -05:00
parent 211a8cc613
commit d7d5a5f58c
No known key found for this signature in database
GPG key ID: 77CB07796494137E
29 changed files with 14580 additions and 306 deletions

View file

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> {{/* TODO - perhaps eventually add a lightmode toggle */}}
<html lang="en" class="dark">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />

14275
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -28,13 +28,13 @@
"autoprefixer": "^10.4.7", "autoprefixer": "^10.4.7",
"classnames": "^2.3.1", "classnames": "^2.3.1",
"execa": "^6.1.0", "execa": "^6.1.0",
"flowbite": "^1.5.3",
"flowbite-svelte": "^0.29.7",
"postcss": "^8.4.14",
"postcss-load-config": "^4.0.1",
"prettier": "^2.8.3", "prettier": "^2.8.3",
"prettier-plugin-svelte": "^2.9.0", "prettier-plugin-svelte": "^2.9.0",
"svelte": "^3.55.1", "svelte": "^3.55.1",
"flowbite": "^1.5.3",
"flowbite-svelte": "^0.26.16",
"postcss": "^8.4.14",
"postcss-load-config": "^4.0.1",
"svelte-preprocess": "^4.10.7", "svelte-preprocess": "^4.10.7",
"tailwindcss": "^3.1.5", "tailwindcss": "^3.1.5",
"vite": "^2.9.14" "vite": "^2.9.14"

View file

@ -6,7 +6,7 @@ use std::sync::Mutex;
use tauri::command; use tauri::command;
use tauri::Manager; use tauri::Manager;
use crate::config::config::LauncherConfig; use crate::config::LauncherConfig;
#[tauri::command] #[tauri::command]
pub fn get_install_directory(config: tauri::State<Mutex<LauncherConfig>>) -> Option<String> { pub fn get_install_directory(config: tauri::State<Mutex<LauncherConfig>>) -> Option<String> {

View file

@ -33,9 +33,9 @@ fn main() {
// //
// This allows us to avoid hacky globals, and pass around information (in this case, the config) // This allows us to avoid hacky globals, and pass around information (in this case, the config)
// to the relevant places // to the relevant places
app.manage(std::sync::Mutex::new( app.manage(std::sync::Mutex::new(config::LauncherConfig::load_config(
config::config::LauncherConfig::load_config(app.path_resolver().app_config_dir()), app.path_resolver().app_config_dir(),
)); )));
Ok(()) Ok(())
}) })
.invoke_handler(tauri::generate_handler![ .invoke_handler(tauri::generate_handler![

View file

@ -77,7 +77,7 @@
<Sidebar /> <Sidebar />
<Route path="/" component={Game} primary={false} let:params /> <Route path="/" component={Game} primary={false} let:params />
<Route path="/:game_name" component={Game} primary={false} let:params /> <Route path="/:game_name" component={Game} primary={false} let:params />
<Route path="/settings" component={Settings} primary={false} /> <Route path="/settings/:tab" component={Settings} primary={false} let:params />
<Route path="/faq" component={Faq} primary={false} /> <Route path="/faq" component={Faq} primary={false} />
<Route path="/textures" component={Textures} primary={false} /> <Route path="/textures" component={Textures} primary={false} />
<Route path="/update" component={Update} primary={false} /> <Route path="/update" component={Update} primary={false} />

Binary file not shown.

View file

@ -1,93 +1,93 @@
Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato" Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL http://scripts.sil.org/OFL
----------------------------------------------------------- -----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
----------------------------------------------------------- -----------------------------------------------------------
PREAMBLE PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership open framework in which fonts may be shared and improved in partnership
with others. with others.
The OFL allows the licensed fonts to be used, studied, modified and The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded, fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives, names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives. to any document created using the fonts or their derivatives.
DEFINITIONS DEFINITIONS
"Font Software" refers to the set of files released by the Copyright "Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation. include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the "Reserved Font Name" refers to any names specified as such after the
copyright statement(s). copyright statement(s).
"Original Version" refers to the collection of Font Software components as "Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s). distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting, "Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a Original Version, by changing formats or by porting the Font Software to a
new environment. new environment.
"Author" refers to any designer, engineer, programmer, technical "Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software. writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify, a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions: Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, 1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself. in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled, 2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user. binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font 3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as Copyright Holder. This restriction only applies to the primary font name as
presented to the users. presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written Copyright Holder(s) and the Author(s) or with their explicit written
permission. permission.
5) The Font Software, modified or unmodified, in part or in whole, 5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created remain under this license does not apply to any document created
using the Font Software. using the Font Software.
TERMINATION TERMINATION
This license becomes null and void if any of the above conditions are This license becomes null and void if any of the above conditions are
not met. not met.
DISCLAIMER DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE. OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,93 +0,0 @@
Copyright 2018 The Staatliches Authors (https://github.com/googlefonts/staatliches)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View file

@ -5,7 +5,7 @@
import { launcherConfig } from "$lib/config"; import { launcherConfig } from "$lib/config";
import { SupportedGame } from "$lib/constants"; import { SupportedGame } from "$lib/constants";
import { getVersion } from "@tauri-apps/api/app"; import { getVersion } from "@tauri-apps/api/app";
import { link } from "svelte-navigator"; import { Link } from "svelte-navigator";
import { Tooltip } from "flowbite-svelte"; import { Tooltip } from "flowbite-svelte";
import { handleCheckUpdate } from "$lib/utils/updates"; import { handleCheckUpdate } from "$lib/utils/updates";
import { UpdateStore } from "$lib/stores/AppStore"; import { UpdateStore } from "$lib/stores/AppStore";
@ -16,38 +16,45 @@
onMount(async () => { onMount(async () => {
gameVersion = await launcherConfig.getGameInstallVersion(activeGame); gameVersion = await launcherConfig.getGameInstallVersion(activeGame);
if (gameVersion.startsWith("v")) {
gameVersion = gameVersion.slice(1);
}
launcherVerison = await getVersion(); launcherVerison = await getVersion();
await handleCheckUpdate(); await handleCheckUpdate();
}); });
</script> </script>
<header <header
class="flex flex-row h-10 bg-[#101010] pl-2 pr-4 items-center" class="flex flex-row bg-[#101010] pl-2 pr-4 pt-1 pb-1 items-center"
data-tauri-drag-region data-tauri-drag-region
> >
<div class="flex flex-row items-center space-x-2 text-2xl"> <div class="flex flex-row items-center space-x-2">
<img class="h-8" src={icon} alt="" /> <img class="h-8" src={icon} alt="" />
<p>OpenGOAL</p> <p class="font-black tracking-tight text-lg">OpenGOAL</p>
</div> </div>
<div class="border-l border-[#9f9f9f] h-8 m-2" /> <div class="border-l border-[#9f9f9f] h-8 m-2" />
<div class="flex flex-col text-[#9f9f9f]"> <div class="flex flex-col text-neutral-300 mr-2">
<p class="text-sm">v{launcherVerison} Launcher</p> <p class="font-mono text-sm">v{launcherVerison}</p>
<p class="text-sm">{gameVersion} Tools</p> <p class="font-mono text-sm">v{gameVersion}</p>
</div>
<div class="flex flex-col text-neutral-500 mr-2">
<p class="font-mono text-sm">Launcher</p>
<p class="font-mono text-sm">Tooling</p>
</div>
<div class="flex flex-col text-orange-500">
<p class="font-mono text-sm hover:text-orange-300">
<Link class="font-mono" to="">> Update Available!</Link>
</p>
<p class="font-mono text-sm hover:text-orange-300">
<Link class="font-mono" to="">> Update Available!</Link>
</p>
</div> </div>
<div class="flex space-x-4 text-xl ml-auto"> <div class="flex space-x-4 text-xl ml-auto">
{#if $UpdateStore.shouldUpdate}
<a href="/update" use:link
><i
class="fa-solid fa-bell text-yellow-300 animate-pulse hover:cursor-pointer hover:animate-none"
/>
<Tooltip arrow={false} placement="bottom" style="dark"
>Update Available</Tooltip
>
</a>
{/if}
<i <i
class="fa fa-window-minimize hover:text-amber-600 hover:cursor-pointer text-sm" class="fa fa-window-minimize hover:text-amber-600 hover:cursor-pointer text-sm"
on:click={() => appWindow.minimize()} on:click={() => appWindow.minimize()}

View file

@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import logoJak1 from "$assets/images/jak-tpl.webp"; import logoJak1 from "$assets/images/jak-tpl.webp";
// import logoJak2 from "$assets/images/jak-2.webp"; import logoJak2 from "$assets/images/jak-2.webp";
// import logoJak3 from "$assets/images/jak-3.webp"; // import logoJak3 from "$assets/images/jak-3.webp";
import { link, useLocation } from "svelte-navigator"; import { link, useLocation } from "svelte-navigator";
import { Tooltip } from "flowbite-svelte"; import { Tooltip } from "flowbite-svelte";
@ -10,7 +10,11 @@
</script> </script>
<div <div
class="w-20 h-full bg-[#222222] px-1 absolute left-0 opacity-75 hover:opacity-100 duration-500 z-10" class="w-20 h-full bg-[#101010] px-1 absolute left-0 {pathname.startsWith(
'/settings'
)
? ''
: 'opacity-75 hover:opacity-100 duration-500 '} z-10"
> >
<ul class="flex flex-col space-y-12 px-1 py-5"> <ul class="flex flex-col space-y-12 px-1 py-5">
<li> <li>
@ -23,17 +27,13 @@
data-mdb-ripple="true" data-mdb-ripple="true"
data-mdb-ripple-color="dark" data-mdb-ripple-color="dark"
> >
<img src={logoJak1} alt="Jak - TPL" /> <img src={logoJak1} alt="Jak - The Precursor Legacy" />
<Tooltip <Tooltip placement="right"
rounded={false} >Jak&nbsp;and&nbsp;Daxter:&nbsp;The&nbsp;Precursor&nbsp;Legacy</Tooltip
arrow={false}
placement="right"
style="dark"
tipClass="px-2 truncate">Jak and Daxter: The Precursor Legacy</Tooltip
> >
</a> </a>
</li> </li>
<!-- <li> <li>
<a <a
class="flex items-center {pathname == '/jak2' class="flex items-center {pathname == '/jak2'
? '' ? ''
@ -42,18 +42,12 @@
use:link use:link
data-mdb-ripple="true" data-mdb-ripple="true"
data-mdb-ripple-color="dark" data-mdb-ripple-color="dark"
disabled
> >
<img src={logoJak2} alt="Jak2" /> <img src={logoJak2} alt="Jak 2" />
<Tooltip <Tooltip placement="right" style="dark">Jak 2</Tooltip>
rounded={false}
arrow={false}
placement="right"
style="dark"
tipClass="px-2 truncate">Jak 2</Tooltip
>
</a> </a>
</li> </li>
<!--
<li> <li>
<a <a
class="flex items-center {pathname == '/jak3' class="flex items-center {pathname == '/jak3'
@ -77,22 +71,19 @@
</li> --> </li> -->
<li class="fixed bottom-24 left-6"> <li class="fixed bottom-24 left-6">
<a <a
class="flex items-center justify-center opacity-75 {pathname == class="flex items-center justify-center opacity-75 {pathname.startsWith(
'/settings' '/settings'
)
? 'opacity-100' ? 'opacity-100'
: 'grayscale'} hover:grayscale-0 hover:opacity-100 text-orange-400 duration-500" : 'grayscale'} hover:grayscale-0 hover:opacity-100 text-orange-400 duration-500"
href="/settings" href="/settings/general"
use:link use:link
data-mdb-ripple="true" data-mdb-ripple="true"
data-mdb-ripple-color="dark" data-mdb-ripple-color="dark"
> >
<i class="fa-solid fa-gear text-3xl" /> <i class="fa-solid fa-gear text-3xl" />
<Tooltip <Tooltip rounded={false} arrow={false} placement="right" style="dark"
rounded={false} >Settings</Tooltip
arrow={false}
placement="right"
style="dark"
tipClass="px-2 truncate">Settings</Tooltip
> >
</a> </a>
</li> </li>
@ -108,12 +99,8 @@
data-mdb-ripple-color="dark" data-mdb-ripple-color="dark"
> >
<i class="fa fa-question-circle text-3xl" /> <i class="fa fa-question-circle text-3xl" />
<Tooltip <Tooltip rounded={false} arrow={false} placement="right" style="dark"
rounded={false} >FAQ</Tooltip
arrow={false}
placement="right"
style="dark"
tipClass="px-2 truncate">FAQ</Tooltip
> >
</a> </a>
</li> </li>

View file

@ -1,17 +1,6 @@
@font-face { @font-face {
font-family: "Staatliches"; font-family: "Inter";
src: url("/src/assets/fonts/Staatliches/Staatliches-Regular.ttf"); src: url("/src/assets/fonts/Inter/Inter.ttf");
}
@font-face {
font-family: "Lato";
src: url("/src/assets/fonts/Lato/Lato-Regular.ttf");
}
@font-face {
font-family: "Lato";
src: url("/src/assets/fonts/Lato/Lato-Bold.ttf");
font-weight: 700;
} }
@font-face { @font-face {
@ -27,7 +16,7 @@
* { * {
-webkit-user-drag: none; -webkit-user-drag: none;
font-family: "Staatliches", sans-serif; font-family: "Inter", sans-serif;
} }
body { body {
@ -52,3 +41,19 @@ body {
transition: all 0.1s ease; transition: all 0.1s ease;
color: black; color: black;
} }
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 5px;
}
*::-webkit-scrollbar-track {
background: #18181b;
border-radius: 5px;
}
*::-webkit-scrollbar-thumb {
background-color: #18181b;
border-radius: 2px;
border: 3px solid #c2410c;
}

View file

@ -1,10 +1,17 @@
<script> <script>
import { openDir } from "$lib/rpc/commands"; import { openDir } from "$lib/rpc/commands";
import { appDir, join } from "@tauri-apps/api/path"; import { appDir, join } from "@tauri-apps/api/path";
import { Alert, Button } from "flowbite-svelte"; import { Alert, Button, Tabs, TabItem } from "flowbite-svelte";
import { onMount } from "svelte"; import { onMount } from "svelte";
import { handleCheckUpdate } from "$lib/utils/updates"; import { handleCheckUpdate } from "$lib/utils/updates";
import { UpdateStore } from "$lib/stores/AppStore"; import { UpdateStore } from "$lib/stores/AppStore";
import { Route, Router, useLocation, useParams } from "svelte-navigator";
import General from "./settings/General.svelte";
import Folders from "./settings/Folders.svelte";
import Versions from "./settings/Versions.svelte";
const params = useParams();
$: activeTab = $params["tab"];
let directory = undefined; let directory = undefined;
let logDir = undefined; let logDir = undefined;
@ -13,51 +20,45 @@
directory = await appDir(); directory = await appDir();
logDir = await join(directory, "/logs"); logDir = await join(directory, "/logs");
}); });
const tabItemActiveClasses =
"inline-block text-sm font-bold text-center disabled:cursor-not-allowed p-4 text-orange-500 border-b-2 border-orange-500 dark:text-orange-500 dark:border-orange-500";
const tabItemInactiveClasses =
"inline-block text-sm font-normal text-center disabled:cursor-not-allowed p-4 border-b-2 border-transparent text-gray-400 hover:text-orange-300 hover:border-orange-500 dark:hover:text-orange-300 dark:text-orange-400";
</script> </script>
<div class="ml-20"> <div class="ml-20">
<div class="flex flex-col h-5/6 p-8"> <div class="flex flex-col h-screen bg-slate-900">
<Alert color="dark" rounded={false} accent> <!-- https://flowbite-svelte.com/components/tab#Tabs_with_icons -->
<span class="text-lg font-medium text-black-900 dark:text-blue-800 mb-4" <Tabs
>Settings</span style="underline"
divider={false}
contentClass="p-4 pt-0 rounded-lg dark:bg-gray-800 mt-2 pb-20 overflow-y-auto"
> >
<div slot="extra"> <TabItem
<div class="flex flex-col gap-2"> open={!activeTab || activeTab === "general"}
<Button title="General"
class="!rounded-none" activeClasses={tabItemActiveClasses}
size="md" inactiveClasses={tabItemInactiveClasses}
outline >
color="green" <General />
on:click={() => openDir(directory)} </TabItem>
> <TabItem
<i class="fa fa-folder mx-1" /> open={activeTab === "folders"}
Open Launcher Install Directory title="Folders"
</Button> activeClasses={tabItemActiveClasses}
<Button inactiveClasses={tabItemInactiveClasses}
class="!rounded-none" >
size="md" <Folders />
outline </TabItem>
color="green" <TabItem
on:click={() => openDir(logDir)} open={activeTab === "versions"}
> title="Version Management"
<i class="fa fa-folder mx-1" /> activeClasses={tabItemActiveClasses}
Open Logs Directory inactiveClasses={tabItemInactiveClasses}
</Button> >
{#if !$UpdateStore.shouldUpdate} <Versions />
<Button </TabItem>
class="!rounded-none" </Tabs>
size="md"
outline
color="green"
on:click={async () => await handleCheckUpdate()}
>
<i class="fa fa fa-download mx-1" />
Check For Updates
</Button>
{/if}
<!-- TODO: Add a button that lets users change the install directory -->
</div>
</div>
</Alert>
</div> </div>
</div> </div>

View file

@ -0,0 +1,5 @@
<script>
</script>
<p class="text-sm text-slate-100 dark:text-gray-00">Words</p>

View file

@ -0,0 +1,5 @@
<script>
</script>
<p class="text-sm text-slate-100 dark:text-gray-00">Words</p>

View file

@ -0,0 +1,78 @@
<script>
import { Alert, Button, Tabs, TabItem, Radio } from "flowbite-svelte";
import {
Table,
TableBody,
TableBodyCell,
TableBodyRow,
TableHead,
TableHeadCell,
} from "flowbite-svelte";
let officialVersion = "v0.1.31";
</script>
<Tabs style="pill">
<TabItem open>
<span slot="title">Official</span>
<Table>
<TableHead>
<TableHeadCell class="sr-only" />
<TableHeadCell>Version Number</TableHeadCell>
<TableHeadCell>Date</TableHeadCell>
<TableHeadCell>Github Link</TableHeadCell>
<TableHeadCell>
<span class="sr-only"> Download </span>
</TableHeadCell>
</TableHead>
<TableBody class="divide-y">
<TableBodyRow>
<TableBodyCell class="!p-4">
<Radio group={officialVersion} value="v0.1.31" />
</TableBodyCell>
<TableBodyCell>v0.1.31</TableBodyCell>
<TableBodyCell>NOW</TableBodyCell>
<TableBodyCell>TODO</TableBodyCell>
<TableBodyCell>
<a
href="/tables"
class="font-medium text-blue-600 hover:underline dark:text-blue-500"
>
Download
</a>
</TableBodyCell>
</TableBodyRow>
<TableBodyRow>
<TableBodyCell class="!p-4">
<Radio group={officialVersion} value="v0.1.30" disabled />
</TableBodyCell>
<TableBodyCell>v0.1.30</TableBodyCell>
<TableBodyCell>NOW</TableBodyCell>
<TableBodyCell>TODO</TableBodyCell>
<TableBodyCell>
<a
href="/tables"
class="font-medium text-blue-600 hover:underline dark:text-blue-500"
>
Download
</a>
</TableBodyCell>
</TableBodyRow>
</TableBody>
</Table>
</TabItem>
<TabItem>
<span slot="title">Unofficial</span>
<p class="text-sm text-gray-500 dark:text-gray-400">
<b>Dashboard:</b> Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p>
</TabItem>
<TabItem>
<span slot="title">Development</span>
<p class="text-sm text-gray-500 dark:text-gray-400">
<b>Settings:</b> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p>
</TabItem>
</Tabs>

View file

@ -30,11 +30,14 @@
// If not -- let's ask the user to set one up // If not -- let's ask the user to set one up
// This is part of what allows for the user to install the games and such wherever they want // This is part of what allows for the user to install the games and such wherever they want
currentStatusText = "Pick an Installation Folder"; currentStatusText = "Pick an Installation Folder";
// TODO - change to a save dialog instead
const new_install_dir = await folderPrompt("Pick an Installation Folder"); const new_install_dir = await folderPrompt("Pick an Installation Folder");
// TODO - put invokes into a nice typescript interface // TODO - put invokes into a nice typescript interface
if (new_install_dir !== undefined) { if (new_install_dir !== undefined) {
await invoke("set_install_directory", {"newDir": new_install_dir}); await invoke("set_install_directory", {"newDir": new_install_dir});
// TODO - we are kinda assuming it succeeded here, improve that // TODO - we are kinda assuming it succeeded here, improve that
// - what if the install directory no longer exists
// - what if what they provide isn't writable?
installationDirSet = true; installationDirSet = true;
finishSplash(); finishSplash();
} }
@ -66,7 +69,7 @@
} }
</script> </script>
<div class="content"> <div class="content" data-tauri-drag-region>
<div class="splash-logo"> <div class="splash-logo">
<img src={logo} alt="" draggable="false" /> <img src={logo} alt="" draggable="false" />
</div> </div>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" class="dark">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />