From 6185126ddb0d0f20c186336887a71ddc7dfd0356 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 23 Feb 2021 10:02:21 +0000 Subject: [PATCH 1/8] Make heading respect white space and reduce default margin --- .../standard-components/src/Heading.svelte | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/standard-components/src/Heading.svelte b/packages/standard-components/src/Heading.svelte index 66775dc666..bf38ecf06e 100644 --- a/packages/standard-components/src/Heading.svelte +++ b/packages/standard-components/src/Heading.svelte @@ -4,21 +4,32 @@ const { styleable } = getContext("sdk") const component = getContext("component") - export let className = "" export let type export let text = "" {#if type === 'h1'} -

{text}

+

{text}

{:else if type === 'h2'} -

{text}

+

{text}

{:else if type === 'h3'} -

{text}

+

{text}

{:else if type === 'h4'} -

{text}

+

{text}

{:else if type === 'h5'} -
{text}
+
{text}
{:else if type === 'h6'} -
{text}
+
{text}
{/if} + + From de333a769fa40255ffab650ff387e5a7fa49227c Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 23 Feb 2021 10:03:52 +0000 Subject: [PATCH 2/8] Revert heading margin change to use browser default --- packages/standard-components/src/Heading.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/standard-components/src/Heading.svelte b/packages/standard-components/src/Heading.svelte index bf38ecf06e..f06ac86afd 100644 --- a/packages/standard-components/src/Heading.svelte +++ b/packages/standard-components/src/Heading.svelte @@ -29,7 +29,6 @@ h4, h5, h6 { - margin: 0.5em 0; white-space: pre-wrap; } From 137009762d01728abf8fa4cc9c8f9f51e288865f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 23 Feb 2021 10:04:07 +0000 Subject: [PATCH 3/8] Make paragraph respect whitespace --- packages/standard-components/src/Text.svelte | 31 ++------------------ 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/packages/standard-components/src/Text.svelte b/packages/standard-components/src/Text.svelte index 887bdec29d..ab62352694 100644 --- a/packages/standard-components/src/Text.svelte +++ b/packages/standard-components/src/Text.svelte @@ -5,38 +5,13 @@ const component = getContext("component") export let text = "" - export let className = "" - export let type = "" - - const isTag = tag => type === tag -{#if isTag('none')} - {text} -{:else if isTag('bold')} - {text} -{:else if isTag('strong')} - {text} -{:else if isTag('italic')} - {text} -{:else if isTag('emphasis')} - {text} -{:else if isTag('mark')} - {text} -{:else if isTag('small')} - {text} -{:else if isTag('del')} - {text} -{:else if isTag('ins')} - {text} -{:else if isTag('sub')} - {text} -{:else if isTag('sup')} - {text} -{:else}{text}{/if} +

{text}

From 22adf9eb5af8a70ec9bc4dad3dbacd7036b78942 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 23 Feb 2021 10:14:54 +0000 Subject: [PATCH 4/8] Update vertical card to preserve white space and fix crashing when a URL isn't entered --- packages/standard-components/src/Card.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/standard-components/src/Card.svelte b/packages/standard-components/src/Card.svelte index 33be4185f7..85f30c5a09 100644 --- a/packages/standard-components/src/Card.svelte +++ b/packages/standard-components/src/Card.svelte @@ -40,7 +40,7 @@ + href={linkUrl || '/'}> {linkText} @@ -71,6 +71,7 @@ font-size: 1.25rem; font-weight: 700; margin: 0; + white-space: pre-wrap; } .text { @@ -78,6 +79,7 @@ margin: 0; font-weight: 400; line-height: 1.5rem; + white-space: pre-wrap; } a { @@ -85,6 +87,7 @@ text-decoration: none; color: var(--linkColor); font-weight: 600; + white-space: pre-wrap; } a:hover { From cddca2ae1e4e922ab4642602c86d63adf297b45f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 23 Feb 2021 10:15:16 +0000 Subject: [PATCH 5/8] Update horizontal card to preserve white space and fix crashing when a URL isn't entered --- packages/standard-components/src/CardHorizontal.svelte | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/standard-components/src/CardHorizontal.svelte b/packages/standard-components/src/CardHorizontal.svelte index 5d7596e296..523d796cf5 100644 --- a/packages/standard-components/src/CardHorizontal.svelte +++ b/packages/standard-components/src/CardHorizontal.svelte @@ -40,7 +40,7 @@

{subtext}

{linkText} + href={linkUrl || '/'}>{linkText} @@ -71,6 +71,7 @@ font-size: 1rem; font-weight: 700; margin: 0; + white-space: pre-wrap; } .text { @@ -78,6 +79,7 @@ margin: 0.5rem 0 0 0; font-weight: 400; line-height: 1.25rem; + white-space: pre-wrap; } footer { @@ -91,6 +93,7 @@ margin: 0; font-weight: 400; color: #757575; + white-space: pre-wrap; } a { @@ -99,7 +102,7 @@ color: var(--linkColor); font-weight: 600; font-size: 0.85rem; - margin: 0; + white-space: pre-wrap; } a:hover { From d0c40f060ceb44b71ec7689f44276a50948cc8b4 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 23 Feb 2021 10:15:40 +0000 Subject: [PATCH 6/8] Update card stat to preserve white space --- packages/standard-components/src/CardStat.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/standard-components/src/CardStat.svelte b/packages/standard-components/src/CardStat.svelte index e5e40ad862..86291db915 100644 --- a/packages/standard-components/src/CardStat.svelte +++ b/packages/standard-components/src/CardStat.svelte @@ -20,7 +20,6 @@ .container { min-width: 260px; width: max-content; - max-height: 170px; border: 1px solid var(--grey-3); border-radius: 0.3rem; color: var(--blue); @@ -31,6 +30,7 @@ color: #9e9e9e; font-weight: 500; margin: 1rem 1.5rem 0.5rem 1.5rem; + white-space: pre-wrap; } .value { @@ -38,6 +38,7 @@ font-weight: 500; margin: 0 1.5rem 1.5rem 1.5rem; color: inherit; + white-space: pre-wrap; } .label { @@ -45,5 +46,6 @@ font-weight: 400; color: #9e9e9e; margin: 1rem 1.5rem; + white-space: pre-wrap; } From f54734c3bf684afd0a70b835924b30898adf15b8 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 23 Feb 2021 10:15:51 +0000 Subject: [PATCH 7/8] Update stacked list to preserve white space --- packages/standard-components/src/StackedList.svelte | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/standard-components/src/StackedList.svelte b/packages/standard-components/src/StackedList.svelte index b06ce53ebe..3cf70b2ec1 100644 --- a/packages/standard-components/src/StackedList.svelte +++ b/packages/standard-components/src/StackedList.svelte @@ -50,6 +50,7 @@ .subheading { opacity: 0.6; + white-space: pre-wrap; } .content { @@ -60,6 +61,7 @@ .heading { font-weight: 600; + white-space: pre-wrap; } .image-block { From 3430048c9b1a21b08bb7af31e3549e7c6007c80a Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 23 Feb 2021 10:33:26 +0000 Subject: [PATCH 8/8] Show error when trying to create user with a duplicate email address --- .../DataTable/modals/CreateEditUser.svelte | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte index 5753b7d5bb..6467b8e953 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte @@ -34,11 +34,26 @@ } const saveRow = async () => { + errors = [] + + // Do some basic front end validation first + if (!row.email) { + errors = [...errors, { message: "Email is required" }] + } + if (!row.password) { + errors = [...errors, { message: "Password is required" }] + } + if (!row.roleId) { + errors = [...errors, { message: "Role is required" }] + } + if (errors.length) { + return false + } + const rowResponse = await backendApi.saveRow( { ...row, tableId: table._id }, table._id ) - if (rowResponse.errors) { if (Array.isArray(rowResponse.errors)) { errors = rowResponse.errors.map(error => ({ message: error })) @@ -48,6 +63,9 @@ .flat() } return false + } else if (rowResponse.status === 400 && rowResponse.message) { + errors = [{ message: rowResponse.message }] + return false } notifier.success("User saved successfully.")