Skip to content

Commit

Permalink
FIX - Maintenance (no staff skip)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeWarpy committed Mar 8, 2024
1 parent 0450cd9 commit 1d4ed86
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/assets/css/launcher.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@import 'panels/login.css';
@import 'panels/home.css';
@import 'panels/settings.css';
@import 'panels/maintenance.css';

body {
margin: 0;
Expand Down
23 changes: 23 additions & 0 deletions src/assets/css/panels/maintenance.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.maintenance .container {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}

.maintenance-tabs {
position: absolute;
padding: 15px;
background: var(--background);
border-radius: 15px;
text-align: center;
min-width: 40%;
}

.maintenance-text {
font-size: 1.3rem;
}

.store {
text-decoration: underline;
}
6 changes: 5 additions & 1 deletion src/assets/js/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class Launcher {
if (await this.config.error) return this.errorConnect()
this.db = new database();
await this.initConfigClient();
if (this.config.maintenance == true) {
this.createPanels(Maintenance);
return changePanel('maintenance');
}
this.createPanels(Login, Home, Settings);
this.startLauncher();
}
Expand Down Expand Up @@ -144,7 +148,7 @@ class Launcher {
console.log(`Account Type: ${account.meta.type} | Username: ${account.name}`);
popupRefresh.openPopup({
title: 'Connexion',
content: `Refresh account Type: ${account.meta.type} | Username: ${account.name}`,
content: `Connecté·e en tant que ${account.name}`,
color: 'var(--color)',
background: false
});
Expand Down
11 changes: 8 additions & 3 deletions src/assets/js/panels/maintenance.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
* @license CC-BY-NC 4.0 - https://creativecommons.org/licenses/by-nc/4.0/
*/

'use strict';
import { config } from '../utils.js'

import { database } from '../utils.js';
const { ipcRenderer } = require('electron');

class Maintenance {
static id = "maintenance";
async init() {
this.database = await new database().init();
this.config = config;
this.initMsg();
this.initBtn();
}

async initMsg() {
let maintenance_message = await config.GetConfig().then(res => res.maintenance_message).catch(err => err) || "Le launcher est en maintenance, veuillez réessayer plus tard.";
if (maintenance_message) document.querySelector("#maintenance_message").innerHTML = maintenance_message;
}

initBtn() {
document.querySelector("#maintenance").addEventListener("click", () => {
ipcRenderer.send("main-window-close");
Expand Down
14 changes: 10 additions & 4 deletions src/panels/maintenance.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<div class="login-content">
<div class="login-card">
<style>
p, h2 {
color: #fff;
}
</style>
<div class="container dark">
<div class="maintenance-home maintenance-tabs">
<img style="height: 120px" src="assets/images/logo/AO.png">
<hr>
<h2>Oops, c'est pas prêt !</h2><p>Le launcher est actuellement en maintenance, veuillez réessayer plus tard.</p>
<button id="maintenance" class="login-btn">Fermer</button>
<h2>Oops, c'est pas prêt !</h2>
<p id="maintenance_message"></p>
<button id="maintenance" class="cancel cancel-home">Fermer</button>
</div>
</div>

0 comments on commit 1d4ed86

Please sign in to comment.