Updates view switcher to support multiple pages (#584)

This commit is contained in:
Alicia Sykes
2022-04-20 15:52:17 +01:00
parent 036bc008c5
commit 1bc9964374
3 changed files with 89 additions and 58 deletions

View File

@@ -3,7 +3,15 @@
import { hideFurnitureOn } from '@/utils/defaults';
/* Returns false if page furniture should be hidden on said route */
export const shouldBeVisible = (routeName) => !hideFurnitureOn.includes(routeName);
export const shouldBeVisible = (routeName) => {
let shouldShow = true;
if (!routeName) return shouldShow; // Route name not specified.
hideFurnitureOn.forEach((hideOn) => {
// If route name on the no-show list, set visibility to false
if (routeName.includes(hideOn)) shouldShow = false;
});
return shouldShow;
};
/* Based on section title, item name and index, return a string value for ID */
const makeItemId = (sectionStr, itemStr, index) => {