From 4f3b07d9e0e62455d190a3733916557b51578750 Mon Sep 17 00:00:00 2001
From: nicolas-arnaud
Date: Thu, 23 Mar 2023 13:46:01 +0100
Subject: [PATCH] moved usersmenu buttons to profile and removed usersMenu
---
front/src/App.svelte | 7 +-
front/src/components/Channels.svelte | 62 ++++++++-
front/src/components/Chat.svelte | 32 +----
front/src/components/Friends.svelte | 28 ++---
front/src/components/Profile.svelte | 81 +++++++++++-
front/src/components/UsersMenu.svelte | 174 --------------------------
6 files changed, 156 insertions(+), 228 deletions(-)
delete mode 100644 front/src/components/UsersMenu.svelte
diff --git a/front/src/App.svelte b/front/src/App.svelte
index 3b43f79..ff95b6f 100644
--- a/front/src/App.svelte
+++ b/front/src/App.svelte
@@ -21,7 +21,7 @@
import MatchHistory from "./components/MatchHistory.svelte";
import Friends, { addFriend } from "./components/Friends.svelte";
import Chat from "./components/Chat.svelte";
- import Channels from "./components/Channels.svelte";
+ import Channels, {openDirectChat} from "./components/Channels.svelte";
import Leaderboard from "./components/Leaderboard.svelte";
import { popup } from "./components/Alert/content";
import Pong from "./components/Pong/Pong.svelte";
@@ -43,8 +43,8 @@
function setAppState(newState: APPSTATE | string) {
if (newState === appState) return;
+ history.pushState({ appState: newState, prevState: appState }, "", newState);
appState = newState;
- history.pushState({ appState: appState, prevState: window.location.pathname }, "", appState);
}
onMount(() => {
@@ -189,7 +189,10 @@
setAppState(APPSTATE.HISTORY_ID)}
+ on:add-friend={addFriend}
+ on:invite-to-game={pong.inviteToGame}
/>
{/if}
diff --git a/front/src/components/Channels.svelte b/front/src/components/Channels.svelte
index 2c597a3..356f1a7 100644
--- a/front/src/components/Channels.svelte
+++ b/front/src/components/Channels.svelte
@@ -1,9 +1,10 @@
@@ -138,27 +137,11 @@
};
//--------------------------------------------------------------------------------/
-
- let showUserMenu = false;
- let selectedUser: string | null = null;
- function openUserMenu(username: string) {
- showUserMenu = true;
- selectedUser = username;
- }
- function closeUserMenu() {
- showUserMenu = false;
- selectedUser = "";
- }
- onMount(closeUserMenu);
-
- //--------------------------------------------------------------------------------/
-
let showChatMembers = false;
function toggleChatMembers() {
showChatMembers = !showChatMembers;
}
- //--------------------------------------------------------------------------------/
//--------------------------------------------------------------------------------/
const banUser = async (username: string) => {
@@ -335,8 +318,8 @@
{#if !message.hidden}
openUserMenu(message.author.username)}
- on:keydown={() => openUserMenu(message.author.username)}
+ on:click={() => dispatch("view-profile", message.author.username)}
+ on:keydown={() => dispatch("view-profile", message.author.username)}
style="cursor: pointer;"
>
{message.author.username}
@@ -345,17 +328,6 @@
{/each}
- {#if showUserMenu}
- dispatch("view-profile", selectedUser)}
- on:add-friend={() => dispatch("add-friend", selectedUser)}
- on:invite-to-game={() => dispatch("invite-to-game", selectedUser)}
- />
- {/if}