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 e8140ea commit 8efa7b0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
22 changes: 11 additions & 11 deletions admin/src/react-components/pages/system-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ const SystemEditorComponent = ({ classes }) => {

return (
<div className="page_wrapper">
<Card className={`mb-24 ${classes.notificationCard}`}>
<CardSection
className={classes.notificationCardSection}
ctaCallback={() => {
window.open("https://www.mozilla.com");
}}
cta={"Learn More"}
body={"COPY HERE"}
showIcon={false}
/>
</Card>
{configs.sunset.notification && (
<Card className={`mb-24 ${classes.notificationCard}`}>
<CardSection
className={classes.notificationCardSection}
ctaCallback={() => configs.sunset.notification.link}
cta={"Learn More"}
body={configs.sunset.notification.body}
showIcon={false}
/>
</Card>
)}
<Card className="mb-24">
<h2 className="heading-lg mb-24">Getting Started</h2>

Expand Down
7 changes: 7 additions & 0 deletions admin/src/utils/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@ const configs = {};
const hasReticulumServerMetaTag = !!document.querySelector("meta[name='env:reticulum_server']");
configs.IS_LOCAL_OR_CUSTOM_CLIENT = !hasReticulumServerMetaTag;

configs.sunset = {
notification: {
body: "COPY HERE",
link: "https://www.mozilla.org"
}
};

export default configs;
1 change: 1 addition & 0 deletions src/react-components/room/SystemNotification.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
}

:local(.notificationText) {
padding: 8px;
max-width: 40vw;
min-width: 150px;
overflow: hidden;
Expand Down
9 changes: 3 additions & 6 deletions src/react-components/ui-root.js
Original file line number Diff line number Diff line change
Expand Up @@ -1337,9 +1337,6 @@ class UIRoot extends Component {
}
];

const globalNotificationBody = "COPY HERE";
const globalNotificationLink = "https://www.mozilla.com";

return (
<MoreMenuContextProvider>
<ReactAudioContext.Provider value={this.state.audioContext}>
Expand Down Expand Up @@ -1461,10 +1458,10 @@ class UIRoot extends Component {
/>
)}
<NotificationsContainer isMobile={isMobile}>
{!this.state.globalNotificationDismissed && (
{configs.sunset.notification && !this.state.globalNotificationDismissed && (
<SystemNotification
body={globalNotificationBody}
link={globalNotificationLink}
body={configs.sunset.notification.body}
link={configs.sunset.notification.link}
onDismiss={() => this.setState({ globalNotificationDismissed: true })}
/>
)}
Expand Down
7 changes: 7 additions & 0 deletions src/utils/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,11 @@ configs.translation = key => {
);
};

configs.sunset = {
notification: {
body: "The copy will go here",
link: "https://www.mozilla.org"
}
};

export default configs;

0 comments on commit 8efa7b0

Please sign in to comment.