@@ -66,9 +76,7 @@
class:member={m.id_code == $member.id_code}
class="online"
title={$member.isAdmin && !m.isAdmin ? 'Bannir' : ''}
- on:click={() => {
- $member.isAdmin && !m.isAdmin && send('ban', { member_id: m.id_code });
- }}
+ on:click={(e)=>ban(m)}
on:keydown={() => {}}
>
{m.username}
@@ -90,9 +98,7 @@
class:bannable={m.id_code != $member.id_code && $member.isAdmin && !m.isAdmin}
class:member={m.id_code == $member.id_code}
title={$member.isAdmin && !m.isAdmin ? 'Bannir' : ''}
- on:click={() => {
- $member.isAdmin && !m.isAdmin && send('ban', { member_id: m.id_code });
- }}
+ on:click={(e)=>ban(m)}
on:keydown={() => {}}
>
{m.username}
diff --git a/frontend/src/routes/room/+page.svelte b/frontend/src/routes/room/+page.svelte
index a8e81bb..f48720e 100644
--- a/frontend/src/routes/room/+page.svelte
+++ b/frontend/src/routes/room/+page.svelte
@@ -1,6 +1,7 @@
@@ -26,4 +27,5 @@
display: flex;
gap: 20px;
}
+
\ No newline at end of file
diff --git a/frontend/src/routes/room/[...slug]/+page.svelte b/frontend/src/routes/room/[...slug]/+page.svelte
index 8899508..004ff5c 100644
--- a/frontend/src/routes/room/[...slug]/+page.svelte
+++ b/frontend/src/routes/room/[...slug]/+page.svelte
@@ -102,6 +102,7 @@
return;
}
if ($room != null) {
+ info("Départ", `*${data.member.username}* n'est plus dans la salle`);
$room.members = [
...$room.members.filter((r) => "waiter_id" in r || r.id_code != data.member.id_code)
];
@@ -211,6 +212,7 @@
case "joined":
if ($room != null) {
+ info("Arrivée", `*${data.member.username}* a rejoint la salle`)
$room.members = [
...$room?.members.filter(
(m) =>
@@ -358,6 +360,7 @@
$parcours.validated = $parcours.pb.mistakes <= $parcours.max_mistakes;
}
}
+ return
case "challenge_change":
if ($parcours != null && $member != null && !!$parcours.challenges[data.member]) {
$parcours.challenges[data.member].challenges = $parcours.challenges[
@@ -447,6 +450,7 @@
$: console.log("edit", $page.url.searchParams.get("a"));
onDestroy(() => {
+
ws.close(1000);
});
diff --git a/frontend/src/routes/room/create/+page.svelte b/frontend/src/routes/room/create/+page.svelte
index b103dd0..15bf8d6 100644
--- a/frontend/src/routes/room/create/+page.svelte
+++ b/frontend/src/routes/room/create/+page.svelte
@@ -7,6 +7,8 @@
let name = "";
let pseudo = "";
const { isAuth } = getContext("auth");
+ let loading = false;
+ const { error } = getContext("notif");
@@ -20,15 +22,27 @@
class="primary-btn"
on:click={() => {
console.log('(NAME)', name)
+ loading = true
createRoom({ name }, !$isAuth ? pseudo : null).then((r) => {
+
if(!$isAuth){
sessionStorage.setItem('reconnect', r.member)
}
goto(`/room/${r.room}`);
- });
+ loading= false
+ }).catch((e) => {
+ error("Erreur", "Une erreur est survenue lors de la création de la salle")
+ loading= false
+ console.log(e);
+ });
}}
>
- Valider
+ {#if loading}
+
+ {:else}
+ Créer
+ {/if}
+
@@ -51,4 +65,10 @@
display: flex;
justify-content: center;
}
+
+ .spinner {
+ width: 15px;
+ height: 15px;
+ border-width: 2px !important;
+ }
diff --git a/frontend/src/routes/room/join/+page.svelte b/frontend/src/routes/room/join/+page.svelte
index cb62362..a595325 100644
--- a/frontend/src/routes/room/join/+page.svelte
+++ b/frontend/src/routes/room/join/+page.svelte
@@ -4,7 +4,6 @@
let room = "";
-
diff --git a/frontend/src/routes/signin/+page.svelte b/frontend/src/routes/signin/+page.svelte
index 0f1792d..04b7c10 100644
--- a/frontend/src/routes/signin/+page.svelte
+++ b/frontend/src/routes/signin/+page.svelte
@@ -11,6 +11,7 @@
$: {
!$initialLoading && !!$isAuth && goto('/dashboard');
}
+ let loading = false
@@ -37,13 +38,19 @@
@@ -65,4 +72,9 @@
gap: 20px;
}
}
+ .spinner{
+ width: 15px;
+ height: 15px;
+ border-width: 2px!important;
+ }
diff --git a/frontend/src/routes/signup/+page.svelte b/frontend/src/routes/signup/+page.svelte
index 059ba95..6d04d24 100644
--- a/frontend/src/routes/signup/+page.svelte
+++ b/frontend/src/routes/signup/+page.svelte
@@ -18,6 +18,7 @@
const myForm = form(username, password, confirm);
$: !$initialLoading && !!$isAuth && goto('/dashboard');
+ let loading = false
@@ -62,7 +63,9 @@
@@ -92,4 +100,9 @@
gap: 20px;
}
}
+ .spinner{
+ width: 15px;
+ height: 15px;
+ border-width: 2px!important;
+ }
diff --git a/frontend/src/store/ws.ts b/frontend/src/store/ws.ts
index 54e7e0b..fb3113c 100644
--- a/frontend/src/store/ws.ts
+++ b/frontend/src/store/ws.ts
@@ -9,7 +9,6 @@ export const connect = (url,) => {
const ws = new ReconnectingWebSocket(url);
ws.onmessage = (m) => {
- console.log('MESAGE', m)
messages.update((o) => [JSON.parse(m.data), ...o]);
Object.values(get(handlers)).map(h => {