Merge pull request #408 from Budibase/welcome-screen-ui-fix

Welcome screen ui fix
This commit is contained in:
Joe 2020-07-02 11:35:53 +01:00 committed by GitHub
commit b3dc4379d5
20 changed files with 137 additions and 181 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

View File

@ -55,7 +55,7 @@
] ]
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.15.0", "@budibase/bbui": "^1.15.4",
"@budibase/client": "^0.0.32", "@budibase/client": "^0.0.32",
"@nx-js/compiler-util": "^2.0.0", "@nx-js/compiler-util": "^2.0.0",
"codemirror": "^5.51.0", "codemirror": "^5.51.0",

View File

@ -1,11 +1,5 @@
/* Budibase Component Styles */ /* Budibase Component Styles */
.header {
font-size: 0.75rem;
color: var(--ink);
text-transform: uppercase;
margin-top: 1rem;
font-weight: 500;
}
.budibase__title { .budibase__title {
font-weight: 900; font-weight: 900;

View File

@ -25,7 +25,7 @@
<style> <style>
.apps { .apps {
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, 380px); grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
grid-gap: 20px 40px; grid-gap: 20px 40px;
justify-content: start; justify-content: start;
} }

View File

@ -63,7 +63,7 @@
<span class="icon"> <span class="icon">
<AppsIcon /> <AppsIcon />
</span> </span>
<h3>Create new web app</h3> <h3 class="header">Create new web app</h3>
</div> </div>
<Input <Input
name="name" name="name"
@ -90,7 +90,7 @@
<InfoIcon /> <InfoIcon />
How to get started How to get started
</a> </a>
<Button outline thin on:click={_onCancel}>Cancel</Button> <Button secondary thin on:click={_onCancel}>Cancel</Button>
<Button primary thin on:click={_onOkay}>Save</Button> <Button primary thin on:click={_onOkay}>Save</Button>
</div> </div>
<div class="close-button" on:click={_onCancel}> <div class="close-button" on:click={_onCancel}>
@ -125,10 +125,11 @@
align-items: center; align-items: center;
margin-bottom: 20px; margin-bottom: 20px;
} }
h3 { .header {
margin: 0; margin: 0;
font-size: 24px; font-size: 24px;
font-weight: bold; font-weight: 600;
font-family: inter;
} }
.icon { .icon {
display: grid; display: grid;

View File

@ -17,7 +17,7 @@
import {keyevents} from "../actions" import {keyevents} from "../actions"
export let value = "#3ec1d3ff" export let value = "#3ec1d3ff"
export let open = false; export let open = false
export let swatches = [] //TODO: Safe swatches - limit to 12. warn in console export let swatches = [] //TODO: Safe swatches - limit to 12. warn in console
export let disableSwatches = false export let disableSwatches = false
export let format = "hexa" export let format = "hexa"
@ -41,7 +41,7 @@
getRecentColors() getRecentColors()
} }
if(colorPicker) { if (colorPicker) {
colorPicker.focus() colorPicker.focus()
} }
@ -160,7 +160,6 @@
$: border = v > 90 && s < 5 ? "1px dashed #dedada" : "" $: border = v > 90 && s < 5 ? "1px dashed #dedada" : ""
$: selectedColorStyle = buildStyle({ background: value, border }) $: selectedColorStyle = buildStyle({ background: value, border })
$: shrink = swatches.length > 0 $: shrink = swatches.length > 0
</script> </script>
<Portal> <Portal>

View File

