support centeredContent routes declaration

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

View File

@ -16,7 +16,8 @@ export default [
},
{
path: "/play/*",
centeredContent: true
centeredContent: true,
public: true,
},
{
path: "/post/*",
@ -36,26 +37,37 @@ export default [
{
path: "/settings/*",
useLayout: "default",
centeredContent: true
centeredContent: {
mobile: true,
desktop: false,
},
},
{
path: "/security/*",
useLayout: "default",
centeredContent: true
centeredContent: true,
},
{
path: "/music/*",
useLayout: "default",
centeredContent: true
centeredContent: true,
},
{
path: "/landing/*",
useLayout: "minimal",
public: true
public: true,
},
{
path: "/nfc/*",
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)
}
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 === "function") {
routeDeclaration.useTitle = routeDeclaration.useTitle(route, params)