Adding semi-opaque overlay to avoid interation with the app without login.
This commit is contained in:
parent
90d85ed4af
commit
d73ff6692a
@ -16,14 +16,23 @@ export default class Login {
|
|||||||
private conquerRegisterRepeatPassword: HTMLInputElement
|
private conquerRegisterRepeatPassword: HTMLInputElement
|
||||||
private conquerRegisterSubmit: HTMLButtonElement
|
private conquerRegisterSubmit: HTMLButtonElement
|
||||||
private conquerRegisterError: HTMLParagraphElement
|
private conquerRegisterError: HTMLParagraphElement
|
||||||
|
private conquerOverlayTransparent: HTMLDivElement
|
||||||
|
|
||||||
public async enableLogIfNeeded() {
|
public async enableLogIfNeeded() {
|
||||||
|
this.fillOverlay()
|
||||||
this.fillConquerLogin()
|
this.fillConquerLogin()
|
||||||
this.fillConquerRegister()
|
this.fillConquerRegister()
|
||||||
this.checkLogin()
|
this.checkLogin()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async fillOverlay() {
|
||||||
|
const conquerOverlayTransparent = document.querySelector('.conquer-overlay-transparent')
|
||||||
|
if (conquerOverlayTransparent === null || !(conquerOverlayTransparent instanceof HTMLDivElement)) {
|
||||||
|
Conquer.fail('No overlay found')
|
||||||
|
}
|
||||||
|
this.conquerOverlayTransparent = conquerOverlayTransparent
|
||||||
|
}
|
||||||
|
|
||||||
private async fillConquerLogin() {
|
private async fillConquerLogin() {
|
||||||
const conquerLogin = document.querySelector('.conquer-login')
|
const conquerLogin = document.querySelector('.conquer-login')
|
||||||
if (conquerLogin === null || !(conquerLogin instanceof HTMLDivElement)) {
|
if (conquerLogin === null || !(conquerLogin instanceof HTMLDivElement)) {
|
||||||
@ -168,6 +177,7 @@ export default class Login {
|
|||||||
this.conquerRegisterError.classList.remove('conquer-display-none')
|
this.conquerRegisterError.classList.remove('conquer-display-none')
|
||||||
}
|
}
|
||||||
private async removeLoginRegisterCombo(): Promise<void> {
|
private async removeLoginRegisterCombo(): Promise<void> {
|
||||||
|
this.conquerOverlayTransparent.classList.add('conquer-display-none')
|
||||||
this.conquerLogin.classList.add('conquer-display-none')
|
this.conquerLogin.classList.add('conquer-display-none')
|
||||||
this.conquerRegister.classList.add('conquer-display-none')
|
this.conquerRegister.classList.add('conquer-display-none')
|
||||||
}
|
}
|
||||||
@ -176,6 +186,7 @@ export default class Login {
|
|||||||
const isLogged = await this.isLogged()
|
const isLogged = await this.isLogged()
|
||||||
if (!isLogged) {
|
if (!isLogged) {
|
||||||
this.conquerLogin.classList.remove('conquer-display-none')
|
this.conquerLogin.classList.remove('conquer-display-none')
|
||||||
|
this.conquerOverlayTransparent.classList.remove('conquer-display-none')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.onLoginSuccess()
|
this.onLoginSuccess()
|
||||||
|
@ -18,7 +18,17 @@ body {
|
|||||||
border: solid 1px black; }
|
border: solid 1px black; }
|
||||||
body p.conquer-login-success {
|
body p.conquer-login-success {
|
||||||
color: green; }
|
color: green; }
|
||||||
|
body div.conquer-overlay-transparent {
|
||||||
|
background: black;
|
||||||
|
opacity: 50%;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1; }
|
||||||
body div.conquer-login, body div.conquer-register {
|
body div.conquer-login, body div.conquer-register {
|
||||||
|
border: 1px solid black;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
color: black;
|
color: black;
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
|
@ -29,11 +29,14 @@ body {
|
|||||||
color: green;
|
color: green;
|
||||||
}
|
}
|
||||||
div.conquer-overlay-transparent {
|
div.conquer-overlay-transparent {
|
||||||
|
background: black;
|
||||||
|
opacity: 50%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
div.conquer-login,div.conquer-register {
|
div.conquer-login,div.conquer-register {
|
||||||
form {
|
form {
|
||||||
@ -43,6 +46,7 @@ body {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
border: 1px solid black;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
color: black;
|
color: black;
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user