workadventure/front/src/Components/Menu/MenuIcon.svelte

120 lines
3.1 KiB
Svelte
Raw Normal View History

<script lang="typescript">
2021-12-06 16:12:37 +01:00
import logoTalk from "../images/logo-message-pixel.png";
2021-12-01 11:14:54 +01:00
import logoWA from "../images/logo-WA-pixel.png";
import logoInvite from "../images/logo-invite-pixel.png";
import logoRegister from "../images/logo-register-pixel.png";
2021-12-06 16:12:37 +01:00
import { menuVisiblilityStore } from "../../Stores/MenuStore";
import { chatVisibilityStore } from "../../Stores/ChatStore";
import { limitMapStore } from "../../Stores/GameStore";
2021-12-06 16:12:37 +01:00
import { get } from "svelte/store";
import { ADMIN_URL } from "../../Enum/EnvironmentVariable";
import { showShareLinkMapModalStore } from "../../Stores/ModalStore";
2022-01-21 17:06:03 +01:00
import LL from "../../i18n/i18n-svelte";
2021-12-06 16:12:37 +01:00
function showMenu() {
menuVisiblilityStore.set(!get(menuVisiblilityStore));
}
2022-01-05 10:27:40 +01:00
2021-12-06 16:12:37 +01:00
function showChat() {
chatVisibilityStore.set(true);
}
function register() {
window.open(`${ADMIN_URL}/second-step-register`, "_self");
}
2022-01-05 10:27:40 +01:00
function showInvite() {
showShareLinkMapModalStore.set(true);
}
2022-01-05 10:27:40 +01:00
function noDrag() {
return false;
}
</script>
2021-12-06 16:12:37 +01:00
<svelte:window />
2022-01-05 10:27:40 +01:00
<main class="menuIcon noselect">
{#if $limitMapStore}
2021-12-19 16:01:51 +01:00
<img
src={logoInvite}
2022-01-21 17:06:03 +01:00
alt={$LL.menu.icon.open.invite()}
2021-12-19 16:01:51 +01:00
class="nes-pointer"
2022-01-05 10:27:40 +01:00
draggable="false"
on:dragstart|preventDefault={noDrag}
2021-12-19 16:01:51 +01:00
on:click|preventDefault={showInvite}
/>
<img
src={logoRegister}
2022-01-21 17:06:03 +01:00
alt={$LL.menu.icon.open.register()}
2021-12-19 16:01:51 +01:00
class="nes-pointer"
2022-01-05 10:27:40 +01:00
draggable="false"
on:dragstart|preventDefault={noDrag}
2021-12-19 16:01:51 +01:00
on:click|preventDefault={register}
/>
{:else}
2022-01-05 10:27:40 +01:00
<img
src={logoWA}
alt={$LL.menu.icon.open.menu()}
class="nes-pointer"
draggable="false"
on:dragstart|preventDefault={noDrag}
on:click|preventDefault={showMenu}
/>
<img
src={logoTalk}
alt={$LL.menu.icon.open.chat()}
class="nes-pointer"
draggable="false"
on:dragstart|preventDefault={noDrag}
on:click|preventDefault={showChat}
/>
{/if}
</main>
<style lang="scss">
2022-01-05 10:27:40 +01:00
@import "../../../style/breakpoints.scss";
2022-01-05 10:30:27 +01:00
.menuIcon {
2022-01-05 10:27:40 +01:00
display: flex;
flex-direction: column;
align-items: center;
margin-top: 20%;
z-index: 800;
2021-12-06 16:12:37 +01:00
position: relative;
2022-01-05 10:27:40 +01:00
2021-12-06 16:12:37 +01:00
img {
pointer-events: auto;
width: 60px;
padding-top: 0;
2022-01-05 10:27:40 +01:00
margin: 5%;
2021-12-07 13:56:28 +01:00
}
}
2022-01-05 10:30:27 +01:00
2021-12-06 16:12:37 +01:00
.menuIcon img:hover {
transform: scale(1.2);
2021-12-01 10:26:09 +01:00
}
2022-01-05 10:30:27 +01:00
2022-01-05 10:27:40 +01:00
@include media-breakpoint-up(sm) {
2021-12-06 16:12:37 +01:00
.menuIcon {
2022-01-05 10:27:40 +01:00
margin-top: 10%;
2021-12-06 16:12:37 +01:00
img {
2021-12-07 13:56:28 +01:00
pointer-events: auto;
width: 60px;
padding-top: 0;
}
}
.menuIcon img:hover {
transform: scale(1.2);
}
2022-01-05 10:27:40 +01:00
}
@include media-breakpoint-up(md) {
.menuIcon {
img {
width: 50px;
2021-12-06 16:12:37 +01:00
}
}
}
</style>