From 14c0caa61b9d0cc3d3746d259fbc25c913525c97 Mon Sep 17 00:00:00 2001 From: WalidMoovin Date: Wed, 15 Feb 2023 22:34:58 +0100 Subject: [PATCH] adding friends, some cleaning --- src/App.svelte | 4 ++-- src/components/Friends.svelte | 27 +++++++++++++++++++++++++++ src/components/MatchHistory.svelte | 12 ++++++++---- src/components/Profile.svelte | 4 ++-- src/components/Spectate.svelte | 2 ++ 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 780e161..8418216 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -14,10 +14,10 @@ isHistoryOpen = true; } let matches = [ + {winner : "Alice", loser : "Bob", points : "-5", rank : "22"}, {winner : "Alice", loser : "Bob", points : "10", rank : "24"}, {winner : "Alice", loser : "Bob", points : "10", rank : "24"}, - {winner : "Alice", loser : "Bob", points : "10", rank : "24"}, - {winner : "Alice", loser : "Bob", points : "10", rank : "24"}, + {winner : "Alice", loser : "Bob", points : "7", rank : "23"}, {winner : "Alice", loser : "Bob", points : "10", rank : "24"}, {winner : "Alice", loser : "Bob", points : "10", rank : "24"}, ] diff --git a/src/components/Friends.svelte b/src/components/Friends.svelte index e09a816..e9f1f85 100644 --- a/src/components/Friends.svelte +++ b/src/components/Friends.svelte @@ -1,11 +1,31 @@
{#if friends.length > 0} +

Monkey friends

{#each friends.slice(0, 10) as friends}
  • {friends.username} is {friends.status} @@ -14,6 +34,13 @@ {:else}

    No friends to display

    {/if} +
    +

    Add a friend

    +
    + + +
    +
  • diff --git a/src/components/MatchHistory.svelte b/src/components/MatchHistory.svelte index 06a1d0b..1c23d3e 100644 --- a/src/components/MatchHistory.svelte +++ b/src/components/MatchHistory.svelte @@ -6,12 +6,16 @@
    {#if matches.length > 0} +

    Last 10 monkey games

    {#each matches.slice(0, 10) as match}
  • - {match.winner} vs {match.loser} - {match.winner} won 1-0 - points won : {match.points} - rank #{match.rank} + {match.winner} 1 - 0 {match.loser} + {#if match.points > 0} + +{match.points} + {:else} + {match.points} + {/if} + MP | rank #{match.rank}
  • {/each} {:else} diff --git a/src/components/Profile.svelte b/src/components/Profile.svelte index 892ca9a..6df0b59 100644 --- a/src/components/Profile.svelte +++ b/src/components/Profile.svelte @@ -8,7 +8,7 @@ export let is2faEnabled = false; async function handleSubmit (event) { event.preventDefault(); - // const res = await fetch('', { + // const response = await fetch('', { // method: 'POST', // headers: { // 'Content-Type': 'application/json' @@ -17,7 +17,7 @@ // username // }) // }); - // if (res.ok) { + // if (response.ok) { // console.log('username updated'); // } // else { diff --git a/src/components/Spectate.svelte b/src/components/Spectate.svelte index 072c25c..09a49af 100644 --- a/src/components/Spectate.svelte +++ b/src/components/Spectate.svelte @@ -7,6 +7,7 @@
    {#if spectate.length > 0} +

    Monkey spectating

    {#each spectate.slice(0, 10) as spectate}
  • {spectate.player1} VS {spectate.player2} @@ -41,4 +42,5 @@ padding: 1rem; width: 300px; } + \ No newline at end of file