Skip to content

Commit

Permalink
Use a global config for sunset related configs
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Apr 18, 2024
1 parent 85e8dbc commit 91d952c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
6 changes: 6 additions & 0 deletions src/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
11 changes: 3 additions & 8 deletions src/ui/EditorContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions src/ui/projects/ProjectsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 91d952c

Please sign in to comment.