diff --git a/back/volume/src/users/users.service.ts b/back/volume/src/users/users.service.ts index dca34f4..2c743fc 100644 --- a/back/volume/src/users/users.service.ts +++ b/back/volume/src/users/users.service.ts @@ -30,7 +30,7 @@ export class UsersService { return user } - @Cron('0 */60 * * *') + @Cron('0 * * * * *') async updateStatus() { let users = await this.usersRepository.find({}) users.forEach((usr) => { diff --git a/docker-compose.yml b/docker-compose.yml index 1f54516..d6b48eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,7 @@ services: image: postgres ports: [5432:5432] volumes: - - /data/postgres:/data/postgres + - ./postgres:/var/lib/postgresql/data networks: [transcendence] restart: always env_file: .env diff --git a/front/volume/src/App.svelte b/front/volume/src/App.svelte index 61c72d3..11e9bd3 100644 --- a/front/volume/src/App.svelte +++ b/front/volume/src/App.svelte @@ -4,8 +4,8 @@ import Profile from "./components/Profile.svelte"; import MatchHistory from "./components/MatchHistory.svelte"; import type { Match } from "./components/MatchHistory.svelte"; - import Friends from "./components/Friends.svelte"; - import type { Friend } from "./components/Friends.svelte"; + import Friends,{addFriend} from "./components/Friends.svelte"; + import type { Friend} from "./components/Friends.svelte"; import Spectate from "./components/Spectate.svelte"; import type { SpectateType } from "./components/Spectate.svelte"; import Pong from "./components/Pong/Pong.svelte"; @@ -13,6 +13,7 @@ import Channels from "./components/Channels.svelte"; import type { ChannelsType } from "./components/Channels.svelte"; import Leaderboard from "./components/Leaderboard.svelte"; + import type { Player } from "./components/Leaderboard.svelte" import { store, getUser, login, logout, API_URL } from "./Auth"; @@ -30,6 +31,21 @@ isProfileOpen = true; } + let userProfile; + let isIdProfileOpen = false; + async function openIdProfile(event) { + console.log("Opening profile: " + event.detail) + isIdProfileOpen = true; + const res = await fetch(API_URL + "/user/" + event.detail, { + method: "get", + mode: "cors", + cache: "no-cache", + redirect: "follow", + referrerPolicy: "no-referrer", + }); + userProfile = await res.json(); + } + // HISTORY let isHistoryOpen = false; @@ -112,10 +128,20 @@ selectedChannel = channel; }; + let leaderboard: Player[] = []; + export async function getLeader(): Promise { + let response = await fetch(API_URL + "/leader", { + credentials: "include", + mode: "cors", + }); + return await response.json(); + } + // LEADERBOARD let isLeaderboardOpen = false; - function clickLeaderboard() { + async function clickLeaderboard() { isLeaderboardOpen = true; + leaderboard = await getLeader(); } @@ -139,7 +165,8 @@ on:click={() => (selectedChannel = undefined)} on:keydown={() => (selectedChannel = undefined)} > - + {/if} {#if !selectedChannel} @@ -164,7 +191,7 @@ on:click={() => (isLeaderboardOpen = false)} on:keydown={() => (isLeaderboardOpen = false)} > - + {/if} {#if isFriendOpen} @@ -173,7 +200,10 @@ isFriendOpen = false; clearInterval(friendsInterval) }} - on:keydown={() => (isFriendOpen = false)} + on:keydown={() => { + isFriendOpen = false; + clearInterval(friendsInterval) + }} > @@ -192,12 +222,19 @@ on:keydown={() => (isProfileOpen = false)} > + + {/if} + {#if isIdProfileOpen} +
(isIdProfileOpen = false)} + on:keydown={() => (isIdProfileOpen = false)} + > +
{/if} diff --git a/front/volume/src/components/Chat2.svelte b/front/volume/src/components/Chat2.svelte index 75487e0..6b18bda 100644 --- a/front/volume/src/components/Chat2.svelte +++ b/front/volume/src/components/Chat2.svelte @@ -1,10 +1,11 @@ @@ -49,11 +50,11 @@

- {message.name} + {message.author} : {message.text}

{/each} @@ -62,16 +63,16 @@
    -
  • -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
  • +
diff --git a/front/volume/src/components/Friends.svelte b/front/volume/src/components/Friends.svelte index 08a8b33..6810573 100644 --- a/front/volume/src/components/Friends.svelte +++ b/front/volume/src/components/Friends.svelte @@ -4,22 +4,13 @@ status: "online" | "offline" | "in a game"; ftId: number; } - - - + +
diff --git a/front/volume/src/components/Leaderboard.svelte b/front/volume/src/components/Leaderboard.svelte index ba40170..1aaef63 100644 --- a/front/volume/src/components/Leaderboard.svelte +++ b/front/volume/src/components/Leaderboard.svelte @@ -3,6 +3,7 @@ username: string; wins: number; losses: number; + winrate: number; rank: number; } diff --git a/front/volume/src/components/Profile.svelte b/front/volume/src/components/Profile.svelte index f8c9529..482220c 100644 --- a/front/volume/src/components/Profile.svelte +++ b/front/volume/src/components/Profile.svelte @@ -1,13 +1,15 @@