@ -38,7 +38,6 @@
} }
}) })
function openColorpicker(event) { function openColorpicker(event) {
if (colorPreview) { if (colorPreview) {
open = true open = true
@ -62,12 +61,12 @@
const spaceBelow = window.innerHeight - bottom const spaceBelow = window.innerHeight - bottom
const previewCenter = previewWidth / 2 const previewCenter = previewWidth / 2
let y, x; let y, x
if(spaceAbove > spaceBelow) { if (spaceAbove > spaceBelow) {
positionSide = "bottom" positionSide = "bottom"
y = (window.innerHeight - spaceAbove) y = window.innerHeight - spaceAbove
}else{ } else {
positionSide = "top" positionSide = "top"
y = bottom y = bottom
} }
@ -87,7 +86,6 @@
[positionSide]: `${dimensions[positionSide]}px`, [positionSide]: `${dimensions[positionSide]}px`,
left: `${dimensions.left}px`, left: `${dimensions.left}px`,
}) })
</script> </script>
<svelte:window on:resize={debounce(calculateDimensions, 200)} /> <svelte:window on:resize={debounce(calculateDimensions, 200)} />
@ -105,19 +103,18 @@
</CheckedBackground> </CheckedBackground>
{#if open} {#if open}
<Colorpicker <Colorpicker
style={pickerStyle} style={pickerStyle}
on:change={onColorChange} on:change={onColorChange}
on:addswatch on:addswatch
on:removeswatch on:removeswatch
bind:format bind:format
bind:value bind:value
bind:pickerHeight bind:pickerHeight
bind:pickerWidth bind:pickerWidth
bind:open bind:open
{swatches} {swatches}
{disableSwatches} {disableSwatches} />
/>
<div on:click|self={() => (open = false)} class="overlay" /> <div on:click|self={() => (open = false)} class="overlay" />
{/if} {/if}
{:else} {:else}

View File

@ -1,35 +1,35 @@
<script> <script>
import { onMount } from "svelte"; import { onMount } from "svelte"
export let target = document.body; export let target = document.body
let targetEl; let targetEl
let portal; let portal
let componentInstance; let componentInstance
onMount(() => { onMount(() => {
if (typeof target === "string") { if (typeof target === "string") {
targetEl = document.querySelector(target); targetEl = document.querySelector(target)
// Force exit // Force exit
if (targetEl === null) { if (targetEl === null) {
return () => {}; return () => {}
} }
} else if (target instanceof HTMLElement) { } else if (target instanceof HTMLElement) {
targetEl = target; targetEl = target
} else { } else {
throw new TypeError( throw new TypeError(
`Unknown target type: ${typeof target}. Allowed types: String (CSS selector), HTMLElement.` `Unknown target type: ${typeof target}. Allowed types: String (CSS selector), HTMLElement.`
); )
} }
portal = document.createElement("div"); portal = document.createElement("div")
targetEl.appendChild(portal); targetEl.appendChild(portal)
portal.appendChild(componentInstance); portal.appendChild(componentInstance)
return () => { return () => {
targetEl.removeChild(portal); targetEl.removeChild(portal)
}; }
}); })
</script> </script>
<div bind:this={componentInstance}> <div bind:this={componentInstance}>

View File

@ -1,9 +1,8 @@
<script> <script>
import {onMount} from "svelte" import { onMount } from "svelte"
import PropertyGroup from "./PropertyGroup.svelte" import PropertyGroup from "./PropertyGroup.svelte"
import FlatButtonGroup from "./FlatButtonGroup.svelte" import FlatButtonGroup from "./FlatButtonGroup.svelte"
export let panelDefinition = {} export let panelDefinition = {}
export let componentInstance = {} export let componentInstance = {}
export let componentDefinition = {} export let componentDefinition = {}
@ -34,7 +33,6 @@
] ]
$: propertyGroupNames = Object.keys(panelDefinition) $: propertyGroupNames = Object.keys(panelDefinition)
</script> </script>
<div class="design-view-container"> <div class="design-view-container">
@ -55,7 +53,7 @@
{componentDefinition} {componentDefinition}
{componentInstance} {componentInstance}
open={currentGroup === groupName} open={currentGroup === groupName}
on:open={() => currentGroup = groupName} /> on:open={() => (currentGroup = groupName)} />
{/each} {/each}
{:else} {:else}
<div class="no-design"> <div class="no-design">

View File

