From 91d952ca7eb42448e586c7eb2f2a62b9226990a8 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Thu, 18 Apr 2024 16:29:18 +0200 Subject: [PATCH] Use a global config for sunset related configs --- src/configs.js | 6 ++++++ src/ui/EditorContainer.js | 11 +++-------- src/ui/projects/ProjectsPage.js | 12 +++++++----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/configs.js b/src/configs.js index edad2272e..8b2a7d7cb 100644 --- a/src/configs.js +++ b/src/configs.js @@ -46,5 +46,11 @@ configs.isMoz = () => configs.IS_MOZ === "true"; configs.name = () => (configs.isMoz() ? "Spoke" : "Scene Editor"); configs.longName = () => (configs.isMoz() ? "Spoke by Mozilla" : "Scene Editor"); configs.icon = () => (configs.isMoz() ? fixBaseAssetsPath(spokeIcon) : fixBaseAssetsPath(editorIcon)); +configs.sunset = { + notification: { + body: "COPY HERE", + link: "https://www.mozilla.org" + } +}; export default configs; diff --git a/src/ui/EditorContainer.js b/src/ui/EditorContainer.js index 865a55fc2..6d20a41b5 100644 --- a/src/ui/EditorContainer.js +++ b/src/ui/EditorContainer.js @@ -126,16 +126,11 @@ class EditorContainer extends Component { } }; - const features = { - show_global_notification: true, - global_notification_body: "COPY HERE", - global_notification_link: "https://mozilla.org" - }; - if (features["show_global_notification"]) { + if (configs.sunset.notification) { this.showDialog(NotificationDialog, { title: "Admin notification", - message: features["global_notification_body"], - link: features["global_notification_link"], + message: configs.sunset.notification.body, + link: configs.sunset.notification.link, onClosed: load, onConfirm: load, onCancel: null diff --git a/src/ui/projects/ProjectsPage.js b/src/ui/projects/ProjectsPage.js index 173838d76..bbdb59438 100644 --- a/src/ui/projects/ProjectsPage.js +++ b/src/ui/projects/ProjectsPage.js @@ -127,11 +127,13 @@ class ProjectsPage extends Component { }); } - this.setState({ - showGlobalNotification: true, - globalNotificationBody: "COPY HERE", - globalNotificationLink: "https://mozilla.org" - }); + if (configs.sunset.notification) { + this.setState({ + showGlobalNotification: true, + globalNotificationBody: configs.sunset.notification.body, + globalNotificationLink: configs.sunset.notification.link + }); + } } onDeleteProject = project => {