diff --git a/src/App.svelte b/src/App.svelte index e8ef384..61e987c 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -2,6 +2,7 @@ import Navbar from './components/NavBar.svelte'; import Profile from './components/Profile.svelte'; import MatchHistory from './components/MatchHistory.svelte'; + import Friends from './components/Friends.svelte'; let isProfileOpen = false; function clickProfile() { isProfileOpen = true; @@ -11,12 +12,34 @@ isHistoryOpen = true; } let matches = [ - {winner : "Alice", loser : "Bob"}, + {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 : "10", rank : "24"}, + {winner : "Alice", loser : "Bob", points : "10", rank : "24"}, + ] + let isFriendOpen = false; + function clickFriends() { + isFriendOpen = true; + } + let friends = [ + {username : "Alice", status : "online"}, + {username : "Bob", status : "online"}, + {username : "Charlie", status : "offline"}, + {username : "Dave", status : "offline"}, + {username : "Eve", status : "online"}, + {username : "Frank", status : "online"}, ]
- + + {#if isFriendOpen} +
isFriendOpen = false} on:keydown={() => isFriendOpen = false}> + +
+ {/if} {#if isHistoryOpen}
isHistoryOpen = false} on:keydown={() => isHistoryOpen = false}> diff --git a/src/components/Friends.svelte b/src/components/Friends.svelte new file mode 100644 index 0000000..857836f --- /dev/null +++ b/src/components/Friends.svelte @@ -0,0 +1,42 @@ + + +
+
+
+ {#if friends.length > 0} + {#each friends.slice(0, 10) as friends} +
  • + {friends.username} is {friends.status} +
  • + {/each} + {:else} +

    No friends to display

    + {/if} +
    +
    +
    + + \ No newline at end of file diff --git a/src/components/MatchHistory.svelte b/src/components/MatchHistory.svelte index 030bf94..2fb1aef 100644 --- a/src/components/MatchHistory.svelte +++ b/src/components/MatchHistory.svelte @@ -6,12 +6,14 @@
    {#if matches.length > 0} - {#each matches as match} -
  • - {match.winner} vs {match.loser} - {match.winner} won 1-0 -
  • - {/each} + {#each matches.slice(0, 10) as match} +
  • + {match.winner} vs {match.loser} + {match.winner} won 1-0 + points won : {match.points} + rank #{match.rank} +
  • + {/each} {:else}

    No matches to display

    {/if} diff --git a/src/components/NavBar.svelte b/src/components/NavBar.svelte index 075ec15..9564b86 100644 --- a/src/components/NavBar.svelte +++ b/src/components/NavBar.svelte @@ -5,16 +5,25 @@ { text: "Spectate", url: "/Spectate"}, { text: "Chat", url: "/Chat"}, { text: "History", url: "/History"}, + { text: "Friends", url: "/Friends"}, { text: "Profile", url: "/Profile" } ]; - export let clickProfile; - export let clickHistory; + export let clickProfile = () => {}; + export let clickHistory = () => {}; + export let clickFriends = () => {};