diff --git a/package-lock.json b/package-lock.json
index 5325e9117ea..1af2d8b8ca1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -27,7 +27,7 @@
"@material-ui/lab": "^4.0.0-alpha.61",
"@material-ui/styles": "^4.11.4",
"@reach/auto-id": "^0.16.0",
- "@saleor/macaw-ui": "0.8.0-pre.118",
+ "@saleor/macaw-ui": "0.8.0-pre.119",
"@saleor/sdk": "0.6.0",
"@sentry/react": "^6.0.0",
"@types/faker": "^5.1.6",
@@ -8507,9 +8507,9 @@
}
},
"node_modules/@saleor/macaw-ui": {
- "version": "0.8.0-pre.118",
- "resolved": "https://registry.npmjs.org/@saleor/macaw-ui/-/macaw-ui-0.8.0-pre.118.tgz",
- "integrity": "sha512-874riwHhbjrr0h3OlCxz9qlAq/sERQZYBnhtnlS4uGofJmJse+8leENasHgyrZe8Zyn9eV//X5NJId/qAHmF6g==",
+ "version": "0.8.0-pre.119",
+ "resolved": "https://registry.npmjs.org/@saleor/macaw-ui/-/macaw-ui-0.8.0-pre.119.tgz",
+ "integrity": "sha512-A9Pj91KTV7zynWby52kG+9KIx9eWTU9+l4Rw1TCfkKmwf9a5iZdve4TAbp2SXibyNATYxrPsbpa4oXcxQd98Wg==",
"dependencies": {
"@dessert-box/react": "^0.4.0",
"@floating-ui/react-dom-interactions": "^0.5.0",
@@ -41430,9 +41430,9 @@
}
},
"@saleor/macaw-ui": {
- "version": "0.8.0-pre.118",
- "resolved": "https://registry.npmjs.org/@saleor/macaw-ui/-/macaw-ui-0.8.0-pre.118.tgz",
- "integrity": "sha512-874riwHhbjrr0h3OlCxz9qlAq/sERQZYBnhtnlS4uGofJmJse+8leENasHgyrZe8Zyn9eV//X5NJId/qAHmF6g==",
+ "version": "0.8.0-pre.119",
+ "resolved": "https://registry.npmjs.org/@saleor/macaw-ui/-/macaw-ui-0.8.0-pre.119.tgz",
+ "integrity": "sha512-A9Pj91KTV7zynWby52kG+9KIx9eWTU9+l4Rw1TCfkKmwf9a5iZdve4TAbp2SXibyNATYxrPsbpa4oXcxQd98Wg==",
"requires": {
"@dessert-box/react": "^0.4.0",
"@floating-ui/react-dom-interactions": "^0.5.0",
diff --git a/package.json b/package.json
index 64b5aa27fc4..b1d3bd763fb 100644
--- a/package.json
+++ b/package.json
@@ -34,7 +34,7 @@
"@material-ui/lab": "^4.0.0-alpha.61",
"@material-ui/styles": "^4.11.4",
"@reach/auto-id": "^0.16.0",
- "@saleor/macaw-ui": "0.8.0-pre.118",
+ "@saleor/macaw-ui": "0.8.0-pre.119",
"@saleor/sdk": "0.6.0",
"@sentry/react": "^6.0.0",
"@types/faker": "^5.1.6",
diff --git a/src/components/Sidebar/user/Controls.tsx b/src/components/Sidebar/user/Controls.tsx
index 2bf2d0e8581..6989f05766a 100644
--- a/src/components/Sidebar/user/Controls.tsx
+++ b/src/components/Sidebar/user/Controls.tsx
@@ -1,4 +1,3 @@
-// @ts-strict-ignore
import { useUser } from "@dashboard/auth";
import { staffMemberDetailsUrl } from "@dashboard/staff/urls";
import { useTheme } from "@dashboard/theme";
@@ -29,11 +28,11 @@ export const useLegacyThemeHandler = () => {
};
const handleStorage = (event: StorageEvent) => {
- if (!["macaw-ui-theme", "activeMacawUITheme"].includes(event.key)) {
+ if (!["macaw-ui-theme", "activeMacawUITheme"].includes(event.key || "")) {
return;
}
- const isDark = event.newValue.toLowerCase().includes("dark");
+ const isDark = event.newValue?.toLowerCase().includes("dark");
setLegacyTheme(isDark ? "dark" : "light");
setTheme(isDark ? "defaultDark" : "defaultLight");
};
@@ -51,102 +50,107 @@ export const UserControls = () => {
const { user, logout } = useUser();
const { changeTheme, theme } = useLegacyThemeHandler();
const [open, setOpen] = useState(false);
+ const [flagsModalOpen, setFlagsModalOpen] = useState(false);
return (
- {
- setOpen(value);
- }}
- >
-
- }
- data-test-id="userMenu"
- size="medium"
- onClick={() => setOpen(true)}
- />
-
-
-
-
-
- setOpen(false)}
- >
-
+ {
+ setOpen(value);
+ }}
+ >
+
+ }
+ data-test-id="userMenu"
+ size="medium"
+ onClick={() => setOpen(true)}
+ />
+
+
+
+
+
+ setOpen(false)}
+ >
+
+
+
+
+
+
+
+
+ setFlagsModalOpen(true)}
>
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
- {
- changeTheme();
- setOpen(false);
- }}
- {...listItemStyles}
- data-test-id="theme-switch"
- >
-
-
-
-
-
-
-
+
+
+ {
+ changeTheme();
+ setOpen(false);
+ }}
+ {...listItemStyles}
+ data-test-id="theme-switch"
+ >
+
+
+
+
+
+
+
+
+ >
);
};
diff --git a/src/components/Sidebar/user/FeatureFlagsModal/index.tsx b/src/components/Sidebar/user/FeatureFlagsModal/index.tsx
index b49461c79c7..a8c2dfe2661 100644
--- a/src/components/Sidebar/user/FeatureFlagsModal/index.tsx
+++ b/src/components/Sidebar/user/FeatureFlagsModal/index.tsx
@@ -1,6 +1,6 @@
import { Name } from "@dashboard/featureFlags/availableFlags";
import { Box, Button, CloseIcon, Modal } from "@saleor/macaw-ui/next";
-import React, { ReactNode } from "react";
+import React from "react";
import { Content } from "./Content";
import { FlagList } from "./FlagList";
@@ -9,10 +9,14 @@ import { NoFlags } from "./NoFlags";
import { useFlagsState } from "./useFlagsState";
interface FeatureFlagsModalProps {
- children: ReactNode;
+ open: boolean;
+ onChange: (open: boolean) => void;
}
-export const FeatureFlagsModal = ({ children }: FeatureFlagsModalProps) => {
+export const FeatureFlagsModal = ({
+ open,
+ onChange,
+}: FeatureFlagsModalProps) => {
const { selectedFlag, hasNoFlags, changeTab } = useFlagsState();
const handleTabClick = (tabName: Name) => {
@@ -20,8 +24,7 @@ export const FeatureFlagsModal = ({ children }: FeatureFlagsModalProps) => {
};
return (
-
- {children}
+