aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-10 18:59:56 -0500
committermat <github@matdoes.dev>2022-04-10 18:59:56 -0500
commit546a17f36f4aa15122aeee5d0887bf5e13a5fade (patch)
tree33973439a40e3b40f9ffffdeca8490cdb2bad254 /src
parent96f151c3901243a12efafc17c28f85d94b7d7c03 (diff)
downloadskyblock-stats-546a17f36f4aa15122aeee5d0887bf5e13a5fade.tar.gz
skyblock-stats-546a17f36f4aa15122aeee5d0887bf5e13a5fade.tar.bz2
skyblock-stats-546a17f36f4aa15122aeee5d0887bf5e13a5fade.zip
Show a message when a player has no profiles
Diffstat (limited to 'src')
-rw-r--r--src/routes/player/[player]/index.svelte90
1 files changed, 47 insertions, 43 deletions
diff --git a/src/routes/player/[player]/index.svelte b/src/routes/player/[player]/index.svelte
index 97cb0d2..a04086d 100644
--- a/src/routes/player/[player]/index.svelte
+++ b/src/routes/player/[player]/index.svelte
@@ -84,52 +84,56 @@
<Username player={data.player} headType="3d" />'s profiles
</h1>
- <ul class="profile-list">
- {#each data.profiles ?? [] as profile}
- <li
- class="profile-list-item"
- class:profile-list-item-active={profile.uuid === activeProfile?.uuid}
- class:profile-list-item-online={profile.uuid === activeProfile?.uuid &&
- isActiveProfileOnline}
- >
- <a
- class="profile-name"
- href="/player/{data.player?.username}/{profile.name}"
- sveltekit:prefetch
+ {#if data.profiles && data.profiles.length > 0}
+ <ul class="profile-list">
+ {#each data.profiles ?? [] as profile}
+ <li
+ class="profile-list-item"
+ class:profile-list-item-active={profile.uuid === activeProfile?.uuid}
+ class:profile-list-item-online={profile.uuid === activeProfile?.uuid &&
+ isActiveProfileOnline}
>
- {profile.name}
- </a>
- {#if profile.mode !== 'normal'}
- <Tooltip>
- <span slot="tooltip">
- {cleanId(profile.mode)} mode
- </span>
- <Emoji value={MODE_EMOJIS[profile.mode] ?? DEFAULT_MODE_EMOJI} />
- </Tooltip>
- {/if}
- <span class="profile-members">
- {#if (profile.members?.length ?? 0) > 1}
- {#each profile.members?.filter(m => !m.left) ?? [] as player}
- <span class="member">
- <Username
- {player}
- headType="2d"
- hyperlinkToProfile={player.uuid != data.player?.uuid}
- />
+ <a
+ class="profile-name"
+ href="/player/{data.player?.username}/{profile.name}"
+ sveltekit:prefetch
+ >
+ {profile.name}
+ </a>
+ {#if profile.mode !== 'normal'}
+ <Tooltip>
+ <span slot="tooltip">
+ {cleanId(profile.mode)} mode
</span>
- {/each}
- {#each profile.members?.filter(m => m.left) ?? [] as player}
- <span class="member">
- <Username {player} headType="2d" hyperlinkToProfile={profile.uuid} disabled />
- </span>
- {/each}
- {:else}
- Solo
+ <Emoji value={MODE_EMOJIS[profile.mode] ?? DEFAULT_MODE_EMOJI} />
+ </Tooltip>
{/if}
- </span>
- </li>
- {/each}
- </ul>
+ <span class="profile-members">
+ {#if (profile.members?.length ?? 0) > 1}
+ {#each profile.members?.filter(m => !m.left) ?? [] as player}
+ <span class="member">
+ <Username
+ {player}
+ headType="2d"
+ hyperlinkToProfile={player.uuid != data.player?.uuid}
+ />
+ </span>
+ {/each}
+ {#each profile.members?.filter(m => m.left) ?? [] as player}
+ <span class="member">
+ <Username {player} headType="2d" hyperlinkToProfile={profile.uuid} disabled />
+ </span>
+ {/each}
+ {:else}
+ Solo
+ {/if}
+ </span>
+ </li>
+ {/each}
+ </ul>
+ {:else}
+ <p>This player has no profiles. <Emoji value="😦" /></p>
+ {/if}
</main>
<style>