diff options
-rw-r--r-- | src/lib/BackgroundImage.svelte | 14 | ||||
-rw-r--r-- | src/lib/profile.ts | 4 | ||||
-rw-r--r-- | src/routes/election.svelte | 6 | ||||
-rw-r--r-- | src/routes/index.svelte | 5 | ||||
-rw-r--r-- | src/routes/player/[player]/index.svelte | 2 | ||||
-rw-r--r-- | src/routes/profile/index.svelte | 2 | ||||
-rw-r--r-- | static/favicon.ico | bin | 0 -> 15406 bytes |
7 files changed, 22 insertions, 11 deletions
diff --git a/src/lib/BackgroundImage.svelte b/src/lib/BackgroundImage.svelte index fd62170..0b2f043 100644 --- a/src/lib/BackgroundImage.svelte +++ b/src/lib/BackgroundImage.svelte @@ -1,8 +1,10 @@ <script lang="ts"> - import { onDestroy } from 'svelte' + import { onDestroy, onMount } from 'svelte' import { browser } from '$app/env' export let url: string + let styleHtml = `<style class="background-image-style">:root{--background:url(${url})}</style>` + let serverSideRenderedStyleShown = true function updateUrl() { if (!browser) return @@ -19,6 +21,10 @@ $: [url, updateUrl()] + onMount(() => { + serverSideRenderedStyleShown = false + }) + // get rid of the body style when we leave the page // not doing this will sometimes cause the background to stay onDestroy(() => { @@ -28,3 +34,9 @@ } }) </script> + +<svelte:head> + {#if serverSideRenderedStyleShown} + {@html styleHtml} + {/if} +</svelte:head> diff --git a/src/lib/profile.ts b/src/lib/profile.ts index 256dc24..cba7923 100644 --- a/src/lib/profile.ts +++ b/src/lib/profile.ts @@ -14,9 +14,9 @@ export function prettyTimestamp(ms: number) { export function generateInfobox(data: CleanMemberProfile): string[] { const result: string[] = [] - result.push(`💾 Last save: ${prettyTimestamp(data.member.lastSave * 1000)}`) + result.push(`💾 Last save: ${prettyTimestamp(data.member.lastSave)}`) - result.push(`🚶 Profile created: ${prettyTimestamp(data.member.firstJoin * 1000)}`) + result.push(`🚶 Profile created: ${prettyTimestamp(data.member.firstJoin)}`) result.push(`✨ Fairy souls: ${data.member.fairySouls.total}/${data.member.fairySouls.max}`) diff --git a/src/routes/election.svelte b/src/routes/election.svelte index 8504622..2a818ec 100644 --- a/src/routes/election.svelte +++ b/src/routes/election.svelte @@ -52,7 +52,7 @@ // don't invalidate the first time the function is called if (!first) await invalidate('') - const lastUpdatedAgo = Date.now() - data.lastUpdated * 1000 + const lastUpdatedAgo = Date.now() - data.lastUpdated autoInvalidateTimeout = setTimeout(() => autoInvalidate(false), lastUpdatedAgo + 10 * 60 * 1000) } @@ -76,14 +76,14 @@ <div class="next-mayor-update"> <p> <b>Last API update:</b> - {millisecondsToTime(currentTime - data.lastUpdated * 1000, { + {millisecondsToTime(currentTime - data.lastUpdated, { smallestUnit: 1, parts: 1, })} ago </p> <p> <b>Next API update:</b> - {millisecondsToTime(10 * 60 * 1000 - (currentTime - data.lastUpdated * 1000), { + {millisecondsToTime(10 * 60 * 1000 - (currentTime - data.lastUpdated), { smallestUnit: 1, parts: 1, })} diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 630882e..4756fed 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -74,9 +74,8 @@ <h2>Info</h2> <p>Website made by <a href="https://matdoes.dev">mat</a>.</p> <p> - Official hangout/support Discord: <a href="//discord.gg/KtscNUnh4f"> - discord.gg/KtscNUnh4f - </a>. + Official hangout/support Discord: + <a href="//discord.gg/KtscNUnh4f">discord.gg/KtscNUnh4f</a>. </p> <p> Resource packs: <a href="//packshq.com">PacksHQ</a> (default), diff --git a/src/routes/player/[player]/index.svelte b/src/routes/player/[player]/index.svelte index 7148f20..b2f61c9 100644 --- a/src/routes/player/[player]/index.svelte +++ b/src/routes/player/[player]/index.svelte @@ -52,7 +52,7 @@ } } - isActiveProfileOnline = Date.now() / 1000 - 60 < activeProfileLastSave + isActiveProfileOnline = Date.now() - 60 < activeProfileLastSave } $: [data, updateActiveProfile()] diff --git a/src/routes/profile/index.svelte b/src/routes/profile/index.svelte index a69afc5..477d359 100644 --- a/src/routes/profile/index.svelte +++ b/src/routes/profile/index.svelte @@ -34,7 +34,7 @@ } const isDonator = - donators.find(d => d.uuid === sessionResponse.account?.minecraftUuid) !== undefined + donators.find(d => d?.uuid === sessionResponse.account?.minecraftUuid) !== undefined const isAdmin = admins.find(a => a === sessionResponse.account?.minecraftUuid) !== undefined return { diff --git a/static/favicon.ico b/static/favicon.ico Binary files differnew file mode 100644 index 0000000..c5ed15d --- /dev/null +++ b/static/favicon.ico |