Make side project info closeable

This commit is contained in:
tobspr 2022-06-22 10:29:50 +02:00
parent 5627d656cc
commit befd8a7877
2 changed files with 35 additions and 2 deletions

View File

@ -186,6 +186,23 @@
transition: transform 0.5s ease-in-out;
}
.close {
position: absolute;
pointer-events: all;
background: uiResource("icons/main_menu_exit.png") center center / 50% no-repeat;
display: inline-flex;
@include S(width, 15px);
@include S(height, 15px);
@include S(top, 2px);
opacity: 0.3;
@include S(right, 2px);
z-index: 200;
transition: opacity 0.12s ease-in-out;
&:hover {
opacity: 0.7;
}
}
&:hover::before {
transform: translate(0, -51%);
}

View File

@ -4,6 +4,7 @@ import { GameState } from "../core/game_state";
import { DialogWithForm } from "../core/modal_dialog_elements";
import { FormElementInput } from "../core/modal_dialog_forms";
import { ReadWriteProxy } from "../core/read_write_proxy";
import { STOP_PROPAGATION } from "../core/signal";
import { WEB_STEAM_SSO_AUTHENTICATED } from "../core/steam_sso";
import {
formatSecondsToTimeAgo,
@ -73,6 +74,8 @@ export class MainMenuState extends GameState {
!G_IS_STEAM_DEMO &&
/** @type { PlatformWrapperImplElectron}*/ (this.app.platformWrapper).dlcs.puzzle);
const showKiwiClicker = window.localStorage.getItem("hide_kiwi_clicker") !== "1";
const bannerHtml = `
<h3>${T.demoBanners.titleV2}</h3>
@ -195,10 +198,15 @@ export class MainMenuState extends GameState {
}
<div class="mainNews kiwiClicker">
${
showKiwiClicker
? `<div class="mainNews kiwiClicker">
<div class="text">Check out this small side project I am working on right now!</div>
<div class="close"></div>
</div>
</div>`
: ""
}
`
: ""
}
@ -451,6 +459,7 @@ export class MainMenuState extends GameState {
".steamLink": this.onSteamLinkClicked,
".steamLinkSocial": this.onSteamLinkClickedSocial,
".kiwiClicker": this.onKiwiClickerClicked,
".kiwiClicker .close": this.hideKiwiClicker,
".discordLink": () => {
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.discord);
},
@ -571,6 +580,13 @@ export class MainMenuState extends GameState {
);
}
hideKiwiClicker() {
window.localStorage.setItem("hide_kiwi_clicker", "1");
this.htmlElement.querySelector(".kiwiClicker").remove();
return STOP_PROPAGATION;
}
onBackButtonClicked() {
this.renderMainMenu();
this.renderSavegames();