diff --git a/packages/client/src/api/api.js b/packages/client/src/api/api.js index b915f14fd1..5449c3f219 100644 --- a/packages/client/src/api/api.js +++ b/packages/client/src/api/api.js @@ -38,15 +38,15 @@ const makeApiCall = async ({ method, url, body, json = true }) => { case 200: return response.json() case 401: - notificationStore.danger("Invalid credentials") + notificationStore.actions.error("Invalid credentials") return handleError(`Invalid credentials`) case 404: - notificationStore.danger("Not found") + notificationStore.actions.warning("Not found") return handleError(`${url}: Not Found`) case 400: return handleError(`${url}: Bad Request`) case 403: - notificationStore.danger( + notificationStore.actions.error( "Your session has expired, or you don't have permission to access that data" ) return handleError(`${url}: Forbidden`) diff --git a/packages/client/src/api/automations.js b/packages/client/src/api/automations.js index 4dd5958568..2b989f85ae 100644 --- a/packages/client/src/api/automations.js +++ b/packages/client/src/api/automations.js @@ -9,7 +9,7 @@ export const triggerAutomation = async (automationId, fields) => { body: { fields }, }) res.error - ? notificationStore.danger("An error has occurred") - : notificationStore.success("Automation triggered") + ? notificationStore.actions.error("An error has occurred") + : notificationStore.actions.success("Automation triggered") return res } diff --git a/packages/client/src/api/queries.js b/packages/client/src/api/queries.js index 715841f0fa..a6ef1a763f 100644 --- a/packages/client/src/api/queries.js +++ b/packages/client/src/api/queries.js @@ -7,7 +7,7 @@ import API from "./api" export const executeQuery = async ({ queryId, parameters }) => { const query = await API.get({ url: `/api/queries/${queryId}` }) if (query?.datasourceId == null) { - notificationStore.danger("That query couldn't be found") + notificationStore.actions.error("That query couldn't be found") return } const res = await API.post({ @@ -17,9 +17,9 @@ export const executeQuery = async ({ queryId, parameters }) => { }, }) if (res.error) { - notificationStore.danger("An error has occurred") + notificationStore.actions.error("An error has occurred") } else if (!query.readable) { - notificationStore.success("Query executed successfully") + notificationStore.actions.success("Query executed successfully") dataSourceStore.actions.invalidateDataSource(query.datasourceId) } return res diff --git a/packages/client/src/api/rows.js b/packages/client/src/api/rows.js index 14d696351d..21f8ec1f98 100644 --- a/packages/client/src/api/rows.js +++ b/packages/client/src/api/rows.js @@ -27,8 +27,8 @@ export const saveRow = async row => { body: row, }) res.error - ? notificationStore.danger("An error has occurred") - : notificationStore.success("Row saved") + ? notificationStore.actions.error("An error has occurred") + : notificationStore.actions.success("Row saved") // Refresh related datasources dataSourceStore.actions.invalidateDataSource(row.tableId) @@ -48,8 +48,8 @@ export const updateRow = async row => { body: row, }) res.error - ? notificationStore.danger("An error has occurred") - : notificationStore.success("Row updated") + ? notificationStore.actions.error("An error has occurred") + : notificationStore.actions.success("Row updated") // Refresh related datasources dataSourceStore.actions.invalidateDataSource(row.tableId) @@ -72,8 +72,8 @@ export const deleteRow = async ({ tableId, rowId, revId }) => { }, }) res.error - ? notificationStore.danger("An error has occurred") - : notificationStore.success("Row deleted") + ? notificationStore.actions.error("An error has occurred") + : notificationStore.actions.success("Row deleted") // Refresh related datasources dataSourceStore.actions.invalidateDataSource(tableId) @@ -95,8 +95,8 @@ export const deleteRows = async ({ tableId, rows }) => { }, }) res.error - ? notificationStore.danger("An error has occurred") - : notificationStore.success(`${rows.length} row(s) deleted`) + ? notificationStore.actions.error("An error has occurred") + : notificationStore.actions.success(`${rows.length} row(s) deleted`) // Refresh related datasources dataSourceStore.actions.invalidateDataSource(tableId) diff --git a/packages/client/src/components/ClientApp.svelte b/packages/client/src/components/ClientApp.svelte index 44ef49e239..fd1a464b75 100644 --- a/packages/client/src/components/ClientApp.svelte +++ b/packages/client/src/components/ClientApp.svelte @@ -4,6 +4,7 @@ import Component from "./Component.svelte" import NotificationDisplay from "./NotificationDisplay.svelte" import ConfirmationDisplay from "./ConfirmationDisplay.svelte" + import PeekScreenDisplay from "./PeekScreenDisplay.svelte" import Provider from "./Provider.svelte" import SDK from "../sdk" import { @@ -100,6 +101,7 @@ + {#key $builderStore.selectedComponentId} {#if $builderStore.inBuilder} diff --git a/packages/client/src/components/NotificationDisplay.svelte b/packages/client/src/components/NotificationDisplay.svelte index 1a960c383a..f03fb692fd 100644 --- a/packages/client/src/components/NotificationDisplay.svelte +++ b/packages/client/src/components/NotificationDisplay.svelte @@ -1,36 +1,34 @@
- {#each $notifications as notification (notification.id)} -
-
{notification.message}
- {#if notification.icon}{/if} -
- {/each} + {#if $notificationStore} + {#key $notificationStore.id} +
+ +
+ {/key} + {/if}
diff --git a/packages/client/src/components/PeekScreenDisplay.svelte b/packages/client/src/components/PeekScreenDisplay.svelte new file mode 100644 index 0000000000..236a228c3b --- /dev/null +++ b/packages/client/src/components/PeekScreenDisplay.svelte @@ -0,0 +1,78 @@ + + +{#if $peekStore.showPeek} + + +