fix avatars not loading if the player doesn't have a avatar
This commit is contained in:
parent
de1987bfec
commit
c07f82899c
@ -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}
|
||||||
|
|
||||||
|
@ -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%"/>
|
||||||
|
Reference in New Issue
Block a user