From d37165219c2ddea8fcda0f3463c7773b7eb79199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 24 Dec 2021 15:49:25 +0100 Subject: [PATCH] Migrating followStates and followRoles from a const object to a type restricted to only the string values allowed. This allows for more secure code (compilation checks) and simpler code too (we can pass strings instead of const values) --- front/src/Components/App.svelte | 4 +- .../Components/FollowMenu/FollowMenu.svelte | 44 ++++++++----------- front/src/Connexion/RoomConnection.ts | 6 +-- front/src/Phaser/Player/Player.ts | 26 +++++------ front/src/Stores/FollowStore.ts | 35 ++++++--------- 5 files changed, 46 insertions(+), 69 deletions(-) diff --git a/front/src/Components/App.svelte b/front/src/Components/App.svelte index f9d1c697..e9db2b77 100644 --- a/front/src/Components/App.svelte +++ b/front/src/Components/App.svelte @@ -42,7 +42,7 @@ import AudioManager from "./AudioManager/AudioManager.svelte"; import { showReportScreenStore, userReportEmpty } from "../Stores/ShowReportScreenStore"; import ReportMenu from "./ReportMenu/ReportMenu.svelte"; - import { followStateStore, followStates } from "../Stores/FollowStore"; + import { followStateStore } from "../Stores/FollowStore"; import { peerStore } from "../Stores/PeerStore"; import FollowMenu from "./FollowMenu/FollowMenu.svelte"; @@ -104,7 +104,7 @@ {/if} - {#if $followStateStore !== followStates.off || $peerStore.size > 0} + {#if $followStateStore !== "off" || $peerStore.size > 0}
diff --git a/front/src/Components/FollowMenu/FollowMenu.svelte b/front/src/Components/FollowMenu/FollowMenu.svelte index 6506b1d6..264b27ed 100644 --- a/front/src/Components/FollowMenu/FollowMenu.svelte +++ b/front/src/Components/FollowMenu/FollowMenu.svelte @@ -2,19 +2,10 @@ vim: ft=typescript -->