From f0cd921c06c6fdf5b6b6d9f2dc7364b749021d3f Mon Sep 17 00:00:00 2001 From: Arpit Date: Thu, 7 Oct 2021 22:04:45 +0530 Subject: [PATCH] Feature: alert event toast color (#928) --- .../src/Editor/Inspector/EventManager.jsx | 56 ++++++++++++++++--- frontend/src/_helpers/appUtils.js | 2 +- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/frontend/src/Editor/Inspector/EventManager.jsx b/frontend/src/Editor/Inspector/EventManager.jsx index 9e736426cb..d41bed3e4c 100644 --- a/frontend/src/Editor/Inspector/EventManager.jsx +++ b/frontend/src/Editor/Inspector/EventManager.jsx @@ -24,6 +24,29 @@ export const EventManager = ({ return { name: action.name, value: action.id }; }); + let alertTypes = [ + { + name: 'Info', + id: 'info', + }, + { + name: 'Success', + id: 'success', + }, + { + name: 'Warning', + id: 'warning', + }, + { + name: 'Danger', + id: 'error', + }, + ]; + + let alertOptions = alertTypes.map((alert) => { + return { name: alert.name, value: alert.id }; + }); + excludeEvents = excludeEvents || []; /* Filter events based on excludesEvents ( a list of event ids to exclude ) */ @@ -128,16 +151,31 @@ export const EventManager = ({
Action options
{event.actionId === 'show-alert' && ( -
-
Message
-
- handlerChanged(index, 'message', value)} - /> + <> +
+
Message
+
+ handlerChanged(index, 'message', value)} + /> +
-
+
+
Alert Type
+
+ handlerChanged(index, 'alertType', value)} + filterOptions={fuzzySearch} + placeholder="Select.." + /> +
+
+ )} {event.actionId === 'open-webpage' && ( diff --git a/frontend/src/_helpers/appUtils.js b/frontend/src/_helpers/appUtils.js index b2a86b028a..f1d0928311 100644 --- a/frontend/src/_helpers/appUtils.js +++ b/frontend/src/_helpers/appUtils.js @@ -125,7 +125,7 @@ function executeAction(_ref, event, mode) { switch (event.actionId) { case 'show-alert': { const message = resolveReferences(event.message, _ref.state.currentState); - toast(message, { hideProgressBar: true }); + toast(message, { hideProgressBar: true, type: event.alertType }); return new Promise(function (resolve, reject) { resolve(); });