Skip to content

Commit

Permalink
Merge pull request #1362 from massenergize/feat-match-new-menu-structure
Browse files Browse the repository at this point in the history
Feat: Display new menu structure
  • Loading branch information
archx3 committed Jun 22, 2024
2 parents b02f444 + 6d37258 commit 3919fcd
Show file tree
Hide file tree
Showing 3 changed files with 350 additions and 130 deletions.
20 changes: 12 additions & 8 deletions src/AppRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ class AppRouter extends Component {
props.setAuthState(isJustFromGoogleAUth[0]);
return null;
}
if(getTakeTourFromURL() === "true" && !props.showTour){
props.setTourState(true)
return null
if (getTakeTourFromURL() === "true" && !props.showTour) {
props.setTourState(true);
return null;
}
return null
return null;
}

async fetch() {
Expand Down Expand Up @@ -414,7 +414,11 @@ class AppRouter extends Component {
if (children && children.length > 0) {
children = children.map((child) => this.prependPrefix(child, prefix));
}
return { ...rest, link: `${prefix}${link}`, children };
return {
...rest,
link: rest?.is_link_external ? link : `${prefix}${link}`,
children,
};
}

loadMenu(menus, prefix) {
Expand All @@ -431,13 +435,14 @@ class AppRouter extends Component {
content?.map((m) => this.prependPrefix(m, prefix)) || [];
// const finalMenu = this.modifiedMenu(initialMenu);
const finalMenu = initialMenu;
this.setState({ navBarMenu: content });

this.setState({ navBarMenu: finalMenu });

const footerContent = menus.filter((menu) => {
return menu.name === "PortalFooterQuickLinks";
});
// const footerLinks = this.addPrefix(footerContent[0].content.links);
const footerLinks = footerContent[0].content.links || [];
const footerLinks = footerContent[0]?.content?.links || [];

const communitiesLink = {
name: "All MassEnergize Community Sites",
Expand Down Expand Up @@ -527,7 +532,6 @@ class AppRouter extends Component {
!m.link.startsWith(this.state.prefix)
) {
m.link = `${this.state.prefix}/${m.link}`.replace("//", "/");

}
if (m.children && m.children.length > 0) {
m.children = this.addPrefix(m.children);
Expand Down
Loading

0 comments on commit 3919fcd

Please sign in to comment.