1
0
Fork 0
mirror of synced 2024-06-20 19:30:28 +12:00

Default app template - added screens

This commit is contained in:
Michael Shanks 2020-07-09 14:47:54 +01:00
parent b2de1ff981
commit f2e5ca3b93
4 changed files with 190 additions and 29 deletions

View file

@ -147,7 +147,10 @@ const createEmptyAppPackage = async (ctx, app) => {
app
)
await buildPage(ctx.config, app._id, "main", { page: mainJson })
await buildPage(ctx.config, app._id, "main", {
page: mainJson,
screens: await loadScreens(newAppFolder, "main"),
})
const unauthenticatedJson = await updateJsonFile(
join(appsFolder, app._id, "pages", "unauthenticated", "page.json"),
@ -156,11 +159,26 @@ const createEmptyAppPackage = async (ctx, app) => {
await buildPage(ctx.config, app._id, "unauthenticated", {
page: unauthenticatedJson,
screens: await loadScreens(newAppFolder, "unauthenticated"),
})
return newAppFolder
}
const loadScreens = async (appFolder, page) => {
const screensFolder = join(appFolder, "pages", page, "screens")
const screenFiles = (await fs.readdir(screensFolder)).filter(s =>
s.endsWith(".json")
)
let screens = []
for (let file of screenFiles) {
screens.push(await fs.readJSON(join(screensFolder, file)))
}
return screens
}
const lookupClientId = async appId => {
const masterDb = new CouchDB("client_app_lookup")
const { clientId } = await masterDb.get(appId)

View file

@ -3,47 +3,84 @@
"favicon": "./_shared/favicon.png",
"stylesheets": [],
"componentLibraries": ["@budibase/standard-components", "@budibase/materialdesign-components"],
"props" : {
"_id": "private-master-root",
"props": {
"_id": "private-master-root",
"_component": "@budibase/standard-components/container",
"_children": [
{
"_id": "c32dd256-a61c-4c41-876e-95e91c5e3a43",
"_component": "@budibase/standard-components/container",
"_id": "49e0e519-9e5e-4127-885a-ee6a0a49e2c1",
"_component": "@budibase/standard-components/Navigation",
"_styles": {
"normal": {
"background": "#e8e8ef",
"padding": "8px",
"color": "#393C44",
"display": "N/A",
"flex-direction": "column"
},
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"onLoad": [],
"type": "div",
"_instanceId": "inst_1808f0d_e1277174d255421784ef2467d470abc8",
"_instanceName": "Container",
"logoUrl": "http://acmelogos.com/images/logo-8.svg",
"title": "",
"backgroundColor": "",
"color": "",
"borderWidth": "",
"borderColor": "",
"borderStyle": "",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Navigation",
"_children": [
{
"_id": "fbd9520f-6b34-4e3e-828d-0197144568a1",
"_component": "@budibase/standard-components/heading",
"_id": "48b35328-4c91-4343-a6a3-1a1fd77b3386",
"_component": "@budibase/standard-components/link",
"_styles": {
"normal": {},
"normal": {
"font-family": "Inter",
"font-weight": "400",
"color": "#000000",
"text-decoration-line": "none",
"font-size": "16px"
},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"text": "{{ name }}",
"type": "h1",
"_instanceId": "inst_1808f0d_e1277174d255421784ef2467d470abc8",
"_instanceName": "Heading",
"url": "/",
"openInNewTab": false,
"text": "Home",
"color": "",
"hoverColor": "",
"underline": false,
"fontSize": "",
"fontFamily": "initial",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Home Link",
"_children": []
},
{
"_id": "d3325634-0945-4387-8bb3-d9d9be186c1c",
"_component": "@budibase/standard-components/link",
"_styles": {
"normal": {
"font-family": "Inter",
"font-weight": "400",
"color": "#000000",
"text-decoration-line": "none",
"font-size": "16px"
},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"url": "/screen1",
"openInNewTab": false,
"text": "Screen 1",
"color": "",
"hoverColor": "",
"underline": false,
"fontSize": "",
"fontFamily": "initial",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Screen 1 Link",
"_children": []
}
]
@ -53,9 +90,10 @@
"_component": "##builtin/screenslot",
"_styles": {
"normal": {
"padding": "8px",
"padding": "0px",
"align-items": "flex-start",
"height": "100vh"
"height": "100vh",
"background-image": "None"
},
"hover": {},
"active": {},
@ -74,14 +112,17 @@
"flex-direction": "column",
"align-items": "stretch",
"justify-content": "flex-start",
"height": "100vh"
"height": "",
"max-width": "",
"margin-right": "auto",
"margin-left": "auto"
},
"selected": {}
},
"_code": "",
"className": "",
"onLoad": []
},
},
"_css": "",
"uiFunctions": ""
}

View file

@ -0,0 +1,61 @@
{
"description": "",
"url": "",
"props": {
"_id": "d834fea2-1b3e-4320-ab34-f9009f5ecc59",
"_component": "@budibase/standard-components/container",
"_styles": {
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"onLoad": [],
"type": "div",
"_children": [
{
"_id": "ef60083f-4a02-4df3-80f3-a0d3d16847e7",
"_component": "@budibase/standard-components/heading",
"_styles": {
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"text": "Home",
"type": "h1",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Heading",
"_children": []
},
{
"_id": "6c256e06-784c-4ac0-a644-ed2f9b91d459",
"_component": "@budibase/standard-components/image",
"_styles": {
"normal": {
"width": "100%"
},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"url": "https://source.unsplash.com/Vun-71Vy2hc",
"className": "",
"description": "",
"height": "",
"width": "",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Image",
"_children": []
}
],
"_instanceName": "Home"
},
"route": "/*",
"name": "d834fea2-1b3e-4320-ab34-f9009f5ecc59"
}

View file

@ -0,0 +1,41 @@
{
"description": "",
"url": "",
"_css": "",
"props": {
"_id": "f684460e-1f79-42b4-8ffd-1f708bca93ed",
"_component": "@budibase/standard-components/container",
"_styles": {
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"onLoad": [],
"type": "div",
"_children": [
{
"_id": "7d1d6b43-b444-46a5-a75c-267fd6b5baf6",
"_component": "@budibase/standard-components/heading",
"_styles": {
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"text": "Screen1",
"type": "h1",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Heading",
"_children": []
}
],
"_instanceName": "Screen 1"
},
"route": "/screen1",
"name": "f684460e-1f79-42b4-8ffd-1f708bca93ed"
}