@ -13,13 +13,13 @@
let selectMenu let selectMenu
let icon let icon
let selectAnchor = null; let selectAnchor = null
let dimensions = {top: 0, bottom: 0, left: 0} let dimensions = { top: 0, bottom: 0, left: 0 }
let positionSide = "top" let positionSide = "top"
let maxHeight = 0 let maxHeight = 0
let scrollTop = 0; let scrollTop = 0
let containerEl = null; let containerEl = null
const handleStyleBind = value => const handleStyleBind = value =>
!!styleBindingProperty ? { style: `${styleBindingProperty}: ${value}` } : {} !!styleBindingProperty ? { style: `${styleBindingProperty}: ${value}` } : {}
@ -32,51 +32,53 @@
return () => { return () => {
select.removeEventListener("keydown", handleEnter) select.removeEventListener("keydown", handleEnter)
} }
}) })
function handleEscape(e) { function handleEscape(e) {
if(open && e.key === "Escape") { if (open && e.key === "Escape") {
toggleSelect(false) toggleSelect(false)
} }
} }
function getDimensions() { function getDimensions() {
const { bottom, top: spaceAbove, left } = selectAnchor.getBoundingClientRect() const {
bottom,
top: spaceAbove,
left,
} = selectAnchor.getBoundingClientRect()
const spaceBelow = window.innerHeight - bottom const spaceBelow = window.innerHeight - bottom
let y; let y
if (spaceAbove > spaceBelow) { if (spaceAbove > spaceBelow) {
positionSide = "bottom" positionSide = "bottom"
maxHeight = spaceAbove - 20 maxHeight = spaceAbove - 20
y = (window.innerHeight - spaceAbove) y = window.innerHeight - spaceAbove
} else { } else {
positionSide = "top" positionSide = "top"
y = bottom y = bottom
maxHeight = spaceBelow - 20 maxHeight = spaceBelow - 20
} }
dimensions = {[positionSide]: y, left} dimensions = { [positionSide]: y, left }
} }
function handleEnter(e) { function handleEnter(e) {
if (!open && e.key === "Enter") { if (!open && e.key === "Enter") {
toggleSelect(true) toggleSelect(true)
} }
} }
function toggleSelect(isOpen) { function toggleSelect(isOpen) {
getDimensions() getDimensions()
if (isOpen) { if (isOpen) {
icon.style.transform = "rotate(180deg)" icon.style.transform = "rotate(180deg)"
} else { } else {
icon.style.transform = "rotate(0deg)" icon.style.transform = "rotate(0deg)"
} }
open = isOpen open = isOpen
} }
function handleClick(val) { function handleClick(val) {
value = val value = val
onChange(value) onChange(value)
@ -86,7 +88,7 @@
"max-height": `${maxHeight.toFixed(0)}px`, "max-height": `${maxHeight.toFixed(0)}px`,
"transform-origin": `center ${positionSide}`, "transform-origin": `center ${positionSide}`,
[positionSide]: `${dimensions[positionSide]}px`, [positionSide]: `${dimensions[positionSide]}px`,
"left": `${dimensions.left.toFixed(0)}px`, left: `${dimensions.left.toFixed(0)}px`,
}) })
$: isOptionsObject = options.every(o => typeof o === "object") $: isOptionsObject = options.every(o => typeof o === "object")
@ -95,7 +97,7 @@
? options.find(o => o.value === value) ? options.find(o => o.value === value)
: {} : {}
$: if(open && selectMenu) { $: if (open && selectMenu) {
selectMenu.focus() selectMenu.focus()
} }
@ -113,38 +115,38 @@
<i bind:this={icon} class="ri-arrow-down-s-fill" /> <i bind:this={icon} class="ri-arrow-down-s-fill" />
</div> </div>
{#if open} {#if open}
<Portal> <Portal>
<div <div
tabindex="0" tabindex="0"
class:open class:open
bind:this={selectMenu} bind:this={selectMenu}
style={menuStyle} style={menuStyle}
on:keydown={handleEscape} on:keydown={handleEscape}
class="bb-select-menu"> class="bb-select-menu">
<ul> <ul>
{#if isOptionsObject} {#if isOptionsObject}
{#each options as { value: v, label }} {#each options as { value: v, label }}
<li <li
{...handleStyleBind(v)} {...handleStyleBind(v)}
on:click|self={handleClick(v)} on:click|self={handleClick(v)}
class:selected={value === v}> class:selected={value === v}>
{label} {label}
</li> </li>
{/each} {/each}
{:else} {:else}
{#each options as v} {#each options as v}
<li <li
{...handleStyleBind(v)} {...handleStyleBind(v)}
on:click|self={handleClick(v)} on:click|self={handleClick(v)}
class:selected={value === v}> class:selected={value === v}>
{v} {v}
</li> </li>
{/each} {/each}
{/if} {/if}
</ul> </ul>
</div> </div>
<div on:click|self={() => toggleSelect(false)} class="overlay" /> <div on:click|self={() => toggleSelect(false)} class="overlay" />
</Portal> </Portal>
{/if} {/if}
</div> </div>

View File

@ -13,7 +13,7 @@
$: style = componentInstance["_styles"][styleCategory] || {} $: style = componentInstance["_styles"][styleCategory] || {}
</script> </script>
<DetailSummary {name} on:open show={open} > <DetailSummary {name} on:open show={open}>
{#each properties as props} {#each properties as props}
<PropertyControl <PropertyControl
label={props.label} label={props.label}

View File

@ -38,7 +38,9 @@
if (!activeTopNav) return if (!activeTopNav) return
store.update(state => { store.update(state => {
if (!state.previousTopNavPath) state.previousTopNavPath = {} if (!state.previousTopNavPath) state.previousTopNavPath = {}
state.previousTopNavPath[activeTopNav.path] = window.location.pathname.replace("/_builder", "") state.previousTopNavPath[
activeTopNav.path
] = window.location.pathname.replace("/_builder", "")
$goto(state.previousTopNavPath[path] || path) $goto(state.previousTopNavPath[path] || path)
return state return state
}) })

View File

@ -1,14 +1,15 @@
<script> <script>
import { params } from "@sveltech/routify" import { params } from "@sveltech/routify"
import { backendUiStore } from "builderStore" import { backendUiStore } from "builderStore"
if ($params.selectedModel) { if ($params.selectedModel) {
const model = $backendUiStore.models.find(m => m._id === $params.selectedModel) const model = $backendUiStore.models.find(
if (model) { m => m._id === $params.selectedModel
backendUiStore.actions.models.select(model) )
if (model) {
backendUiStore.actions.models.select(model)
}
} }
}
</script> </script>
<slot /> <slot />

View File

@ -10,7 +10,11 @@
onMount(async () => { onMount(async () => {
// navigate to first model in list, if not already selected // navigate to first model in list, if not already selected
// and this is the final url (i.e. no selectedModel) // and this is the final url (i.e. no selectedModel)
if (!$leftover && $backendUiStore.models.length > 0 && (!$backendUiStore.selectedModel || !$backendUiStore.selectedModel._id)) { if (
!$leftover &&
$backendUiStore.models.length > 0 &&
(!$backendUiStore.selectedModel || !$backendUiStore.selectedModel._id)
) {
$goto(`./${$backendUiStore.models[0]._id}`) $goto(`./${$backendUiStore.models[0]._id}`)
} }
}) })

View File

@ -8,9 +8,13 @@
} }
onMount(async () => { onMount(async () => {
// navigate to first model in list, if not already selected // navigate to first model in list, if not already selected
// and this is the final url (i.e. no selectedModel) // and this is the final url (i.e. no selectedModel)
if (!$leftover && $backendUiStore.models.length > 0 && (!$backendUiStore.selectedModel || !$backendUiStore.selectedModel._id)) { if (
!$leftover &&
$backendUiStore.models.length > 0 &&
(!$backendUiStore.selectedModel || !$backendUiStore.selectedModel._id)
) {
// this file routes as .../models/index, so, go up one. // this file routes as .../models/index, so, go up one.
$goto(`../${$backendUiStore.models[0]._id}`) $goto(`../${$backendUiStore.models[0]._id}`)
} }
@ -18,7 +22,5 @@
</script> </script>
{#if $backendUiStore.models.length === 0} {#if $backendUiStore.models.length === 0}
Please create a model Please create a model
{:else} {:else}Please select a model{/if}
Please select a model
{/if}

View File

@ -40,10 +40,7 @@
<div class="nav-section"> <div class="nav-section">
<div class="nav-section-title">Contact</div> <div class="nav-section-title">Contact</div>
<Link <Link icon={ContributionIcon} title="Contribute" href="/" />
icon={ContributionIcon}
title="Contribute to our product"
href="/" />
<Link icon={BugIcon} title="Report bug" href="/" /> <Link icon={BugIcon} title="Report bug" href="/" />
<Link icon={EmailIcon} title="Email" href="/" /> <Link icon={EmailIcon} title="Email" href="/" />
<Link icon={TwitterIcon} title="Twitter" href="/" /> <Link icon={TwitterIcon} title="Twitter" href="/" />
@ -59,7 +56,7 @@
<style> <style>
.root { .root {
display: grid; display: grid;
grid-template-columns: 300px 1fr; grid-template-columns: 260px 1fr;
height: 100%; height: 100%;
width: 100%; width: 100%;
background: var(--grey-1); background: var(--grey-1);
@ -67,6 +64,7 @@
.main { .main {
grid-column: 2; grid-column: 2;
overflow: auto;
} }
.ui-nav { .ui-nav {
@ -75,7 +73,6 @@
padding: 20px; padding: 20px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border-right: 1px solid var(--grey-4);
} }
.home-logo { .home-logo {

View File

@ -8,6 +8,7 @@
import { get } from "builderStore/api" import { get } from "builderStore/api"
import Spinner from "components/common/Spinner.svelte" import Spinner from "components/common/Spinner.svelte"
import CreateAppModal from "components/start/CreateAppModal.svelte" import CreateAppModal from "components/start/CreateAppModal.svelte"
import { Button } from "@budibase/bbui"
let promise = getApps() let promise = getApps()
@ -43,21 +44,17 @@
} }
</script> </script>
<div class="welcome">Welcome to Budibase</div> <div class="header">
<div class="welcome">Welcome to the Budibase Beta</div>
<Button purple large on:click={showCreateAppModal}>Create New Web App</Button>
</div>
<div class="banner"> <div class="banner">
<img src="/_builder/assets/rocket.jpg" alt="rocket" /> <img src="/_builder/assets/orange-landscape.png" alt="rocket" />
<div class="banner-content"> <div class="banner-content">
Every accomplishment starts with a decision to try. Every accomplishment starts with a decision to try.
</div> </div>
</div> </div>
<div class="app-section-header">
<div class="app-section-title">Your Web Apps</div>
<button class="banner-button" type="button" on:click={showCreateAppModal}>
<i class="ri-add-circle-fill" />
Create New Web App
</button>
</div>
{#await promise} {#await promise}
<div class="spinner-container"> <div class="spinner-container">
@ -70,11 +67,17 @@
{/await} {/await}
<style> <style>
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin: 40px 80px 0px 80px;
}
.welcome { .welcome {
font-size: 42px; font-size: 42px;
color: var(--ink); color: var(--ink);
font-weight: 700; font-weight: 700;
margin: 40px 0px 0px 80px;
} }
.banner { .banner {
@ -108,48 +111,4 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.banner-button {
background-color: var(--ink);
color: var(--white);
padding: 12px 24px;
border-radius: 5px;
border: var(--ink) 1px solid;
font-size: 16px;
font-weight: 400;
box-sizing: border-box;
align-items: center;
display: flex;
cursor: pointer;
transition: all 0.2s ease 0s;
overflow: hidden;
outline: none;
user-select: none;
white-space: nowrap;
}
.ri-add-circle-fill {
margin-right: 4px;
font-size: 24px;
}
.banner-button:hover {
background-color: var(--white);
color: var(--ink);
border: var(--grey-4) 1px solid;
}
.app-section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin: 40px 80px 0px 80px;
}
.app-section-title {
font-size: 20px;
color: var(--ink);
font-weight: 600;
margin-bottom: 20px;
}
</style> </style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 MiB