2020-03-31 11:50:13 +02:00
|
|
|
<script>
|
2020-05-07 11:53:34 +02:00
|
|
|
import { store } from "builderStore"
|
2020-08-03 15:59:50 +02:00
|
|
|
import api from "builderStore/api"
|
2020-04-02 15:16:46 +02:00
|
|
|
import AppList from "components/start/AppList.svelte"
|
2020-03-31 11:50:13 +02:00
|
|
|
import { onMount } from "svelte"
|
2020-05-25 17:57:17 +02:00
|
|
|
import ActionButton from "components/common/ActionButton.svelte"
|
2020-10-05 13:20:59 +02:00
|
|
|
import { get } from "builderStore/api"
|
2020-04-02 15:16:46 +02:00
|
|
|
import Spinner from "components/common/Spinner.svelte"
|
2020-05-26 16:25:37 +02:00
|
|
|
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
2020-10-08 10:35:11 +02:00
|
|
|
import { Button, Heading, Modal } from "@budibase/bbui"
|
2020-09-25 15:47:42 +02:00
|
|
|
import TemplateList from "components/start/TemplateList.svelte"
|
2020-09-29 16:26:56 +02:00
|
|
|
import analytics from "analytics"
|
2020-03-31 11:50:13 +02:00
|
|
|
|
|
|
|
let promise = getApps()
|
2020-10-02 21:41:21 +02:00
|
|
|
let hasKey
|
2020-10-05 13:20:59 +02:00
|
|
|
let template
|
2020-10-08 10:35:11 +02:00
|
|
|
let modal
|
2020-03-31 11:50:13 +02:00
|
|
|
|
|
|
|
async function getApps() {
|
2020-06-03 18:05:36 +02:00
|
|
|
const res = await get("/api/applications")
|
2020-03-31 11:50:13 +02:00
|
|
|
const json = await res.json()
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
return json
|
|
|
|
} else {
|
|
|
|
throw new Error(json)
|
|
|
|
}
|
|
|
|
}
|
2020-05-25 17:57:17 +02:00
|
|
|
|
2020-08-03 15:59:50 +02:00
|
|
|
async function fetchKeys() {
|
|
|
|
const response = await api.get(`/api/keys/`)
|
2020-09-29 16:26:56 +02:00
|
|
|
return await response.json()
|
2020-08-03 15:59:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
async function checkIfKeysAndApps() {
|
2020-09-29 16:26:56 +02:00
|
|
|
const keys = await fetchKeys()
|
2020-08-03 15:59:50 +02:00
|
|
|
const apps = await getApps()
|
2020-09-29 16:26:56 +02:00
|
|
|
if (keys.userId) {
|
2020-08-03 15:59:50 +02:00
|
|
|
hasKey = true
|
2020-09-29 16:26:56 +02:00
|
|
|
analytics.identify(keys.userId)
|
2020-10-01 10:28:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!keys.budibase) {
|
2020-10-08 10:35:11 +02:00
|
|
|
modal.show()
|
2020-08-03 15:59:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-05 13:20:59 +02:00
|
|
|
function selectTemplate(newTemplate) {
|
|
|
|
template = newTemplate
|
2020-10-08 10:35:11 +02:00
|
|
|
modal.show()
|
2020-10-05 13:20:59 +02:00
|
|
|
}
|
|
|
|
|
2020-08-03 15:59:50 +02:00
|
|
|
checkIfKeysAndApps()
|
2020-05-26 10:38:43 +02:00
|
|
|
</script>
|
2020-05-25 17:57:17 +02:00
|
|
|
|
2020-10-05 13:20:59 +02:00
|
|
|
<div class="container">
|
|
|
|
<div class="header">
|
|
|
|
<Heading medium black>Welcome to the Budibase Beta</Heading>
|
2020-10-15 10:04:39 +02:00
|
|
|
<Button primary on:click={modal.show}>Create New Web App</Button>
|
2020-10-05 13:20:59 +02:00
|
|
|
</div>
|
2020-06-04 12:56:01 +02:00
|
|
|
|
2020-10-05 13:20:59 +02:00
|
|
|
<div class="banner">
|
|
|
|
<img src="/_builder/assets/orange-landscape.png" alt="rocket" />
|
|
|
|
<div class="banner-content">
|
|
|
|
Every accomplishment starts with a decision to try.
|
|
|
|
</div>
|
2020-06-04 20:30:44 +02:00
|
|
|
</div>
|
2020-06-04 12:56:01 +02:00
|
|
|
|
2020-10-05 13:20:59 +02:00
|
|
|
<TemplateList onSelect={selectTemplate} />
|
|
|
|
|
|
|
|
<AppList />
|
|
|
|
</div>
|
2020-10-02 21:41:21 +02:00
|
|
|
|
2020-10-08 10:35:11 +02:00
|
|
|
<Modal bind:this={modal} padding={false} width="600px">
|
|
|
|
<CreateAppModal {hasKey} {template} />
|
|
|
|
</Modal>
|
|
|
|
|
2020-03-31 11:50:13 +02:00
|
|
|
<style>
|
2020-10-05 13:20:59 +02:00
|
|
|
.container {
|
|
|
|
display: grid;
|
|
|
|
gap: var(--spacing-xl);
|
|
|
|
margin: 40px 80px;
|
|
|
|
}
|
|
|
|
|
2020-07-02 12:02:31 +02:00
|
|
|
.header {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
2020-05-25 17:57:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.banner {
|
2020-06-04 12:56:01 +02:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
position: relative;
|
|
|
|
text-align: center;
|
|
|
|
color: white;
|
2020-08-11 17:57:15 +02:00
|
|
|
border-radius: 16px;
|
2020-05-25 17:57:17 +02:00
|
|
|
}
|
2020-05-25 21:26:48 +02:00
|
|
|
|
2020-06-04 12:56:01 +02:00
|
|
|
.banner img {
|
|
|
|
height: 250px;
|
|
|
|
width: 100%;
|
|
|
|
border-radius: 5px;
|
2020-06-04 20:30:44 +02:00
|
|
|
}
|
2020-05-25 21:26:48 +02:00
|
|
|
|
2020-06-04 12:56:01 +02:00
|
|
|
.banner-content {
|
|
|
|
position: absolute;
|
2020-05-25 21:26:48 +02:00
|
|
|
font-size: 24px;
|
2020-05-25 17:57:17 +02:00
|
|
|
color: var(--white);
|
|
|
|
font-weight: 500;
|
2020-03-31 11:50:13 +02:00
|
|
|
}
|
|
|
|
</style>
|