From c71273ffb23b1e02c01d105035c6ab0de6d3b4eb Mon Sep 17 00:00:00 2001 From: Rumrobot Date: Mon, 20 May 2024 21:56:34 +0200 Subject: [PATCH] Rewrite + mod types + collapsible mods --- TODO.md | 1 + bun.lockb | Bin 102351 -> 102376 bytes package.json | 2 +- src-tauri/tauri.conf.json | 2 +- src/lib/components/modcard.svelte | 10 +- .../ui/accordion/accordion-content.svelte | 29 +++++ .../ui/accordion/accordion-item.svelte | 14 ++ .../ui/accordion/accordion-trigger.svelte | 28 ++++ src/lib/components/ui/accordion/index.ts | 17 +++ src/lib/components/ui/card/card-header.svelte | 2 +- src/lib/modio-utils.ts | 120 ++++++++++-------- src/lib/types.ts | 7 +- src/routes/+layout.svelte | 16 +-- src/routes/+page.svelte | 78 +++++++----- src/routes/settings/+page.svelte | 41 +++--- 15 files changed, 249 insertions(+), 118 deletions(-) create mode 100644 src/lib/components/ui/accordion/accordion-content.svelte create mode 100644 src/lib/components/ui/accordion/accordion-item.svelte create mode 100644 src/lib/components/ui/accordion/accordion-trigger.svelte create mode 100644 src/lib/components/ui/accordion/index.ts diff --git a/TODO.md b/TODO.md index 71b9669..b24597d 100644 --- a/TODO.md +++ b/TODO.md @@ -2,6 +2,7 @@ - Clean up the code ofc. - som error handling for invalid mod folders +- check download hash ## New features diff --git a/bun.lockb b/bun.lockb index 879e3318eb8e573aa882d40f4532ce0ebc46819d..6c60d780420e7c9b7982f992823614de661b3e89 100644 GIT binary patch delta 3898 zcmZWrdsJ0b8s8hZz){n9-VTotAMw82d*O1BD;*I+2oVW;prKvlidR7sv@}ex7HP}X zr0zBCxnpRUYt+ffh?H^E94a$w9K}_$A|GW|lgq}e%tyZFx6i}-M=aL;{eIu~?Y+PK zJm1kxq2F%`U299evfy)9+cVeKMu*!sZ+Is9X8gI^{Tpk3Tr_IbhEKLD?K>aqsah98 z53(~M*5nt`2^mI6$Kuu|Up*mYR~jLALlQp9K`{Wla}jMj)bt zi@AE>31AHLA)rX42PphqhF${{9ZbN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59c739d..b8a6d44 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "dependencies": { "@sveltejs/kit": "^2.5.4", "@tauri-apps/api": "^1", - "bits-ui": "^0.20.0", + "bits-ui": "^0.21.8", "bottleneck": "^2.19.5", "clsx": "^2.1.0", "lucide-svelte": "^0.359.0", diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d8f512b..3cec6d3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -7,7 +7,7 @@ }, "package": { "productName": "Pavlov Map Manager", - "version": "1.1.0" + "version": "1.2.0" }, "tauri": { "allowlist": { diff --git a/src/lib/components/modcard.svelte b/src/lib/components/modcard.svelte index e6e44cc..81fd691 100644 --- a/src/lib/components/modcard.svelte +++ b/src/lib/components/modcard.svelte @@ -32,10 +32,12 @@ let theme: string; let deletePopup: boolean; + let showType: boolean; onMount(async () => { theme = await config.get("theme"); - deletePopup = await config.get("deletePopup"); + deletePopup = await config.get("delete_popup"); + showType = await config.get("show_type"); }); export let mod: string; @@ -48,10 +50,14 @@ > + {#if showType} +

{$modsStore[mod].type}

+ {/if}
- {#if $modsStore[mod].currentVersion != $modsStore[mod].latestVersion } + {#if $modsStore[mod].currentVersion != $modsStore[mod].latestVersion}
-
-

New update available

-
+ - {#each Object.keys($modsStore) as mod} - {#if $modsStore[mod].currentVersion != $modsStore[mod].latestVersion} - - {/if} - {/each} -
-
-
-

Up to date

-
New update available + + {#each Object.keys($modsStore) as mod} + {#if $modsStore[mod].currentVersion != $modsStore[mod].latestVersion} + + {/if} + {/each} + + + - {#each Object.keys($modsStore) as mod} - {#if $modsStore[mod].currentVersion == $modsStore[mod].latestVersion} - - {/if} - {/each} -
-
+ Up to date + + {#each Object.keys($modsStore) as mod} + {#if $modsStore[mod].currentVersion == $modsStore[mod].latestVersion} + + {/if} + {/each} + + + {:else}
@@ -291,9 +305,7 @@
diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index 17869e7..ffeb20b 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -34,13 +34,15 @@ let auto_path: boolean; let theme: string; let delete_popup: boolean; + let show_type: boolean; onMount(async () => { theme = (await config.get("theme")) as string; - oauth_token = await config.get("oauth_token"); - mods_path = await config.get("mods_path"); - auto_path = await config.get("auto_path"); - delete_popup = await config.get("delete_popup"); + oauth_token = await config.get("oauthToken"); + mods_path = await config.get("modsPath"); + auto_path = await config.get("autoPath"); + delete_popup = await config.get("deletePopup"); + show_type = await config.get("show_type"); }); async function setTheme(new_theme: string) { @@ -52,30 +54,40 @@ } async function change_mods_path(input: string) { - await config.set("mods_path", input); + await config.set("modsPath", input); mods_path = input; await config.save(); toast.success("Mods path changed successfully"); } - async function toggle_auto_path() { + async function autoPathSwitch() { if (!auto_path) { await change_mods_path(await getModsPath()); } - await config.get("auto_path"); - await config.set("auto_path", auto_path); + await config.get("autoPath"); + await config.set("autoPath", auto_path); await config.save(); } const delete_popup_switch = async () => { - await config.get("delete_popup"); - await config.set("delete_popup", delete_popup); + await config.get("deletePopup"); + await config.set("deletePopup", delete_popup); + await config.save(); + }; + + const show_type_switch = async () => { + await config.get("show_type"); + await config.set("show_type", show_type); await config.save(); };
+
+ + +
@@ -125,13 +137,8 @@
- - + +