Fix pretier

Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
Gregoire Parant 2021-12-23 15:06:32 +01:00
parent 96d46e96c2
commit efa57d2754
6 changed files with 64 additions and 61 deletions

View File

@ -7,8 +7,8 @@
import { chatVisibilityStore } from "../../Stores/ChatStore"; import { chatVisibilityStore } from "../../Stores/ChatStore";
import { limitMapStore } from "../../Stores/GameStore"; import { limitMapStore } from "../../Stores/GameStore";
import { get } from "svelte/store"; import { get } from "svelte/store";
import {ADMIN_URL} from "../../Enum/EnvironmentVariable"; import { ADMIN_URL } from "../../Enum/EnvironmentVariable";
import {showShareLinkMapModalStore} from "../../Stores/ModalStore"; import { showShareLinkMapModalStore } from "../../Stores/ModalStore";
function showMenu() { function showMenu() {
menuVisiblilityStore.set(!get(menuVisiblilityStore)); menuVisiblilityStore.set(!get(menuVisiblilityStore));
@ -18,7 +18,7 @@
} }
function register() { function register() {
window.open(`${ADMIN_URL}/second-step-register`, '_self'); window.open(`${ADMIN_URL}/second-step-register`, "_self");
} }
function showInvite() { function showInvite() {
showShareLinkMapModalStore.set(true); showShareLinkMapModalStore.set(true);

View File

@ -1,18 +1,20 @@
<script lang="typescript"> <script lang="typescript">
import { fly } from "svelte/transition"; import { fly } from "svelte/transition";
import {ADMIN_URL} from "../../Enum/EnvironmentVariable"; import { ADMIN_URL } from "../../Enum/EnvironmentVariable";
function register(){ function register() {
window.open(`${ADMIN_URL}/second-step-register`, '_self'); window.open(`${ADMIN_URL}/second-step-register`, "_self");
} }
</script> </script>
<div class="limit-map nes-container" <div class="limit-map nes-container" transition:fly={{ y: -900, duration: 500 }}>
transition:fly={{ y: -900, duration: 500 }}>
<section> <section>
<h2>Limit of your room</h2> <h2>Limit of your room</h2>
<p>Register your account!</p> <p>Register your account!</p>
<p>This map is limited in the time and to continue to use WorkAdventure, you must register your account in our back office.</p> <p>
This map is limited in the time and to continue to use WorkAdventure, you must register your account in our
back office.
</p>
</section> </section>
<section> <section>
<button class="nes-btn is-primary" on:click|preventDefault={register}>Register</button> <button class="nes-btn is-primary" on:click|preventDefault={register}>Register</button>
@ -20,26 +22,26 @@
</div> </div>
<style lang="scss"> <style lang="scss">
.limit-map { .limit-map {
pointer-events: auto; pointer-events: auto;
background: #eceeee; background: #eceeee;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
margin-top: 10vh; margin-top: 10vh;
max-height: 80vh; max-height: 80vh;
max-width: 80vw; max-width: 80vw;
overflow: auto; overflow: auto;
text-align: center; text-align: center;
h2 { h2 {
font-family: "Press Start 2P"; font-family: "Press Start 2P";
} }
section { section {
p { p {
margin: 15px; margin: 15px;
font-family: "Press Start 2P"; font-family: "Press Start 2P";
} }
}
} }
}
</style> </style>

View File

@ -1,15 +1,16 @@
<script lang="typescript"> <script lang="typescript">
import { fly } from "svelte/transition"; import { fly } from "svelte/transition";
import {showShareLinkMapModalStore} from "../../Stores/ModalStore"; import { showShareLinkMapModalStore } from "../../Stores/ModalStore";
interface ExtNavigator extends Navigator{ interface ExtNavigator extends Navigator {
canShare?(data?: ShareData): Promise<boolean>; canShare?(data?: ShareData): Promise<boolean>;
} }
const myNavigator : ExtNavigator = window.navigator; const myNavigator: ExtNavigator = window.navigator;
const haveNavigatorSharingFeature:boolean = myNavigator && myNavigator.canShare != null && myNavigator.share != null; const haveNavigatorSharingFeature: boolean =
myNavigator && myNavigator.canShare != null && myNavigator.share != null;
let copied:boolean = false; let copied: boolean = false;
function copyLink() { function copyLink() {
try { try {
@ -18,7 +19,7 @@
input.select(); input.select();
document.execCommand("copy"); document.execCommand("copy");
copied = true; copied = true;
}catch (e){ } catch (e) {
console.error(e); console.error(e);
copied = false; copied = false;
} }
@ -41,8 +42,7 @@
} }
</script> </script>
<div class="share-link-map nes-container" <div class="share-link-map nes-container" transition:fly={{ y: -900, duration: 500 }}>
transition:fly={{ y: -900, duration: 500 }}>
<section> <section>
<h2>Invite your friends or colleagues</h2> <h2>Invite your friends or colleagues</h2>
<p>Share the link of the room!</p> <p>Share the link of the room!</p>
@ -65,26 +65,26 @@
</div> </div>
<style lang="scss"> <style lang="scss">
div.share-link-map { div.share-link-map {
pointer-events: auto; pointer-events: auto;
background: #eceeee; background: #eceeee;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
margin-top: 10vh; margin-top: 10vh;
max-height: 80vh; max-height: 80vh;
max-width: 80vw; max-width: 80vw;
overflow: auto; overflow: auto;
text-align: center; text-align: center;
h2 { h2 {
font-family: "Press Start 2P"; font-family: "Press Start 2P";
} }
section { section {
p { p {
margin: 15px; margin: 15px;
font-family: "Press Start 2P"; font-family: "Press Start 2P";
} }
}
} }
}
</style> </style>

View File

@ -11,7 +11,8 @@
{#if $userIsAdminStore} {#if $userIsAdminStore}
<h2>Warning!</h2> <h2>Warning!</h2>
<p> <p>
This world is close to its limit!. You can upgrade its capacity <a href={upgradeLink} target="_blank">here</a This world is close to its limit!. You can upgrade its capacity <a href={upgradeLink} target="_blank"
>here</a
> >
</p> </p>
{:else if $limitMapStore} {:else if $limitMapStore}

View File

@ -14,8 +14,8 @@ import { axiosWithRetry } from "./AxiosUtils";
import axios from "axios"; import axios from "axios";
import { isRegisterData } from "../Messages/JsonMessages/RegisterData"; import { isRegisterData } from "../Messages/JsonMessages/RegisterData";
import { isAdminApiData } from "../Messages/JsonMessages/AdminApiData"; import { isAdminApiData } from "../Messages/JsonMessages/AdminApiData";
import {limitMapStore} from "../Stores/GameStore"; import { limitMapStore } from "../Stores/GameStore";
import {showLimitRoomModalStore} from "../Stores/ModalStore"; import { showLimitRoomModalStore } from "../Stores/ModalStore";
class ConnectionManager { class ConnectionManager {
private localUser!: LocalUser; private localUser!: LocalUser;
@ -246,7 +246,7 @@ class ConnectionManager {
limitMapStore.set(true); limitMapStore.set(true);
//check time of map //check time of map
if(!urlManager.isActiveLimitRoom){ if (!urlManager.isActiveLimitRoom) {
showLimitRoomModalStore.set(true); showLimitRoomModalStore.set(true);
} }
} }

View File

@ -62,10 +62,10 @@ class UrlManager {
get isActiveLimitRoom(): boolean { get isActiveLimitRoom(): boolean {
const match = /\*\/(\w+)\/(?:\w+)/.exec(window.location.pathname.toString()); const match = /\*\/(\w+)\/(?:\w+)/.exec(window.location.pathname.toString());
const timestamp = match ? Number.parseInt(match[1]) : null; const timestamp = match ? Number.parseInt(match[1]) : null;
if(!timestamp){ if (!timestamp) {
return false; return false;
} }
return ((new Date()).getTime() - 48*60*60*1000) < timestamp; return new Date().getTime() - 48 * 60 * 60 * 1000 < timestamp;
} }
} }