From 2a1af2a131f72ad5a00b6f4a4990a12fcedb0342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gr=C3=A9goire=20parant?= Date: Thu, 29 Jul 2021 16:42:31 +0200 Subject: [PATCH 1/7] PWA service workers (#1319) * PWA services worker - [x] Register service worker of PWA to install WorkAdventure application on desktop and mobile - [x] Create webpage specifique for PWA - [ ] Add register service to save and redirect on a card - [ ] Add possibilities to install PWA for one World (with register token if existing) * Finish PWA strategy to load last map visited * Fix feedback @Kharhamel * Fix feedback @Kharhamel --- front/dist/index.tmpl.html | 1 + front/dist/resources/service-worker.html | 62 ++++++++++++++ front/dist/resources/service-worker.js | 12 ++- .../dist/static/images/favicons/manifest.json | 5 +- front/src/Connexion/ConnectionManager.ts | 21 +++-- front/src/Connexion/LocalUserStore.ts | 80 ++++++++++--------- front/src/Network/ServiceWorker.ts | 20 +++++ front/src/index.ts | 13 --- 8 files changed, 156 insertions(+), 58 deletions(-) create mode 100644 front/dist/resources/service-worker.html create mode 100644 front/src/Network/ServiceWorker.ts diff --git a/front/dist/index.tmpl.html b/front/dist/index.tmpl.html index 30ea8353..187e513a 100644 --- a/front/dist/index.tmpl.html +++ b/front/dist/index.tmpl.html @@ -34,6 +34,7 @@ WorkAdventure +
diff --git a/front/dist/resources/service-worker.html b/front/dist/resources/service-worker.html new file mode 100644 index 00000000..45615b1a --- /dev/null +++ b/front/dist/resources/service-worker.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + WorkAdventure PWA + + + + + WorkAdventure logo +

Charging your workspace ...

+ + + \ No newline at end of file diff --git a/front/dist/resources/service-worker.js b/front/dist/resources/service-worker.js index e496f7fc..d9509b6f 100644 --- a/front/dist/resources/service-worker.js +++ b/front/dist/resources/service-worker.js @@ -48,6 +48,14 @@ self.addEventListener('fetch', function(event) { ); }); -self.addEventListener('activate', function(event) { - //TODO activate service worker +self.addEventListener('wait', function(event) { + //TODO wait +}); + +self.addEventListener('update', function(event) { + //TODO update +}); + +self.addEventListener('beforeinstallprompt', (e) => { + //TODO change prompt }); \ No newline at end of file diff --git a/front/dist/static/images/favicons/manifest.json b/front/dist/static/images/favicons/manifest.json index 30d08769..9f9e9af1 100644 --- a/front/dist/static/images/favicons/manifest.json +++ b/front/dist/static/images/favicons/manifest.json @@ -128,11 +128,12 @@ "type": "image\/png" } ], - "start_url": "/", + "start_url": "/resources/service-worker.html", "background_color": "#000000", "display_override": ["window-control-overlay", "minimal-ui"], "display": "standalone", - "scope": "/", + "orientation": "portrait-primary", + "scope": "/resources/", "lang": "en", "theme_color": "#000000", "shortcuts": [ diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index 0c459629..bca7f692 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -6,6 +6,7 @@ import { GameConnexionTypes, urlManager } from "../Url/UrlManager"; import { localUserStore } from "./LocalUserStore"; import { CharacterTexture, LocalUser } from "./LocalUser"; import { Room } from "./Room"; +import { _ServiceWorker } from "../Network/ServiceWorker"; class ConnectionManager { private localUser!: LocalUser; @@ -14,6 +15,8 @@ class ConnectionManager { private reconnectingTimeout: NodeJS.Timeout | null = null; private _unloading: boolean = false; + private serviceWorker?: _ServiceWorker; + get unloading() { return this._unloading; } @@ -30,6 +33,8 @@ class ConnectionManager { public async initGameConnexion(): Promise { const connexionType = urlManager.getGameConnexionType(); this.connexionType = connexionType; + + let room: Room | null = null; if (connexionType === GameConnexionTypes.register) { const organizationMemberToken = urlManager.getOrganizationToken(); const data = await Axios.post(`${PUSHER_URL}/register`, { organizationMemberToken }).then( @@ -40,7 +45,7 @@ class ConnectionManager { const roomUrl = data.roomUrl; - const room = await Room.createRoom( + room = await Room.createRoom( new URL( window.location.protocol + "//" + @@ -51,7 +56,6 @@ class ConnectionManager { ) ); urlManager.pushRoomIdToUrl(room); - return Promise.resolve(room); } else if ( connexionType === GameConnexionTypes.organization || connexionType === GameConnexionTypes.anonymous || @@ -90,7 +94,7 @@ class ConnectionManager { } //get detail map for anonymous login and set texture in local storage - const room = await Room.createRoom(new URL(roomPath)); + room = await Room.createRoom(new URL(roomPath)); if (room.textures != undefined && room.textures.length > 0) { //check if texture was changed if (localUser.textures.length === 0) { @@ -107,10 +111,13 @@ class ConnectionManager { this.localUser = localUser; localUserStore.saveUser(localUser); } - return Promise.resolve(room); + } + if (room == undefined) { + return Promise.reject(new Error("Invalid URL")); } - return Promise.reject(new Error("Invalid URL")); + this.serviceWorker = new _ServiceWorker(); + return Promise.resolve(room); } private async verifyToken(token: string): Promise { @@ -148,6 +155,7 @@ class ConnectionManager { viewport, companion ); + connection.onConnectError((error: object) => { console.log("An error occurred while connecting to socket server. Retrying"); reject(error); @@ -166,6 +174,9 @@ class ConnectionManager { }); connection.onConnect((connect: OnConnectInterface) => { + //save last room url connected + localUserStore.setLastRoomUrl(roomUrl); + resolve(connect); }); }).catch((err) => { diff --git a/front/src/Connexion/LocalUserStore.ts b/front/src/Connexion/LocalUserStore.ts index ace7b17e..065c8839 100644 --- a/front/src/Connexion/LocalUserStore.ts +++ b/front/src/Connexion/LocalUserStore.ts @@ -1,60 +1,61 @@ -import {areCharacterLayersValid, isUserNameValid, LocalUser} from "./LocalUser"; +import { areCharacterLayersValid, isUserNameValid, LocalUser } from "./LocalUser"; -const playerNameKey = 'playerName'; -const selectedPlayerKey = 'selectedPlayer'; -const customCursorPositionKey = 'customCursorPosition'; -const characterLayersKey = 'characterLayers'; -const companionKey = 'companion'; -const gameQualityKey = 'gameQuality'; -const videoQualityKey = 'videoQuality'; -const audioPlayerVolumeKey = 'audioVolume'; -const audioPlayerMuteKey = 'audioMute'; -const helpCameraSettingsShown = 'helpCameraSettingsShown'; -const fullscreenKey = 'fullscreen'; +const playerNameKey = "playerName"; +const selectedPlayerKey = "selectedPlayer"; +const customCursorPositionKey = "customCursorPosition"; +const characterLayersKey = "characterLayers"; +const companionKey = "companion"; +const gameQualityKey = "gameQuality"; +const videoQualityKey = "videoQuality"; +const audioPlayerVolumeKey = "audioVolume"; +const audioPlayerMuteKey = "audioMute"; +const helpCameraSettingsShown = "helpCameraSettingsShown"; +const fullscreenKey = "fullscreen"; +const lastRoomUrl = "lastRoomUrl"; class LocalUserStore { saveUser(localUser: LocalUser) { - localStorage.setItem('localUser', JSON.stringify(localUser)); + localStorage.setItem("localUser", JSON.stringify(localUser)); } - getLocalUser(): LocalUser|null { - const data = localStorage.getItem('localUser'); + getLocalUser(): LocalUser | null { + const data = localStorage.getItem("localUser"); return data ? JSON.parse(data) : null; } - setName(name:string): void { + setName(name: string): void { localStorage.setItem(playerNameKey, name); } - getName(): string|null { - const value = localStorage.getItem(playerNameKey) || ''; + getName(): string | null { + const value = localStorage.getItem(playerNameKey) || ""; return isUserNameValid(value) ? value : null; } setPlayerCharacterIndex(playerCharacterIndex: number): void { - localStorage.setItem(selectedPlayerKey, ''+playerCharacterIndex); + localStorage.setItem(selectedPlayerKey, "" + playerCharacterIndex); } getPlayerCharacterIndex(): number { - return parseInt(localStorage.getItem(selectedPlayerKey) || ''); + return parseInt(localStorage.getItem(selectedPlayerKey) || ""); } - setCustomCursorPosition(activeRow:number, selectedLayers: number[]): void { - localStorage.setItem(customCursorPositionKey, JSON.stringify({activeRow, selectedLayers})); + setCustomCursorPosition(activeRow: number, selectedLayers: number[]): void { + localStorage.setItem(customCursorPositionKey, JSON.stringify({ activeRow, selectedLayers })); } - getCustomCursorPosition(): {activeRow:number, selectedLayers:number[]}|null { + getCustomCursorPosition(): { activeRow: number; selectedLayers: number[] } | null { return JSON.parse(localStorage.getItem(customCursorPositionKey) || "null"); } setCharacterLayers(layers: string[]): void { localStorage.setItem(characterLayersKey, JSON.stringify(layers)); } - getCharacterLayers(): string[]|null { + getCharacterLayers(): string[] | null { const value = JSON.parse(localStorage.getItem(characterLayersKey) || "null"); return areCharacterLayersValid(value) ? value : null; } - setCompanion(companion: string|null): void { + setCompanion(companion: string | null): void { return localStorage.setItem(companionKey, JSON.stringify(companion)); } - getCompanion(): string|null { + getCompanion(): string | null { const companion = JSON.parse(localStorage.getItem(companionKey) || "null"); if (typeof companion !== "string" || companion === "") { @@ -68,45 +69,52 @@ class LocalUserStore { } setGameQualityValue(value: number): void { - localStorage.setItem(gameQualityKey, '' + value); + localStorage.setItem(gameQualityKey, "" + value); } getGameQualityValue(): number { - return parseInt(localStorage.getItem(gameQualityKey) || '60'); + return parseInt(localStorage.getItem(gameQualityKey) || "60"); } setVideoQualityValue(value: number): void { - localStorage.setItem(videoQualityKey, '' + value); + localStorage.setItem(videoQualityKey, "" + value); } getVideoQualityValue(): number { - return parseInt(localStorage.getItem(videoQualityKey) || '20'); + return parseInt(localStorage.getItem(videoQualityKey) || "20"); } setAudioPlayerVolume(value: number): void { - localStorage.setItem(audioPlayerVolumeKey, '' + value); + localStorage.setItem(audioPlayerVolumeKey, "" + value); } getAudioPlayerVolume(): number { - return parseFloat(localStorage.getItem(audioPlayerVolumeKey) || '1'); + return parseFloat(localStorage.getItem(audioPlayerVolumeKey) || "1"); } setAudioPlayerMuted(value: boolean): void { localStorage.setItem(audioPlayerMuteKey, value.toString()); } getAudioPlayerMuted(): boolean { - return localStorage.getItem(audioPlayerMuteKey) === 'true'; + return localStorage.getItem(audioPlayerMuteKey) === "true"; } setHelpCameraSettingsShown(): void { - localStorage.setItem(helpCameraSettingsShown, '1'); + localStorage.setItem(helpCameraSettingsShown, "1"); } getHelpCameraSettingsShown(): boolean { - return localStorage.getItem(helpCameraSettingsShown) === '1'; + return localStorage.getItem(helpCameraSettingsShown) === "1"; } setFullscreen(value: boolean): void { localStorage.setItem(fullscreenKey, value.toString()); } getFullscreen(): boolean { - return localStorage.getItem(fullscreenKey) === 'true'; + return localStorage.getItem(fullscreenKey) === "true"; + } + + setLastRoomUrl(roomUrl: string): void { + localStorage.setItem(lastRoomUrl, roomUrl.toString()); + } + getLastRoomUrl(): string { + return localStorage.getItem(lastRoomUrl) ?? ""; } } diff --git a/front/src/Network/ServiceWorker.ts b/front/src/Network/ServiceWorker.ts new file mode 100644 index 00000000..9bbcca85 --- /dev/null +++ b/front/src/Network/ServiceWorker.ts @@ -0,0 +1,20 @@ +export class _ServiceWorker { + constructor() { + if ("serviceWorker" in navigator) { + this.init(); + } + } + + init() { + window.addEventListener("load", () => { + navigator.serviceWorker + .register("/resources/service-worker.js") + .then((serviceWorker) => { + console.info("Service Worker registered: ", serviceWorker); + }) + .catch((error) => { + console.error("Error registering the Service Worker: ", error); + }); + }); + } +} diff --git a/front/src/index.ts b/front/src/index.ts index da243bde..6d2931a7 100644 --- a/front/src/index.ts +++ b/front/src/index.ts @@ -162,16 +162,3 @@ const app = new App({ }); export default app; - -if ("serviceWorker" in navigator) { - window.addEventListener("load", function () { - navigator.serviceWorker - .register("/resources/service-worker.js") - .then((serviceWorker) => { - console.log("Service Worker registered: ", serviceWorker); - }) - .catch((error) => { - console.error("Error registering the Service Worker: ", error); - }); - }); -} From 7ffe564e8eddcfdc0ef8c20d09f43405934e83f9 Mon Sep 17 00:00:00 2001 From: GRL78 <80678534+GRL78@users.noreply.github.com> Date: Thu, 29 Jul 2021 17:42:16 +0200 Subject: [PATCH 2/7] Graphic upgrade of the global message console (#1287) * Graphic upgrade of the global message console Fix: error if LoginScene doesn't exist * Rework graphic of global message console * Rework graphic of global message console * Remove console.log --- .../ConsoleGlobalMessageManager.svelte | 152 +++++++++++++++--- .../InputTextGlobalMessage.svelte | 60 ++++--- .../UploadAudioGlobalMessage.svelte | 136 ++++++++-------- front/src/Phaser/Game/Game.ts | 37 +++-- front/style/index.scss | 2 +- .../inputTextGlobalMessageSvelte-Style.scss | 24 +++ front/style/svelte-style.scss | 60 ------- 7 files changed, 273 insertions(+), 198 deletions(-) create mode 100644 front/style/inputTextGlobalMessageSvelte-Style.scss delete mode 100644 front/style/svelte-style.scss diff --git a/front/src/Components/ConsoleGlobalMessageManager/ConsoleGlobalMessageManager.svelte b/front/src/Components/ConsoleGlobalMessageManager/ConsoleGlobalMessageManager.svelte index 83837f28..eee061d0 100644 --- a/front/src/Components/ConsoleGlobalMessageManager/ConsoleGlobalMessageManager.svelte +++ b/front/src/Components/ConsoleGlobalMessageManager/ConsoleGlobalMessageManager.svelte @@ -1,12 +1,27 @@ + -
- -
-

Global Message

-
- -
- {#if inputSendTextActive} - - {/if} - {#if uploadMusicActive} - - {/if} -
+
+ +
+
+

Global Message

+ +
+
+ {#if inputSendTextActive} + + {/if} + {#if uploadMusicActive} + + {/if} +
+
-
\ No newline at end of file +
+ + + + diff --git a/front/src/Components/ConsoleGlobalMessageManager/InputTextGlobalMessage.svelte b/front/src/Components/ConsoleGlobalMessageManager/InputTextGlobalMessage.svelte index c11b4b0e..217e1710 100644 --- a/front/src/Components/ConsoleGlobalMessageManager/InputTextGlobalMessage.svelte +++ b/front/src/Components/ConsoleGlobalMessageManager/InputTextGlobalMessage.svelte @@ -1,15 +1,14 @@ -
-
- -
diff --git a/front/src/Components/ConsoleGlobalMessageManager/UploadAudioGlobalMessage.svelte b/front/src/Components/ConsoleGlobalMessageManager/UploadAudioGlobalMessage.svelte index 50954005..cae6bc7c 100644 --- a/front/src/Components/ConsoleGlobalMessageManager/UploadAudioGlobalMessage.svelte +++ b/front/src/Components/ConsoleGlobalMessageManager/UploadAudioGlobalMessage.svelte @@ -1,12 +1,11 @@ + +
+

Warning!

+

This world is close to its limit!

+
+ + \ No newline at end of file diff --git a/front/src/Connexion/RoomConnection.ts b/front/src/Connexion/RoomConnection.ts index 521a8473..f37c59d2 100644 --- a/front/src/Connexion/RoomConnection.ts +++ b/front/src/Connexion/RoomConnection.ts @@ -32,7 +32,8 @@ import { EmotePromptMessage, SendUserMessage, BanUserMessage, - VariableMessage, ErrorMessage, + VariableMessage, + ErrorMessage, } from "../Messages/generated/messages_pb"; import type { UserSimplePeerInterface } from "../WebRtc/SimplePeer"; @@ -54,9 +55,9 @@ import { import type { BodyResourceDescriptionInterface } from "../Phaser/Entity/PlayerTextures"; import { adminMessagesService } from "./AdminMessagesService"; import { worldFullMessageStream } from "./WorldFullMessageStream"; -import { worldFullWarningStream } from "./WorldFullWarningStream"; import { connectionManager } from "./ConnectionManager"; import { emoteEventStream } from "./EmoteEventStream"; +import { warningContainerStore } from "../Stores/MenuStore"; const manualPingDelay = 20000; @@ -167,7 +168,7 @@ export class RoomConnection implements RoomConnection { emoteEventStream.fire(emoteMessage.getActoruserid(), emoteMessage.getEmote()); } else if (subMessage.hasErrormessage()) { const errorMessage = subMessage.getErrormessage() as ErrorMessage; - console.error('An error occurred server side: '+errorMessage.getMessage()); + console.error("An error occurred server side: " + errorMessage.getMessage()); } else if (subMessage.hasVariablemessage()) { event = EventMessage.SET_VARIABLE; payload = subMessage.getVariablemessage(); @@ -192,7 +193,14 @@ export class RoomConnection implements RoomConnection { try { variables.set(variable.getName(), JSON.parse(variable.getValue())); } catch (e) { - console.error('Unable to unserialize value received from server for variable "'+variable.getName()+'". Value received: "'+variable.getValue()+'". Error: ', e); + console.error( + 'Unable to unserialize value received from server for variable "' + + variable.getName() + + '". Value received: "' + + variable.getValue() + + '". Error: ', + e + ); } } @@ -236,7 +244,7 @@ export class RoomConnection implements RoomConnection { } else if (message.hasBanusermessage()) { adminMessagesService.onSendusermessage(message.getBanusermessage() as BanUserMessage); } else if (message.hasWorldfullwarningmessage()) { - worldFullWarningStream.onMessage(); + warningContainerStore.activateWarningContainer(); } else if (message.hasRefreshroommessage()) { //todo: implement a way to notify the user the room was refreshed. } else { @@ -659,7 +667,14 @@ export class RoomConnection implements RoomConnection { try { value = JSON.parse(serializedValue); } catch (e) { - console.error('Unable to unserialize value received from server for variable "'+name+'". Value received: "'+serializedValue+'". Error: ', e); + console.error( + 'Unable to unserialize value received from server for variable "' + + name + + '". Value received: "' + + serializedValue + + '". Error: ', + e + ); } } callback(name, value); diff --git a/front/src/Connexion/WorldFullWarningStream.ts b/front/src/Connexion/WorldFullWarningStream.ts deleted file mode 100644 index 5e552830..00000000 --- a/front/src/Connexion/WorldFullWarningStream.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {Subject} from "rxjs"; - -class WorldFullWarningStream { - - private _stream:Subject = new Subject(); - public stream = this._stream.asObservable(); - - - onMessage() { - this._stream.next(); - } -} - -export const worldFullWarningStream = new WorldFullWarningStream(); \ No newline at end of file diff --git a/front/src/Phaser/Components/WarningContainer.ts b/front/src/Phaser/Components/WarningContainer.ts deleted file mode 100644 index 97e97660..00000000 --- a/front/src/Phaser/Components/WarningContainer.ts +++ /dev/null @@ -1,14 +0,0 @@ - -export const warningContainerKey = 'warningContainer'; -export const warningContainerHtml = 'resources/html/warningContainer.html'; - -export class WarningContainer extends Phaser.GameObjects.DOMElement { - - constructor(scene: Phaser.Scene) { - super(scene, 100, 0); - this.setOrigin(0, 0); - this.createFromCache(warningContainerKey); - this.scene.add.existing(this); - } - -} \ No newline at end of file diff --git a/front/src/Phaser/Menu/MenuScene.ts b/front/src/Phaser/Menu/MenuScene.ts index 4e9297b6..5c8949a7 100644 --- a/front/src/Phaser/Menu/MenuScene.ts +++ b/front/src/Phaser/Menu/MenuScene.ts @@ -6,8 +6,6 @@ import { localUserStore } from "../../Connexion/LocalUserStore"; import { gameReportKey, gameReportRessource, ReportMenu } from "./ReportMenu"; import { connectionManager } from "../../Connexion/ConnectionManager"; import { GameConnexionTypes } from "../../Url/UrlManager"; -import { WarningContainer, warningContainerHtml, warningContainerKey } from "../Components/WarningContainer"; -import { worldFullWarningStream } from "../../Connexion/WorldFullWarningStream"; import { menuIconVisible } from "../../Stores/MenuStore"; import { videoConstraintStore } from "../../Stores/MediaStore"; import { showReportScreenStore } from "../../Stores/ShowReportScreenStore"; @@ -45,8 +43,6 @@ export class MenuScene extends Phaser.Scene { private gameQualityValue: number; private videoQualityValue: number; private menuButton!: Phaser.GameObjects.DOMElement; - private warningContainer: WarningContainer | null = null; - private warningContainerTimeout: NodeJS.Timeout | null = null; private subscriptions = new Subscription(); constructor() { super({ key: MenuSceneName }); @@ -91,7 +87,6 @@ export class MenuScene extends Phaser.Scene { this.load.html(gameSettingsMenuKey, "resources/html/gameQualityMenu.html"); this.load.html(gameShare, "resources/html/gameShare.html"); this.load.html(gameReportKey, gameReportRessource); - this.load.html(warningContainerKey, warningContainerHtml); } create() { @@ -147,7 +142,6 @@ export class MenuScene extends Phaser.Scene { this.menuElement.addListener("click"); this.menuElement.on("click", this.onMenuClick.bind(this)); - worldFullWarningStream.stream.subscribe(() => this.showWorldCapacityWarning()); chatVisibilityStore.subscribe((v) => { this.menuButton.setVisible(!v); }); @@ -194,20 +188,6 @@ export class MenuScene extends Phaser.Scene { }); } - private showWorldCapacityWarning() { - if (!this.warningContainer) { - this.warningContainer = new WarningContainer(this); - } - if (this.warningContainerTimeout) { - clearTimeout(this.warningContainerTimeout); - } - this.warningContainerTimeout = setTimeout(() => { - this.warningContainer?.destroy(); - this.warningContainer = null; - this.warningContainerTimeout = null; - }, 120000); - } - private closeSideMenu(): void { if (!this.sideMenuOpened) return; this.sideMenuOpened = false; diff --git a/front/src/Stores/MenuStore.ts b/front/src/Stores/MenuStore.ts index c7c02130..084e8ce8 100644 --- a/front/src/Stores/MenuStore.ts +++ b/front/src/Stores/MenuStore.ts @@ -1,3 +1,23 @@ -import { derived, writable, Writable } from "svelte/store"; +import { writable } from "svelte/store"; +import Timeout = NodeJS.Timeout; export const menuIconVisible = writable(false); + +let warningContainerTimeout: Timeout | null = null; +function createWarningContainerStore() { + const { subscribe, set } = writable(false); + + return { + subscribe, + activateWarningContainer() { + set(true); + if (warningContainerTimeout) clearTimeout(warningContainerTimeout); + warningContainerTimeout = setTimeout(() => { + set(false); + warningContainerTimeout = null; + }, 120000); + }, + }; +} + +export const warningContainerStore = createWarningContainerStore(); From ebdcf8804d7ab72a51bac10eeb476467caa16f43 Mon Sep 17 00:00:00 2001 From: kharhamel Date: Fri, 30 Jul 2021 14:08:27 +0200 Subject: [PATCH 5/7] added admin link to the warning container --- .github/workflows/continuous_integration.yml | 1 + .github/workflows/push-to-npm.yml | 1 + .../WarningContainer/WarningContainer.svelte | 13 ++++++++- front/src/Enum/EnvironmentVariable.ts | 28 ++++++++++--------- front/src/Phaser/Game/GameScene.ts | 3 ++ front/src/Phaser/Menu/MenuScene.ts | 3 +- front/src/Stores/GameStore.ts | 4 ++- front/webpack.config.ts | 2 +- 8 files changed, 38 insertions(+), 17 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index faf50c7a..ecd7ffef 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -50,6 +50,7 @@ jobs: run: yarn run build env: PUSHER_URL: "//localhost:8080" + ADMIN_URL: "//localhost:80" working-directory: "front" - name: "Svelte check" diff --git a/.github/workflows/push-to-npm.yml b/.github/workflows/push-to-npm.yml index fd247b11..1208e0c0 100644 --- a/.github/workflows/push-to-npm.yml +++ b/.github/workflows/push-to-npm.yml @@ -47,6 +47,7 @@ jobs: run: yarn run build-typings env: PUSHER_URL: "//localhost:8080" + ADMIN_URL: "//localhost:80" working-directory: "front" # We build the front to generate the typings of iframe_api, then we copy those typings in a separate package. diff --git a/front/src/Components/WarningContainer/WarningContainer.svelte b/front/src/Components/WarningContainer/WarningContainer.svelte index 26961357..57b956e2 100644 --- a/front/src/Components/WarningContainer/WarningContainer.svelte +++ b/front/src/Components/WarningContainer/WarningContainer.svelte @@ -1,14 +1,25 @@

Warning!

-

This world is close to its limit!

+ {#if $userIsAdminStore} +

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

+ {:else} +

This world is close to its limit!

+ {/if} +