support centeredContent routes declaration

This commit is contained in:
SrGooglo 2023-08-17 19:07:07 +00:00
parent ee67777649
commit d2f669b29b
2 changed files with 34 additions and 6 deletions

View File

@ -16,7 +16,8 @@ export default [
}, },
{ {
path: "/play/*", path: "/play/*",
centeredContent: true centeredContent: true,
public: true,
}, },
{ {
path: "/post/*", path: "/post/*",
@ -36,26 +37,37 @@ export default [
{ {
path: "/settings/*", path: "/settings/*",
useLayout: "default", useLayout: "default",
centeredContent: true centeredContent: {
mobile: true,
desktop: false,
},
}, },
{ {
path: "/security/*", path: "/security/*",
useLayout: "default", useLayout: "default",
centeredContent: true centeredContent: true,
}, },
{ {
path: "/music/*", path: "/music/*",
useLayout: "default", useLayout: "default",
centeredContent: true centeredContent: true,
}, },
{ {
path: "/landing/*", path: "/landing/*",
useLayout: "minimal", useLayout: "minimal",
public: true public: true,
}, },
{ {
path: "/nfc/*", path: "/nfc/*",
useLayout: "minimal", useLayout: "minimal",
public: true public: true,
},
{
path: "/",
useLayout: "default",
centeredContent: {
mobile: false,
desktop: true,
},
} }
] ]

View File

@ -97,6 +97,22 @@ function generatePageElementWrapper(route, element, bindProps) {
app.layout.set(routeDeclaration.useLayout) app.layout.set(routeDeclaration.useLayout)
} }
if (typeof routeDeclaration.centeredContent !== "undefined") {
let finalBool = null
if (typeof routeDeclaration.centeredContent === "boolean") {
finalBool = routeDeclaration.centeredContent
} else {
if (app.isMobile) {
finalBool = routeDeclaration.centeredContent?.mobile ?? null
} else {
finalBool = routeDeclaration.centeredContent?.desktop ?? null
}
}
app.layout.toggleCenteredContent(finalBool)
}
if (typeof routeDeclaration.useTitle !== "undefined") { if (typeof routeDeclaration.useTitle !== "undefined") {
if (typeof routeDeclaration.useTitle === "function") { if (typeof routeDeclaration.useTitle === "function") {
routeDeclaration.useTitle = routeDeclaration.useTitle(route, params) routeDeclaration.useTitle = routeDeclaration.useTitle(route, params)