Skip to content

Commit

Permalink
Fix Sidebar in undefined routes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelgg93 committed Sep 20, 2023
1 parent cc50518 commit 3e06fac
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions src/.vuepress/theme/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export default {
return {
isSidebarOpen: false,
previousPageUrl: null,
undeclaredRoutes: [
"pupil-cloud",
"enrichments",
"export-formats",
"visualizations",
],
};
},
Expand All @@ -53,8 +59,9 @@ export default {
/* Fail safe, previousPage will be null if coming from external source, thus load neon for enrichments and export formats*/
if (this.previousPageUrl === null) {
if (
this.$page.regularPath.includes("enrichments") ||
this.$page.regularPath.includes("export-formats")
this.undeclaredRoutes.some((item) =>
this.$page.regularPath.includes(item)
)
) {
this.previousPageUrl = "/neon/";
} else {
Expand Down Expand Up @@ -89,29 +96,33 @@ export default {
/* This part here checks from which page comes from and sets the previous url accordingly.*/
if (from.path.includes("invisible")) {
if (
this.$page.regularPath.includes("enrichments") ||
this.$page.regularPath.includes("export-formats")
this.undeclaredRoutes.some((item) =>
this.$page.regularPath.includes(item)
)
) {
this.previousPageUrl = "/invisible/";
} else {
this.previousPageUrl = to.path;
}
} else if (
from.path.includes("enrichments") ||
from.path.includes("export-formats")
this.undeclaredRoutes.some((item) =>
this.$page.regularPath.includes(item)
)
) {
if (
this.$page.regularPath.includes("enrichments") ||
this.$page.regularPath.includes("export-formats")
this.undeclaredRoutes.some((item) =>
this.$page.regularPath.includes(item)
)
) {
this.previousPageUrl = from.$page.previousPageUrl;
} else {
this.previousPageUrl = to.path;
}
} else {
if (
this.$page.regularPath.includes("enrichments") ||
this.$page.regularPath.includes("export-formats")
this.undeclaredRoutes.some((item) =>
this.$page.regularPath.includes(item)
)
) {
this.previousPageUrl = "/neon/";
} else {
Expand Down

0 comments on commit 3e06fac

Please sign in to comment.