Merge remote-tracking branch 'origin/feature/create-app-builder-ui' into create-kev

This commit is contained in:
Michael Shanks 2020-05-27 10:45:27 +01:00
commit dd031796f5
4 changed files with 33 additions and 9 deletions

View File

@ -2,6 +2,8 @@
import Button from "components/common/Button.svelte" import Button from "components/common/Button.svelte"
export let name, description =`A minimalist CRM which removes the noise and allows you to focus export let name, description =`A minimalist CRM which removes the noise and allows you to focus
on your business.`, _id; on your business.`, _id;
</script> </script>
<div class="apps-card"> <div class="apps-card">
@ -31,8 +33,8 @@
background-color: var(--grey-light); background-color: var(--grey-light);
text-decoration: none; text-decoration: none;
} }
.app-title { .app-title {
font-size: 18px; font-size: 18px;
font-weight: 700; font-weight: 700;
color: var(--ink); color: var(--ink);

View File

@ -26,8 +26,9 @@
<style> <style>
.apps { .apps {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(400, 1fr)); grid-template-columns: repeat(auto-fill, 400px);
gap: 85px; grid-gap: 40px 85px;
justify-content: start;
} }
.root { .root {
margin: 40px 80px; margin: 40px 80px;

View File

@ -6,6 +6,27 @@
export let onOkay = () => {} export let onOkay = () => {}
const { close } = getContext("simple-modal") const { close } = getContext("simple-modal")
let name = ""
let description = ""
const createNewApp = async () => {
const data = { name, description}
try {
const response = await fetch('/api/applications', {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'Content-Type': 'application/json'
// 'Content-Type': 'application/x-www-form-urlencoded',
},
body: JSON.stringify(data) // body data type must match "Content-Type" header
});
} catch (error) {
}
}
let value let value
let onChange = () => {} let onChange = () => {}
@ -15,12 +36,10 @@
close() close()
} }
function _onOkay() { async function _onOkay() {
onOkay(value) await createNewApp()
close() close()
} }
$: onChange(value)
</script> </script>
<div class="container"> <div class="container">
@ -29,8 +48,9 @@
<span class="icon"><AppsIcon /></span> <span class="icon"><AppsIcon /></span>
<h3>Create new web app</h3> <h3>Create new web app</h3>
</div> </div>
<Input name="name" label="Name" placeholder="Enter application name" /> <Input name="name" label="Name" placeholder="Enter application name" on:change={(e) => name = e.target.value} on:input={(e) => name = e.target.value} />
<TextArea <TextArea
bind:value={description}
name="description" name="description"
label="Description" label="Description"
placeholder="Describe your application" /> placeholder="Describe your application" />

View File

@ -20,6 +20,7 @@
await store.setPackage(pkg) await store.setPackage(pkg)
return pkg return pkg
} else { } else {
console.log(pkg)
throw new Error(pkg) throw new Error(pkg)
} }
} }