+
+
+
+ {menuItems.map(menuItem => {
+ // const isActive = isMenuActive(location, menuItem);
+
+ if (
+ menuItem.permission &&
+ !user.userPermissions
+ .map(perm => perm.code)
+ .includes(menuItem.permission)
+ ) {
+ return null;
+ }
+
+ return
;
+ })}
+ {renderConfigure && (
+
+ )}
+
+
+ );
+};
+
+SideBar.displayName = "SideBar";
+export default SideBar;
diff --git a/src/components/SideBar/SubMenu.tsx b/src/components/SideBar/SubMenu.tsx
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/components/SideBar/index.ts b/src/components/SideBar/index.ts
new file mode 100644
index 000000000..df08bddc7
--- /dev/null
+++ b/src/components/SideBar/index.ts
@@ -0,0 +1,2 @@
+export * from "./SideBar";
+export { default } from "./SideBar";
diff --git a/src/components/SideBar/utils.ts b/src/components/SideBar/utils.ts
new file mode 100644
index 000000000..bd894f877
--- /dev/null
+++ b/src/components/SideBar/utils.ts
@@ -0,0 +1,14 @@
+import { orderDraftListUrl, orderListUrl } from "@saleor/orders/urls";
+import { matchPath } from "react-router";
+
+import { IMenuItem } from "../AppLayout/menuStructure";
+
+export function isMenuActive(location: string, menuItem: IMenuItem) {
+ return location.split("?")[0] === orderDraftListUrl().split("?")[0] &&
+ menuItem.url.split("?")[0] === orderListUrl().split("?")[0]
+ ? false
+ : !!matchPath(location.split("?")[0], {
+ exact: menuItem.url.split("?")[0] === "/",
+ path: menuItem.url.split("?")[0]
+ });
+}