diff options
| author | mat <github@matdoes.dev> | 2022-02-17 00:19:51 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-02-17 00:19:51 -0600 |
| commit | a6cff35351d418272d137013cd536c26e978b6f6 (patch) | |
| tree | 6df48609fe09c844e5874bdd94f4e01f113703c9 /src/routes | |
| parent | cd982e64595ab47a5fa71a40f8249893dbf867df (diff) | |
| download | skyblock-stats-a6cff35351d418272d137013cd536c26e978b6f6.tar.gz skyblock-stats-a6cff35351d418272d137013cd536c26e978b6f6.tar.bz2 skyblock-stats-a6cff35351d418272d137013cd536c26e978b6f6.zip | |
move some stuff and change how constants are done
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/constants.json.ts | 18 | ||||
| -rw-r--r-- | src/routes/player/[player]/[profile].svelte | 57 | ||||
| -rw-r--r-- | src/routes/player/[player]/index.svelte | 6 |
3 files changed, 44 insertions, 37 deletions
diff --git a/src/routes/constants.json.ts b/src/routes/constants.json.ts deleted file mode 100644 index 301da58..0000000 --- a/src/routes/constants.json.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { API_URL } from '$lib/api' - -export let constants: any = {} - -async function updateConstants() { - constants = await fetch(API_URL + 'constants').then(r => r.json()) - console.log('updated constants') -} - -updateConstants() -setInterval(updateConstants, 60 * 60 * 1000) // update every hour - -export async function get({ request }) { - console.log('gotten constants') - return { - body: constants || {} - } -}
\ No newline at end of file diff --git a/src/routes/player/[player]/[profile].svelte b/src/routes/player/[player]/[profile].svelte index 9c3fb31..36b731a 100644 --- a/src/routes/player/[player]/[profile].svelte +++ b/src/routes/player/[player]/[profile].svelte @@ -9,30 +9,29 @@ r.json() ) - const constants = await fetch('/constants.json').then(r => r.json()) - return { props: { data, - constants, + pack: params.pack ?? data?.customization?.pack, }, } } </script> <script lang="ts"> + import Username from '$lib/minecraft/Username.svelte' import Infobox from '$lib/sections/Infobox.svelte' import { generateInfobox } from '$lib/profile' - import Username from '$lib/Username.svelte' import Header from '$lib/Header.svelte' import Emoji from '$lib/Emoji.svelte' import { cleanId } from '$lib/utils' import Head from '$lib/Head.svelte' import Toc from '$lib/Toc.svelte' import Skills from '$lib/sections/Skills.svelte' + import Armor from '$lib/sections/Armor.svelte' export let data - export let constants + export let pack: string const categories = [ 'skills', @@ -58,7 +57,7 @@ <Head title="{data.member.username}'s SkyBlock profile ({data.member.profileName})" - description={generateInfobox(data, constants, { meta: true }).join('\n')} + description={generateInfobox(data, { meta: true }).join('\n')} metaTitle={(data.member.rank.name ? `[${data.member.rank.name}] ` : '') + `${data.member.username}\'s SkyBlock profile (${data.member.profileName})`} /> @@ -73,7 +72,7 @@ ({data.member.profileName}) </h1> - <Infobox {data} {constants} /> + <Infobox {data} /> <Toc {categories} /> @@ -83,10 +82,42 @@ <Skills {data} /> </section> {/if} - <!-- {%- if data.member.skills|length > 0 -%} - <section id="skills" class="profile-skills"> - <h2>Skills</h2> - {%- include 'sections/skills.njk' -%} - </section> - {%- endif -%} --> + + <br /> + + <div> + <div id="categories"> + {#if data.member.inventories.armor} + <section id="armor" class:armor-float={data.member.inventories.inventory}> + <h2>Armor</h2> + <Armor {data} {pack} /> + </section> + {/if} + <!-- {%- if data.member.inventories.armor -%} + <section id="armor"{% if data.member.inventories.inventory %} class="armor-float"{% endif %}> + <h2>Armor</h2> + {%- include 'sections/armor.njk' -%} + </section> + {%- endif -%} + {%- if data.member.inventories.inventory -%} + <section id="inventories"> + <h2>Inventories</h2> + {%- include 'sections/inventories.njk' -%} + </section> + {%- endif -%} + {%- asyncAll category in categories -%} + {%- set sectionContents -%} + {% with { data: data, category: category } %} + {%- include 'sections/' + category + '.njk' -%} + {% endwith %} + {%- endset -%} + {%- if sectionContents|trim and sectionContents|trim != '<ul></ul>' -%} + <section id="{{ category }}" class="collapsible"> + <h2>{{ category|replace('_', ' ')|title }}</h2> + {{- sectionContents|safe -}} + </section> + {%- endif -%} + {%- endall -%} --> + </div> + </div> </main> diff --git a/src/routes/player/[player]/index.svelte b/src/routes/player/[player]/index.svelte index 8704b09..7252a80 100644 --- a/src/routes/player/[player]/index.svelte +++ b/src/routes/player/[player]/index.svelte @@ -11,11 +11,6 @@ return { fallthrough: true } as unknown } - // this should happen instantly - // const constants = await fetch('/_constants.json').then(r => r.json()) - - // console.log('constants', constants) - if (data.player.username !== player) { return { redirect: `/player/${data.player.username}`, @@ -37,7 +32,6 @@ import Head from '$lib/Head.svelte' export let data - // export let constants let activeProfile = null let activeProfileLastSave: number = 0 |
