diff --git a/packages/app/constants/defaultSettings.json b/packages/app/constants/defaultSettings.json index d0b0873d..d7600dd1 100755 --- a/packages/app/constants/defaultSettings.json +++ b/packages/app/constants/defaultSettings.json @@ -16,14 +16,5 @@ "feed_max_fetch": 20, "style.compactMode": false, "sidebar.floating": false, - "language": "en", - "sidebarKeys": [ - "home", - "tv", - "music", - "events", - "groups", - "marketplace", - "dev" - ] + "language": "en" } \ No newline at end of file diff --git a/packages/app/constants/routes.json b/packages/app/constants/routes.json index e278adf9..caa243e1 100755 --- a/packages/app/constants/routes.json +++ b/packages/app/constants/routes.json @@ -13,13 +13,6 @@ "icon": "Home", "reachable": true }, - { - "id": "events", - "path": "/events", - "title": "Events", - "icon": "MdLocalActivity", - "reachable": true - }, { "id": "tv", "path": "/tv", @@ -33,26 +26,5 @@ "title": "Music", "icon": "MdMusicVideo", "reachable": true - }, - { - "id": "groups", - "path": "/groups", - "title": "Groups", - "icon": "Users", - "reachable": true - }, - { - "id": "marketplace", - "path": "/marketplace", - "title": "Marketplace", - "icon": "Package", - "reachable": true - }, - { - "id": "dev", - "path": "/dev", - "title": "Development", - "icon": "MdOutlineCode", - "reachable": true } ] \ No newline at end of file diff --git a/packages/app/src/components/Layout/sidebar/index.jsx b/packages/app/src/components/Layout/sidebar/index.jsx index 449cf49c..8a44498d 100755 --- a/packages/app/src/components/Layout/sidebar/index.jsx +++ b/packages/app/src/components/Layout/sidebar/index.jsx @@ -5,7 +5,6 @@ import classnames from "classnames" import config from "config" import { Icons, createIconRender } from "components/Icons" -import { sidebarKeys as defaultSidebarItems } from "schemas/defaultSettings" import sidebarItems from "schemas/routes.json" @@ -21,6 +20,10 @@ const getSidebarComponents = () => { const items = {} sidebarItems.forEach((item, index) => { + if (!item.reachable) { + return + } + items[item.id] = { ...item, index, @@ -37,35 +40,18 @@ const getSidebarComponents = () => { const generateItems = () => { const components = getSidebarComponents() + const itemsMap = [] const pathResolvers = {} - const keys = window.app?.settings.get("sidebarKeys") ?? defaultSidebarItems - - // filter undefined components to avoid error - keys.filter((key) => { - if (typeof components[key] !== "undefined") { - return true - } - }) - - keys.forEach((key, index) => { + Object.keys(components).forEach((key, index) => { const component = components[key] - try { - // avoid if item is duplicated - if (itemsMap.includes(component)) { - return false - } - - if (typeof component.path !== "undefined") { - pathResolvers[component.id] = component.path - } - - itemsMap.push(component) - } catch (error) { - return console.log(error) + if (typeof component.path !== "undefined") { + pathResolvers[component.id] = component.path } + + itemsMap.push(component) }) return {