improve renderLock events

This commit is contained in:
srgooglo 2022-10-11 13:26:19 +02:00
parent 1666d651d1
commit 0e4ad49ce0

View File

@ -9,7 +9,7 @@ import publicRoutes from "schemas/publicRoutes"
import Layouts from "layouts"
export default class Layout extends React.Component {
export default class Layout extends React.PureComponent {
progressBar = progressBar.configure({ parent: "html", showSpinner: false })
state = {
@ -20,15 +20,37 @@ export default class Layout extends React.Component {
events = {
"app.initialization.start": () => {
app.eventBus.emit("layout.render.lock")
},
"app.initialization.finish": () => {
app.eventBus.emit("layout.render.unlock")
},
"layout.render.lock": () => {
this.setState({
renderLock: true,
})
},
"app.initialization.finish": () => {
"layout.render.unlock": () => {
this.setState({
renderLock: false,
})
},
"layout.animations.fadeIn": () => {
if (app.settings.get("reduceAnimations")) {
console.warn("Skipping fadeIn animation due to `reduceAnimations` setting")
return false
}
document.querySelector("#transitionLayer").classList.add("fade-opacity-enter")
},
"layout.animations.fadeOut": () => {
if (app.settings.get("reduceAnimations")) {
console.warn("Skipping fadeOut animation due to `reduceAnimations` setting")
return false
}
document.querySelector("#transitionLayer").classList.add("fade-opacity-leave")
},
"router.transitionStart": () => {
this.progressBar.start()