From a5d4d163e18d2d9f36082e938df7674b4afeb2e5 Mon Sep 17 00:00:00 2001 From: Gregoire Parant Date: Fri, 10 Dec 2021 01:51:40 +0100 Subject: [PATCH 1/9] Add test mode `*` char permit to defined test mode with warning message Signed-off-by: Gregoire Parant --- .../WarningContainer/WarningContainer.svelte | 9 ++++++++- front/src/Connexion/ConnectionManager.ts | 10 +++++++++- front/src/Connexion/Room.ts | 4 ++-- front/src/Stores/GameStore.ts | 2 ++ front/src/Url/UrlManager.ts | 3 +++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/front/src/Components/WarningContainer/WarningContainer.svelte b/front/src/Components/WarningContainer/WarningContainer.svelte index dd61d8fc..2f832fbd 100644 --- a/front/src/Components/WarningContainer/WarningContainer.svelte +++ b/front/src/Components/WarningContainer/WarningContainer.svelte @@ -1,9 +1,10 @@
@@ -14,6 +15,12 @@ >here

+ {:else if $limitMap} +

+ Your are une test mode. This map will be opened during 2 days. You can register your domain here! +

{:else}

This world is close to its limit!

{/if} diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index 05d84367..aae3f386 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -8,9 +8,10 @@ import { CharacterTexture, LocalUser } from "./LocalUser"; import { Room } from "./Room"; import { _ServiceWorker } from "../Network/ServiceWorker"; import { loginSceneVisibleIframeStore } from "../Stores/LoginSceneStore"; -import { userIsConnected } from "../Stores/MenuStore"; +import { userIsConnected, warningContainerStore } from "../Stores/MenuStore"; import { analyticsClient } from "../Administration/AnalyticsClient"; import { axiosWithRetry } from "./AxiosUtils"; +import { limitMap } from "../Stores/GameStore"; class ConnectionManager { private localUser!: LocalUser; @@ -148,6 +149,7 @@ class ConnectionManager { } else if ( connexionType === GameConnexionTypes.organization || connexionType === GameConnexionTypes.anonymous || + connexionType === GameConnexionTypes.limit || connexionType === GameConnexionTypes.empty ) { this.authToken = localUserStore.getAuthToken(); @@ -228,6 +230,12 @@ class ConnectionManager { analyticsClient.identifyUser(this.localUser.uuid, this.localUser.email); } + //if limit room active test headband + if (connexionType === GameConnexionTypes.limit) { + warningContainerStore.activateWarningContainer(); + limitMap.set(true); + } + this.serviceWorker = new _ServiceWorker(); return Promise.resolve(this._currentRoom); } diff --git a/front/src/Connexion/Room.ts b/front/src/Connexion/Room.ts index 044d8d67..3e36f84c 100644 --- a/front/src/Connexion/Room.ts +++ b/front/src/Connexion/Room.ts @@ -32,7 +32,7 @@ export class Room { if (this.id.startsWith("/")) { this.id = this.id.substr(1); } - if (this.id.startsWith("_/")) { + if (this.id.startsWith("_/") || this.id.startsWith("*/")) { this.isPublic = true; } else if (this.id.startsWith("@/")) { this.isPublic = false; @@ -138,7 +138,7 @@ export class Room { } if (this.isPublic) { - const match = /_\/([^/]+)\/.+/.exec(this.id); + const match = /[_*]\/([^/]+)\/.+/.exec(this.id); if (!match) throw new Error('Could not extract instance from "' + this.id + '"'); this.instance = match[1]; return this.instance; diff --git a/front/src/Stores/GameStore.ts b/front/src/Stores/GameStore.ts index eada6d26..1ad975ee 100644 --- a/front/src/Stores/GameStore.ts +++ b/front/src/Stores/GameStore.ts @@ -5,3 +5,5 @@ export const userMovingStore = writable(false); export const requestVisitCardsStore = writable(null); export const userIsAdminStore = writable(false); + +export const limitMap = writable(false); diff --git a/front/src/Url/UrlManager.ts b/front/src/Url/UrlManager.ts index 50dbedc9..8a39354d 100644 --- a/front/src/Url/UrlManager.ts +++ b/front/src/Url/UrlManager.ts @@ -9,6 +9,7 @@ export enum GameConnexionTypes { unknown, jwt, login, + limit, } //this class is responsible with analysing and editing the game's url @@ -19,6 +20,8 @@ class UrlManager { return GameConnexionTypes.login; } else if (url === "/jwt") { return GameConnexionTypes.jwt; + } else if (url.includes("*/")) { + return GameConnexionTypes.limit; } else if (url.includes("_/")) { return GameConnexionTypes.anonymous; } else if (url.includes("@/")) { From 9357afd13f9a63554bf191e16b1d0ff8b408bf2a Mon Sep 17 00:00:00 2001 From: Gregoire Parant Date: Fri, 10 Dec 2021 01:54:48 +0100 Subject: [PATCH 2/9] Update warning container Signed-off-by: Gregoire Parant --- front/src/Components/WarningContainer/WarningContainer.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/front/src/Components/WarningContainer/WarningContainer.svelte b/front/src/Components/WarningContainer/WarningContainer.svelte index 2f832fbd..29a6740f 100644 --- a/front/src/Components/WarningContainer/WarningContainer.svelte +++ b/front/src/Components/WarningContainer/WarningContainer.svelte @@ -8,8 +8,8 @@
-

Warning!

{#if $userIsAdminStore} +

Warning!

This world is close to its limit!. You can upgrade its capacity here!

{:else} +

Warning!

This world is close to its limit!

{/if}
From fd64fc43a4c062e529bbde8559bf6791cc5a4ba1 Mon Sep 17 00:00:00 2001 From: Gregoire Parant Date: Thu, 23 Dec 2021 13:09:28 +0100 Subject: [PATCH 3/9] Finish 2 days room limit - Create modal to register when limit is past - Create modal to share the link - Use UrlManager to check if limit room is active Signed-off-by: Gregoire Parant --- front/src/Components/App.svelte | 13 +++ front/src/Components/Menu/GuestSubMenu.svelte | 4 +- front/src/Components/Menu/MenuIcon.svelte | 21 +++- .../Components/Modal/LimitRoomModal.svelte | 45 +++++++++ .../Components/Modal/ShareLinkMapModal.svelte | 90 ++++++++++++++++++ .../WarningContainer/WarningContainer.svelte | 7 +- .../Components/images/logo-invite-pixel.png | Bin 0 -> 1104 bytes .../Components/images/logo-register-pixel.png | Bin 0 -> 977 bytes front/src/Connexion/ConnectionManager.ts | 10 +- front/src/Stores/GameStore.ts | 2 +- front/src/Stores/ModalStore.ts | 4 + front/src/Url/UrlManager.ts | 9 ++ 12 files changed, 194 insertions(+), 11 deletions(-) create mode 100644 front/src/Components/Modal/LimitRoomModal.svelte create mode 100644 front/src/Components/Modal/ShareLinkMapModal.svelte create mode 100644 front/src/Components/images/logo-invite-pixel.png create mode 100644 front/src/Components/images/logo-register-pixel.png create mode 100644 front/src/Stores/ModalStore.ts diff --git a/front/src/Components/App.svelte b/front/src/Components/App.svelte index 4886cc4e..cee819e1 100644 --- a/front/src/Components/App.svelte +++ b/front/src/Components/App.svelte @@ -23,6 +23,9 @@ import { chatVisibilityStore } from "../Stores/ChatStore"; import { helpCameraSettingsVisibleStore } from "../Stores/HelpCameraSettingsStore"; import HelpCameraSettingsPopup from "./HelpCameraSettings/HelpCameraSettingsPopup.svelte"; + import { showLimitRoomModalStore, showShareLinkMapModalStore } from "../Stores/ModalStore"; + import LimitRoomModal from "./Modal/LimitRoomModal.svelte"; + import ShareLinkMapModal from "./Modal/ShareLinkMapModal.svelte"; import AudioPlaying from "./UI/AudioPlaying.svelte"; import { soundPlayingStore } from "../Stores/SoundPlayingStore"; import ErrorDialog from "./UI/ErrorDialog.svelte"; @@ -129,6 +132,16 @@ {/if} + {#if $showLimitRoomModalStore} +
+ +
+ {/if} + {#if $showShareLinkMapModalStore} +
+ +
+ {/if} {#if $requestVisitCardsStore} {/if} diff --git a/front/src/Components/Menu/GuestSubMenu.svelte b/front/src/Components/Menu/GuestSubMenu.svelte index 0ae25b75..408dcbce 100644 --- a/front/src/Components/Menu/GuestSubMenu.svelte +++ b/front/src/Components/Menu/GuestSubMenu.svelte @@ -21,12 +21,12 @@
-

Share the link of the room !

+

Share the link of the room!

diff --git a/front/src/Components/Menu/MenuIcon.svelte b/front/src/Components/Menu/MenuIcon.svelte index bb5a2df2..90248115 100644 --- a/front/src/Components/Menu/MenuIcon.svelte +++ b/front/src/Components/Menu/MenuIcon.svelte @@ -1,9 +1,14 @@
- open menu - open menu + {#if $limitMapStore} + open menu + open menu + {:else} + open menu + open menu + {/if}
diff --git a/front/src/Components/Modal/ShareLinkMapModal.svelte b/front/src/Components/Modal/ShareLinkMapModal.svelte new file mode 100644 index 00000000..5f84e791 --- /dev/null +++ b/front/src/Components/Modal/ShareLinkMapModal.svelte @@ -0,0 +1,90 @@ + + + + + diff --git a/front/src/Components/WarningContainer/WarningContainer.svelte b/front/src/Components/WarningContainer/WarningContainer.svelte index 29a6740f..1c5f7793 100644 --- a/front/src/Components/WarningContainer/WarningContainer.svelte +++ b/front/src/Components/WarningContainer/WarningContainer.svelte @@ -1,6 +1,6 @@ -
+

Limit of your room

Register your account!

-

This map is limited in the time and to continue to use WorkAdventure, you must register your account in our back office.

+

+ This map is limited in the time and to continue to use WorkAdventure, you must register your account in our + back office. +

@@ -20,26 +22,26 @@
diff --git a/front/src/Components/Modal/ShareLinkMapModal.svelte b/front/src/Components/Modal/ShareLinkMapModal.svelte index 25cde5bd..42ac1294 100644 --- a/front/src/Components/Modal/ShareLinkMapModal.svelte +++ b/front/src/Components/Modal/ShareLinkMapModal.svelte @@ -1,15 +1,16 @@ -
-
+