Fix SnackBar usage

This commit is contained in:
Alexey Safronov 2021-07-09 17:25:20 +03:00
parent e0b37cfd1b
commit 0297620036
3 changed files with 12 additions and 51 deletions

View File

@ -351,7 +351,6 @@ class PageLayout extends React.Component {
unpinArticle={this.unpinArticle}
pinned={this.state.isArticlePinned}
>
<div id="main-bar" style={{ display: "grid" }}></div>
{isSectionHeaderAvailable && (
<SubSectionHeader
isHeaderVisible={isHeaderVisible}
@ -362,12 +361,16 @@ class PageLayout extends React.Component {
: null}
</SubSectionHeader>
)}
{isSectionFilterAvailable && (
<SubSectionFilter className="section-header_filter">
{sectionFilterContent
? sectionFilterContent.props.children
: null}
</SubSectionFilter>
<>
<div id="main-bar" style={{ display: "grid" }}></div>
<SubSectionFilter className="section-header_filter">
{sectionFilterContent
? sectionFilterContent.props.children
: null}
</SubSectionFilter>
</>
)}
{isSectionBodyAvailable && (
<>

View File

@ -1,38 +0,0 @@
importScripts("https://www.gstatic.com/firebasejs/8.6.7/firebase-app.js");
importScripts("https://www.gstatic.com/firebasejs/8.6.7/firebase-messging.js");
var firebaseConfig = {
apiKey: "AIzaSyD89-RSZMDJb99M6boo7om5qOR7ZXGHGYA",
authDomain: "as-messagebar.firebaseapp.com",
projectId: "as-messagebar",
storageBucket: "as-messagebar.appspot.com",
messagingSenderId: "624985220555",
appId: "1:624985220555:web:825fdc1df2d19df157424e",
measurementId: "G-PJDDTX8025",
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const messaging = firebase.messaging();
messaging
.getToken({
vapidKey:
"dBQoC95KCChN4jv_JT3qjj:APA91bG1lC05XNP2Nj-YiVgJ8HvuiXtVTkoqMlTDZJiI6xjXFPHbL968-xeZ9bxwJCO13K7_gWhYcYVU7fgaq_xYr-PO7xGtBUFPqlLZ2kawKr543dR67NKNlmkXmn4A8tqbod4neBPH",
})
.then((currentToken) => {
if (currentToken) {
// Send the token to your server and update the UI if necessary
// ...
} else {
// Show permission request UI
console.log(
"No registration token available. Request permission to generate one."
);
// ...
}
})
.catch((err) => {
console.log("An error occurred while retrieving token. ", err);
// ...
});

View File

@ -246,10 +246,8 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
const campaignStr = JSON.stringify(campaign);
let skipRender = lastCampaignStr === campaignStr;
if (!isMobile) {
skipRender =
skipRender && document.getElementById("main-bar").hasChildNodes();
}
skipRender =
skipRender && document.getElementById("main-bar").hasChildNodes();
if (skipRender) return;
@ -270,9 +268,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
},
};
if (!isMobile) {
barConfig.parentElementId = "main-bar";
}
barConfig.parentElementId = "main-bar";
Snackbar.show(barConfig);
};