aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-08 23:38:55 -0800
committerAdam Soltys <[email protected]>2024-11-08 23:38:55 -0800
commitd47895ec4d54feef1114029ba11188362fa1222d (patch)
tree5ee5a223231e87f633e335890fa9f8f0a0c2c170
parent330e1dd77ab59084a831508e1dab103fd601dc49 (diff)
downloadcoinos-ui-d47895ec4d54feef1114029ba11188362fa1222d.tar.gz
coinos-ui-d47895ec4d54feef1114029ba11188362fa1222d.zip
default light theme
-rw-r--r--src/routes/(app)/+layout.server.ts2
-rw-r--r--src/routes/(app)/invoice/[id]/+layout.server.ts2
-rw-r--r--src/routes/+layout.server.ts2
-rw-r--r--src/routes/+layout.svelte7
4 files changed, 5 insertions, 8 deletions
diff --git a/src/routes/(app)/+layout.server.ts b/src/routes/(app)/+layout.server.ts
index 96bde919..85aa3e15 100644
--- a/src/routes/(app)/+layout.server.ts
+++ b/src/routes/(app)/+layout.server.ts
@@ -55,6 +55,6 @@ export async function load({ cookies, request, url, params }) {
console.log(e);
}
- const theme = cookies.get("theme");
+ const theme = cookies.get("theme") || "light";
return { user, token, rate, rates, subject, theme };
}
diff --git a/src/routes/(app)/invoice/[id]/+layout.server.ts b/src/routes/(app)/invoice/[id]/+layout.server.ts
index e428d9fe..c4a4ccab 100644
--- a/src/routes/(app)/invoice/[id]/+layout.server.ts
+++ b/src/routes/(app)/invoice/[id]/+layout.server.ts
@@ -36,6 +36,6 @@ export async function load({ cookies, depends, params, url, parent }) {
}
const src = Qr.drawImg(invoice?.text || "", { size: 500 });
- const theme = cookies.get("theme");
+ const theme = cookies.get("theme") || "light";
return { id, invoice, subject, src, user, token, theme };
}
diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts
index 78a4d012..7fa95931 100644
--- a/src/routes/+layout.server.ts
+++ b/src/routes/+layout.server.ts
@@ -37,7 +37,7 @@ export const load = async ({ cookies, request, url }) => {
}
await loadTranslations(locale, pathname); // keep this just before the `return`
- const theme = cookies.get("theme");
+ const theme = cookies.get("theme") || "light";
return {
theme,
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index a2dc3bff..e7baa137 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -1,5 +1,5 @@
<script>
- import { run } from 'svelte/legacy';
+ import { run } from "svelte/legacy";
import { browser } from "$app/environment";
import { PUBLIC_DOMAIN } from "$env/static/public";
@@ -11,15 +11,12 @@
let { data, children } = $props();
let { pathname, theme } = $state(data);
$themeStore = theme;
+ $effect(() => (theme = $themeStore));
let host = PUBLIC_DOMAIN.includes("localhost")
? `http://${PUBLIC_DOMAIN}`
: `https://${PUBLIC_DOMAIN}`;
- run(() => {
- theme = $themeStore
- });
-
onMount(() => {
if (!browser) return;
window.addEventListener("beforeinstallprompt", (event) => {