Replace all usages of simple-modal with new modal
This commit is contained in:
parent
774cd8e4ae
commit
d1512f202b
|
@ -79,7 +79,6 @@
|
||||||
"shortid": "^2.2.15",
|
"shortid": "^2.2.15",
|
||||||
"svelte-loading-spinners": "^0.1.1",
|
"svelte-loading-spinners": "^0.1.1",
|
||||||
"svelte-portal": "^0.1.0",
|
"svelte-portal": "^0.1.0",
|
||||||
"svelte-simple-modal": "^0.4.2",
|
|
||||||
"yup": "^0.29.2"
|
"yup": "^0.29.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -11,11 +11,12 @@
|
||||||
*/
|
*/
|
||||||
import { createEventDispatcher, setContext } from "svelte"
|
import { createEventDispatcher, setContext } from "svelte"
|
||||||
import { fade, fly } from "svelte/transition"
|
import { fade, fly } from "svelte/transition"
|
||||||
import { portal } from "./portal"
|
import Portal from "svelte-portal"
|
||||||
import { ContextKey } from "./context"
|
import { ContextKey } from "./context"
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let wide
|
export let wide = false
|
||||||
|
export let padded = true
|
||||||
|
|
||||||
let visible
|
let visible
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if visible}
|
{#if visible}
|
||||||
<div class="portal-wrapper" use:portal={'#modal-container'}>
|
<Portal target="#modal-container">
|
||||||
<div
|
<div
|
||||||
class="overlay"
|
class="overlay"
|
||||||
on:click|self={hide}
|
on:click|self={hide}
|
||||||
|
@ -49,14 +50,14 @@
|
||||||
on:click|self={hide}
|
on:click|self={hide}
|
||||||
transition:fly={{ y: 50 }}>
|
transition:fly={{ y: 50 }}>
|
||||||
<div class="content-wrapper" on:click|self={hide}>
|
<div class="content-wrapper" on:click|self={hide}>
|
||||||
<div class="content" class:wide>
|
<div class="content" class:wide class:padded>
|
||||||
<slot />
|
<slot />
|
||||||
<i class="ri-close-line" on:click={hide} />
|
<i class="ri-close-line" on:click={hide} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Portal>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -109,11 +110,13 @@
|
||||||
margin: 2rem 0;
|
margin: 2rem 0;
|
||||||
border-radius: var(--border-radius-m);
|
border-radius: var(--border-radius-m);
|
||||||
gap: var(--spacing-xl);
|
gap: var(--spacing-xl);
|
||||||
padding: var(--spacing-xl);
|
|
||||||
}
|
}
|
||||||
.content.wide {
|
.content.wide {
|
||||||
flex: 0 0 600px;
|
flex: 0 0 600px;
|
||||||
}
|
}
|
||||||
|
.content.padded {
|
||||||
|
padding: var(--spacing-xl);
|
||||||
|
}
|
||||||
|
|
||||||
i {
|
i {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -11,12 +11,10 @@
|
||||||
import { Input, TextArea, Button } from "@budibase/bbui"
|
import { Input, TextArea, Button } from "@budibase/bbui"
|
||||||
import { goto } from "@sveltech/routify"
|
import { goto } from "@sveltech/routify"
|
||||||
import { AppsIcon, InfoIcon, CloseIcon } from "components/common/Icons/"
|
import { AppsIcon, InfoIcon, CloseIcon } from "components/common/Icons/"
|
||||||
import { getContext } from "svelte"
|
|
||||||
import { fade } from "svelte/transition"
|
import { fade } from "svelte/transition"
|
||||||
import { post } from "builderStore/api"
|
import { post } from "builderStore/api"
|
||||||
import analytics from "analytics"
|
import analytics from "analytics"
|
||||||
|
|
||||||
const { open, close } = getContext("simple-modal")
|
|
||||||
//Move this to context="module" once svelte-forms is updated so that it can bind to stores correctly
|
//Move this to context="module" once svelte-forms is updated so that it can bind to stores correctly
|
||||||
const createAppStore = writable({ currentStep: 0, values: {} })
|
const createAppStore = writable({ currentStep: 0, values: {} })
|
||||||
|
|
||||||
|
@ -169,7 +167,7 @@
|
||||||
}
|
}
|
||||||
const userResp = await api.post(`/api/users`, user)
|
const userResp = await api.post(`/api/users`, user)
|
||||||
const json = await userResp.json()
|
const json = await userResp.json()
|
||||||
$goto(`./${appJson._id}`)
|
$goto(`/${appJson._id}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
@ -194,10 +192,6 @@
|
||||||
|
|
||||||
let onChange = () => {}
|
let onChange = () => {}
|
||||||
|
|
||||||
function _onCancel() {
|
|
||||||
close()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function _onOkay() {
|
async function _onOkay() {
|
||||||
await createNewApp()
|
await createNewApp()
|
||||||
}
|
}
|
||||||
|
@ -249,9 +243,6 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="close-button" on:click={_onCancel}>
|
|
||||||
<CloseIcon />
|
|
||||||
</div>
|
|
||||||
<img src="/_builder/assets/bb-logo.svg" alt="budibase icon" />
|
<img src="/_builder/assets/bb-logo.svg" alt="budibase icon" />
|
||||||
{#if submitting}
|
{#if submitting}
|
||||||
<div in:fade class="spinner-container">
|
<div in:fade class="spinner-container">
|
||||||
|
@ -276,16 +267,6 @@
|
||||||
align-content: center;
|
align-content: center;
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
}
|
}
|
||||||
.close-button {
|
|
||||||
cursor: pointer;
|
|
||||||
position: absolute;
|
|
||||||
top: 20px;
|
|
||||||
right: 20px;
|
|
||||||
}
|
|
||||||
.close-button :global(svg) {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
|
||||||
.heading {
|
.heading {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
|
@ -1,29 +1,14 @@
|
||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte"
|
import { keys, map, includes, filter } from "lodash/fp"
|
||||||
import {
|
|
||||||
keys,
|
|
||||||
map,
|
|
||||||
some,
|
|
||||||
includes,
|
|
||||||
cloneDeep,
|
|
||||||
isEqual,
|
|
||||||
sortBy,
|
|
||||||
filter,
|
|
||||||
difference,
|
|
||||||
} from "lodash/fp"
|
|
||||||
import { pipe } from "components/common/core"
|
|
||||||
import Checkbox from "components/common/Checkbox.svelte"
|
|
||||||
import EventEditorModal from "./EventEditorModal.svelte"
|
import EventEditorModal from "./EventEditorModal.svelte"
|
||||||
|
import { Modal } from "components/common/Modal"
|
||||||
import { PencilIcon } from "components/common/Icons"
|
|
||||||
import { EVENT_TYPE_MEMBER_NAME } from "components/common/eventHandlers"
|
|
||||||
|
|
||||||
export const EVENT_TYPE = "event"
|
export const EVENT_TYPE = "event"
|
||||||
|
|
||||||
export let component
|
export let component
|
||||||
|
|
||||||
let events = []
|
let events = []
|
||||||
let selectedEvent = null
|
let selectedEvent = null
|
||||||
|
let modal
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
events = Object.keys(component)
|
events = Object.keys(component)
|
||||||
|
@ -35,28 +20,9 @@
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle create app modal
|
|
||||||
const { open, close } = getContext("simple-modal")
|
|
||||||
|
|
||||||
const openModal = event => {
|
const openModal = event => {
|
||||||
selectedEvent = event
|
selectedEvent = event
|
||||||
open(
|
modal.show()
|
||||||
EventEditorModal,
|
|
||||||
{
|
|
||||||
eventOptions: events,
|
|
||||||
event: selectedEvent,
|
|
||||||
onClose: () => {
|
|
||||||
close()
|
|
||||||
selectedEvent = null
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
closeButton: false,
|
|
||||||
closeOnEsc: false,
|
|
||||||
styleContent: { padding: 0 },
|
|
||||||
closeOnOuterClick: true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -81,6 +47,13 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Modal bind:this={modal}>
|
||||||
|
<EventEditorModal
|
||||||
|
eventOptions={events}
|
||||||
|
event={selectedEvent}
|
||||||
|
on:hide={() => (selectedEvent = null)} />
|
||||||
|
</Modal>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.root {
|
.root {
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
<script>
|
<script>
|
||||||
import Modal from "svelte-simple-modal"
|
|
||||||
import { store, automationStore, backendUiStore } from "builderStore"
|
import { store, automationStore, backendUiStore } from "builderStore"
|
||||||
import SettingsLink from "components/settings/Link.svelte"
|
import SettingsLink from "components/settings/Link.svelte"
|
||||||
import { get } from "builderStore/api"
|
import { get } from "builderStore/api"
|
||||||
|
import { isActive, goto, layout } from "@sveltech/routify"
|
||||||
import { fade } from "svelte/transition"
|
import { PreviewIcon } from "components/common/Icons/"
|
||||||
import { isActive, goto, layout, url } from "@sveltech/routify"
|
|
||||||
|
|
||||||
import { SettingsIcon, PreviewIcon } from "components/common/Icons/"
|
|
||||||
|
|
||||||
// Get Package and set store
|
// Get Package and set store
|
||||||
export let application
|
export let application
|
||||||
|
@ -47,9 +43,7 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal>
|
<div class="root">
|
||||||
<div class="root">
|
|
||||||
|
|
||||||
<div class="top-nav">
|
<div class="top-nav">
|
||||||
<div class="topleftnav">
|
<div class="topleftnav">
|
||||||
<button class="home-logo">
|
<button class="home-logo">
|
||||||
|
@ -83,14 +77,12 @@
|
||||||
{#await promise}
|
{#await promise}
|
||||||
<!-- This should probably be some kind of loading state? -->
|
<!-- This should probably be some kind of loading state? -->
|
||||||
<div />
|
<div />
|
||||||
{:then}
|
{:then _}
|
||||||
<slot />
|
<slot />
|
||||||
{:catch error}
|
{:catch error}
|
||||||
<p>Something went wrong: {error.message}</p>
|
<p>Something went wrong: {error.message}</p>
|
||||||
{/await}
|
{/await}
|
||||||
|
</div>
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.root {
|
.root {
|
||||||
|
@ -138,7 +130,7 @@
|
||||||
margin: 0px 00px 0px 20px;
|
margin: 0px 00px 0px 20px;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: var(--font-size-md);
|
font-size: var(--font-size-m);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -183,10 +175,6 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-logo:hover {
|
|
||||||
color: var(--hovercolor);
|
|
||||||
}
|
|
||||||
|
|
||||||
.home-logo:active {
|
.home-logo:active {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<script>
|
<script>
|
||||||
import Modal from "svelte-simple-modal"
|
|
||||||
import { Home as Link } from "@budibase/bbui"
|
import { Home as Link } from "@budibase/bbui"
|
||||||
import {
|
import {
|
||||||
AppsIcon,
|
AppsIcon,
|
||||||
|
@ -7,11 +6,10 @@
|
||||||
DocumentationIcon,
|
DocumentationIcon,
|
||||||
CommunityIcon,
|
CommunityIcon,
|
||||||
BugIcon,
|
BugIcon,
|
||||||
} from "components/common/Icons/"
|
} from "components/common/Icons"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal>
|
<div class="root">
|
||||||
<div class="root">
|
|
||||||
<div class="ui-nav">
|
<div class="ui-nav">
|
||||||
<div class="home-logo">
|
<div class="home-logo">
|
||||||
<img src="/_builder/assets/budibase-logo.svg" alt="Budibase icon" />
|
<img src="/_builder/assets/budibase-logo.svg" alt="Budibase icon" />
|
||||||
|
@ -42,8 +40,7 @@
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.root {
|
.root {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte"
|
|
||||||
import { store } from "builderStore"
|
import { store } from "builderStore"
|
||||||
import api from "builderStore/api"
|
import api from "builderStore/api"
|
||||||
import AppList from "components/start/AppList.svelte"
|
import AppList from "components/start/AppList.svelte"
|
||||||
|
@ -10,8 +9,11 @@
|
||||||
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
||||||
import { Button, Heading } from "@budibase/bbui"
|
import { Button, Heading } from "@budibase/bbui"
|
||||||
import analytics from "analytics"
|
import analytics from "analytics"
|
||||||
|
import { Modal } from "components/common/Modal"
|
||||||
|
|
||||||
let promise = getApps()
|
let promise = getApps()
|
||||||
|
let hasKey
|
||||||
|
let modal
|
||||||
|
|
||||||
async function getApps() {
|
async function getApps() {
|
||||||
const res = await get("/api/applications")
|
const res = await get("/api/applications")
|
||||||
|
@ -24,8 +26,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let hasKey
|
|
||||||
|
|
||||||
async function fetchKeys() {
|
async function fetchKeys() {
|
||||||
const response = await api.get(`/api/keys/`)
|
const response = await api.get(`/api/keys/`)
|
||||||
return await response.json()
|
return await response.json()
|
||||||
|
@ -40,37 +40,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!keys.budibase) {
|
if (!keys.budibase) {
|
||||||
showCreateAppModal()
|
modal.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle create app modal
|
|
||||||
const { open } = getContext("simple-modal")
|
|
||||||
|
|
||||||
const showCreateAppModal = () => {
|
|
||||||
open(
|
|
||||||
CreateAppModal,
|
|
||||||
{
|
|
||||||
hasKey,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
closeButton: false,
|
|
||||||
closeOnEsc: false,
|
|
||||||
closeOnOuterClick: false,
|
|
||||||
styleContent: { padding: 0 },
|
|
||||||
closeOnOuterClick: true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
checkIfKeysAndApps()
|
checkIfKeysAndApps()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<Heading medium black>Welcome to the Budibase Beta</Heading>
|
<Heading medium black>Welcome to the Budibase Beta</Heading>
|
||||||
<Button primary black on:click={showCreateAppModal}>
|
<Button primary black on:click={modal.show}>Create New Web App</Button>
|
||||||
Create New Web App
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="banner">
|
<div class="banner">
|
||||||
|
@ -80,6 +59,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Modal bind:this={modal} wide padded={false}>
|
||||||
|
<CreateAppModal {hasKey} />
|
||||||
|
</Modal>
|
||||||
|
|
||||||
{#await promise}
|
{#await promise}
|
||||||
<div class="spinner-container">
|
<div class="spinner-container">
|
||||||
<Spinner />
|
<Spinner />
|
||||||
|
|
Loading…
Reference in New Issue