Compare commits

..

2 Commits

Author SHA1 Message Date
6cbf0a9265 Merge branch 'master' of https://git.fascinated.cc/Fascinated/scoresaber-reloaded
All checks were successful
deploy / deploy (push) Successful in 48s
2023-10-18 05:57:26 +01:00
c07f82899c fix avatars not loading if the player doesn't have a avatar 2023-10-18 05:57:23 +01:00
2 changed files with 16 additions and 6 deletions

View File

@ -1,14 +1,22 @@
<script> <script>
import {opt} from '../../utils/js' import { opt } from '../../utils/js';
export let player; export let player;
$: avatar = opt(player, 'playerInfo.avatar') const avatar = opt(player, 'playerInfo.avatar')
// TEMP WORKAROUND UNTIL I MIGRATE TO NEW SS API
export let avatarr;
if (avatar.includes("oculus")) {
avatarr = "https://cdn.scoresaber.com/avatars/oculus.png"
} else {
avatarr = `https://cdn.scoresaber.com/avatars/${player.playerId}.jpg`
}
</script> </script>
{#if avatar} {#if avatarr}
<figure class="image is-24x24" on:click> <figure class="image is-24x24" on:click>
<img src={avatar} alt=""/> <img src={avatarr} alt=""/>
</figure> </figure>
{/if} {/if}

View File

@ -1,5 +1,6 @@
<script> <script>
import Spinner from '../Common/Spinner.svelte' import { SS_CDN_HOST } from '../../network/queues/scoresaber/page-queue';
import Spinner from '../Common/Spinner.svelte';
export let playerInfo; export let playerInfo;
export let isLoading = false; export let isLoading = false;
@ -10,7 +11,8 @@
<span class="no-image">?</span> <span class="no-image">?</span>
{#if playerInfo && playerInfo.avatar} {#if playerInfo && playerInfo.avatar}
<img src={playerInfo.avatar} class="avatar" alt="" /> <!-- TEMP WORKAROUND UNTIL I MIGRATE TO NEW SS API -->
<img src={playerInfo.avatar.replace("https://new.scoresaber.com/api/static", SS_CDN_HOST)} class="avatar" alt="" />
{/if} {/if}
<span class="spinner"> <span class="spinner">
<Spinner width="100%" height="100%"/> <Spinner width="100%" height="100%"/>