✨ (nodeToolbarComponent/index.tsx): Remove unused import of iconClasses from @mui/material to improve code cleanliness and reduce bundle size

♻️ (nodeToolbarComponent/index.tsx): Refactor code to improve readability and maintainability by adding line breaks and indentation
✨ (nodeToolbarComponent/index.tsx): Refactor code to improve readability and maintainability by extracting complex condition into a separate if statement
♻️ (nodeToolbarComponent/index.tsx): Refactor code to improve readability and maintainability by adding line breaks and indentation
♻️ (nodeToolbarComponent/index.tsx): Refactor code to improve readability and maintainability by adding line breaks and indentation
This commit is contained in:
cristhianzl 2024-03-29 00:20:59 -03:00
commit 4f5cb3c0b7

View file

@ -31,7 +31,6 @@ import {
} from "../../../../utils/reactflowUtils"; } from "../../../../utils/reactflowUtils";
import { classNames, cn } from "../../../../utils/utils"; import { classNames, cn } from "../../../../utils/utils";
import ToolbarSelectItem from "./toolbarSelectItem"; import ToolbarSelectItem from "./toolbarSelectItem";
import { iconClasses } from "@mui/material";
export default function NodeToolbarComponent({ export default function NodeToolbarComponent({
data, data,
@ -86,7 +85,9 @@ export default function NodeToolbarComponent({
const [showModalAdvanced, setShowModalAdvanced] = useState(false); const [showModalAdvanced, setShowModalAdvanced] = useState(false);
const [showconfirmShare, setShowconfirmShare] = useState(false); const [showconfirmShare, setShowconfirmShare] = useState(false);
const [showOverrideModal, setShowOverrideModal] = useState(false); const [showOverrideModal, setShowOverrideModal] = useState(false);
const [flowComponent, setFlowComponent] = useState<FlowType>(createFlowComponent(cloneDeep(data), version)); const [flowComponent, setFlowComponent] = useState<FlowType>(
createFlowComponent(cloneDeep(data), version)
);
const openInNewTab = (url) => { const openInNewTab = (url) => {
window.open(url, "_blank", "noreferrer"); window.open(url, "_blank", "noreferrer");
@ -286,7 +287,13 @@ export default function NodeToolbarComponent({
event.preventDefault(); event.preventDefault();
setShowconfirmShare((state) => !state); setShowconfirmShare((state) => !state);
} }
if (selected && (event.ctrlKey || event.metaKey) && event.shiftKey && event.key === "q") {
if (
selected &&
(event.ctrlKey || event.metaKey) &&
event.shiftKey &&
event.key === "Q"
) {
event.preventDefault(); event.preventDefault();
if (isMinimal) { if (isMinimal) {
setShowState((show) => !show); setShowState((show) => !show);
@ -512,7 +519,9 @@ export default function NodeToolbarComponent({
isMac={navigator.userAgent.toUpperCase().includes("MAC")} isMac={navigator.userAgent.toUpperCase().includes("MAC")}
icon="Download" icon="Download"
styleObj={{ iconClasses: "relative top-0.5 mr-2 h-4 w-4" }} styleObj={{ iconClasses: "relative top-0.5 mr-2 h-4 w-4" }}
keyboardKey={"J"} dataTestId={"Dowload-button-nodeToolbar"} /> keyboardKey={"J"}
dataTestId={"Dowload-button-nodeToolbar"}
/>
</SelectItem> </SelectItem>
)} )}
<SelectItem <SelectItem
@ -534,8 +543,8 @@ export default function NodeToolbarComponent({
icon={showNode ? "Minimize2" : "Maximize2"} icon={showNode ? "Minimize2" : "Maximize2"}
value={showNode ? "Minimize" : "Expand"} value={showNode ? "Minimize" : "Expand"}
isMac={navigator.userAgent.toUpperCase().includes("MAC")} isMac={navigator.userAgent.toUpperCase().includes("MAC")}
shift={true} shift={true}
keyboardKey={"Q"} keyboardKey={"Q"}
dataTestId={"minimize-button-nodeToolbar"} dataTestId={"minimize-button-nodeToolbar"}
/> />
</SelectItem> </SelectItem>