diff options
author | mat <github@matdoes.dev> | 2022-04-09 13:15:39 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-04-09 13:15:39 -0500 |
commit | 23095b24bdc45fc6e25ef65d7a5de689359547ce (patch) | |
tree | c601bfbeec1995fc6359c87de1871a00a158fbf3 | |
parent | 1e0e11733f0988f30188824eb4d5814c33e4e6c3 (diff) | |
download | skyblock-stats-23095b24bdc45fc6e25ef65d7a5de689359547ce.tar.gz skyblock-stats-23095b24bdc45fc6e25ef65d7a5de689359547ce.tar.bz2 skyblock-stats-23095b24bdc45fc6e25ef65d7a5de689359547ce.zip |
return whole player in coopInvitation
-rw-r--r-- | src/lib/sections/Coop.svelte | 64 | ||||
-rw-r--r-- | src/routes/player/[player]/[profile].svelte | 10 |
2 files changed, 74 insertions, 0 deletions
diff --git a/src/lib/sections/Coop.svelte b/src/lib/sections/Coop.svelte new file mode 100644 index 0000000..ad60bdf --- /dev/null +++ b/src/lib/sections/Coop.svelte @@ -0,0 +1,64 @@ +<script lang="ts"> + import type { CleanMemberProfile } from '$lib/APITypes' + import Emoji from '$lib/Emoji.svelte' + import { cleanId, millisecondsToTime, toTitleCase } from '$lib/utils' + + export let data: CleanMemberProfile +</script> + +<div class="info-text primary-info-text"> + <p>In co-op: <Emoji value={data.member.coopInvitation ? '✅' : '❌'} /></p> + {#if data.member.coopInvitation} + <p> + Invited: <span class="info-text-value coop-invited-timeago"> + <b>{millisecondsToTime(Date.now() - data.member.coopInvitation.invitedTimestamp)}</b> ago + </span> + </p> + {#if data.member.coopInvitation.acceptedTimestamp} + <p> + Accepted invite: <span class="info-text-value coop-accepted-invite-after"> + after <b> + {millisecondsToTime( + data.member.coopInvitation.acceptedTimestamp - + data.member.coopInvitation.invitedTimestamp + )} + </b> + </span> + </p> + {/if} + {/if} +</div> +<div class="harp-songs-list"> + {#each data.member.harp.songs as song} + <div class="harp-song" class:selected-harp-song={song.id === data.member.harp.selected?.id}> + <h3>{toTitleCase(cleanId(song.id))}</h3> + <div class="info-text"> + {#if song.completions} + <p>Completions: <b class="info-text-value">{song.completions}</b></p> + {/if} + {#if song.perfectCompletions} + <p>Perfect completions: <b class="info-text-value">{song.perfectCompletions}</b></p> + {:else} + <p>Progress: <b class="info-text-value">{Math.floor(song.progress * 100)}%</b></p> + {/if} + </div> + </div> + {/each} +</div> + +<style> + p { + margin: 0; + } + + .primary-info-text { + margin: 0.5em 0; + } + + .info-text { + color: var(--theme-darker-text); + } + .info-text .info-text-value { + color: var(--theme-main-text); + } +</style> diff --git a/src/routes/player/[player]/[profile].svelte b/src/routes/player/[player]/[profile].svelte index c55732c..0ac5f0f 100644 --- a/src/routes/player/[player]/[profile].svelte +++ b/src/routes/player/[player]/[profile].svelte @@ -52,6 +52,7 @@ import Claimed from '$lib/sections/Claimed.svelte' import Pets from '$lib/sections/Pets.svelte' import FarmingContests from '$lib/sections/FarmingContests.svelte' + import Coop from '$lib/sections/Coop.svelte' export let data: CleanMemberProfile export let pack: MatcherFile @@ -75,6 +76,7 @@ if (data.member.claimed && data.member.claimed.length > 0) categories.push('claimed') if (data.member.pets.list.length > 0) categories.push('pets') if (data.member.farmingContests.list.length > 0) categories.push('farming_contests') + categories.push('co-op') categories.push('leaderboards') } @@ -238,6 +240,14 @@ </Collapsible> </section> {/if} + {#if categories.includes('co-op')} + <section> + <Collapsible id="co-op"> + <h2 slot="title">Co-op</h2> + <Coop {data} /> + </Collapsible> + </section> + {/if} <section> <Collapsible id="leaderboards"> <h2 slot="title">Leaderboards</h2> |