add toggles for presence and patch
This commit is contained in:
@@ -5,13 +5,13 @@
|
||||
DropdownItem,
|
||||
DropdownHeader,
|
||||
DropdownDivider,
|
||||
Button
|
||||
Button,
|
||||
} from "flowbite-svelte";
|
||||
import {
|
||||
ArrowLeftSolid,
|
||||
ArrowRightFromBracketSolid,
|
||||
ArrowRightToBracketSolid,
|
||||
UserSettingsSolid
|
||||
UserSettingsSolid,
|
||||
} from "flowbite-svelte-icons";
|
||||
import ezppLogo from "../public/favicon.png";
|
||||
import {
|
||||
@@ -19,7 +19,9 @@
|
||||
currentUser,
|
||||
launching,
|
||||
launchPercentage,
|
||||
launchStatus
|
||||
launchStatus,
|
||||
patch,
|
||||
presence,
|
||||
} from "./storage/localStore";
|
||||
import { Page } from "./consts/pages";
|
||||
import Login from "./pages/Login.svelte";
|
||||
@@ -36,6 +38,9 @@
|
||||
user = newUser;
|
||||
});
|
||||
|
||||
presence.subscribe((val) => {
|
||||
});
|
||||
|
||||
const logout = () => {
|
||||
window.dispatchEvent(new CustomEvent("logout"));
|
||||
currentUser.set(undefined);
|
||||
@@ -44,7 +49,7 @@
|
||||
position: "bottom-center",
|
||||
className:
|
||||
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||
duration: 2000
|
||||
duration: 2000,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -75,7 +80,7 @@
|
||||
position: "bottom-center",
|
||||
className:
|
||||
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||
duration: 2000
|
||||
duration: 2000,
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -84,7 +89,7 @@
|
||||
position: "bottom-center",
|
||||
className:
|
||||
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||
duration: 4000
|
||||
duration: 4000,
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -94,7 +99,7 @@
|
||||
position: "bottom-center",
|
||||
className:
|
||||
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||
duration: 1500
|
||||
duration: 1500,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -123,7 +128,7 @@
|
||||
</div>
|
||||
{#if $currentPage == Page.Launch}
|
||||
<div
|
||||
class="flex flex-row gap-2 w-fill cursor-pointer md:order-2 animate-fadeIn opacity-0"
|
||||
class="flex flex-row gap-2 w-fill cursor-pointer md:order-2 animate-lsideIn opacity-0"
|
||||
>
|
||||
<Avatar
|
||||
class="rounded-lg border dark:border-gray-700 hover:ring-4 hover:ring-gray-200 dark:hover:ring-gray-800"
|
||||
|
@@ -196,7 +196,7 @@
|
||||
<Checkbox bind:checked={saveCredentials} disabled={loading}
|
||||
>Save credentials</Checkbox
|
||||
>
|
||||
<div class="flex flex-col justify-center items-center gap-5 mt-1">
|
||||
<div class="flex flex-col justify-center items-center gap-2 mt-1">
|
||||
<Button
|
||||
class="dark:active:!bg-gray-900 active:scale-95 transition-transform duration-75"
|
||||
color="light"
|
||||
|
@@ -1,12 +1,5 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
Button,
|
||||
ButtonGroup,
|
||||
Input,
|
||||
Label,
|
||||
Toggle,
|
||||
Tooltip
|
||||
} from "flowbite-svelte";
|
||||
import { Button, ButtonGroup, Input, Toggle } from "flowbite-svelte";
|
||||
import { FileSearchSolid, FolderSolid } from "flowbite-svelte-icons";
|
||||
import { patch, presence } from "./../storage/localStore";
|
||||
|
||||
@@ -15,6 +8,12 @@
|
||||
window.addEventListener("settings-result", (e) => {
|
||||
const settings: Record<string, string>[] = (e as CustomEvent).detail;
|
||||
const osuPath = settings.find((setting) => setting.key == "osuPath");
|
||||
const settingPatch = settings.find((setting) => setting.key == "patch");
|
||||
const settingPresence = settings.find(
|
||||
(setting) => setting.key == "presence"
|
||||
);
|
||||
patch.set(settingPatch ? settingPatch.val == "true" : true);
|
||||
presence.set(settingPresence ? settingPresence.val == "true" : true);
|
||||
folderPath = osuPath ? osuPath.val : "";
|
||||
});
|
||||
window.dispatchEvent(new CustomEvent("settings-get"));
|
||||
@@ -29,12 +28,16 @@
|
||||
|
||||
const togglePatching = () => {
|
||||
patch.set(!$patch);
|
||||
//TODO: save in config
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("setting-update", { detail: { patch: $patch } })
|
||||
);
|
||||
};
|
||||
|
||||
const togglePresence = () => {
|
||||
presence.set(!$presence);
|
||||
//TODO: save in config
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("setting-update", { detail: { presence: $presence } })
|
||||
);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@@ -3,6 +3,7 @@ import { Page } from "../consts/pages";
|
||||
import type { User } from "../types/user";
|
||||
|
||||
export const startup = writable(false);
|
||||
export const updateAvailable = writable(false);
|
||||
export const launching = writable(false);
|
||||
export const launchStatus = writable("Waiting...");
|
||||
export const launchPercentage = writable(-1);
|
||||
|
Reference in New Issue
Block a user