fix(nodeToolbarComponent): refactor handleSelectChange function to use switch statement for better readability and maintainability
feat(nodeToolbarComponent): add "SaveAll" option to the select dropdown and log a message when selected
This commit is contained in:
parent
742ebae878
commit
7f3d57bfaa
1 changed files with 14 additions and 12 deletions
|
|
@ -11,7 +11,7 @@ import {
|
||||||
import { TabsContext } from "../../../../contexts/tabsContext";
|
import { TabsContext } from "../../../../contexts/tabsContext";
|
||||||
import EditNodeModal from "../../../../modals/EditNodeModal";
|
import EditNodeModal from "../../../../modals/EditNodeModal";
|
||||||
import { nodeToolbarPropsType } from "../../../../types/components";
|
import { nodeToolbarPropsType } from "../../../../types/components";
|
||||||
import { classNames, getRandomKeyByssmm } from "../../../../utils/utils";
|
import { classNames } from "../../../../utils/utils";
|
||||||
|
|
||||||
export default function NodeToolbarComponent({
|
export default function NodeToolbarComponent({
|
||||||
data,
|
data,
|
||||||
|
|
@ -53,14 +53,16 @@ export default function NodeToolbarComponent({
|
||||||
const [selectedValue, setSelectedValue] = useState("");
|
const [selectedValue, setSelectedValue] = useState("");
|
||||||
|
|
||||||
const handleSelectChange = (event) => {
|
const handleSelectChange = (event) => {
|
||||||
setSelectedValue(event);
|
switch (event) {
|
||||||
if (event.includes("advanced")) {
|
case "advanced":
|
||||||
return setShowModalAdvanced(true);
|
setShowModalAdvanced(true);
|
||||||
}
|
break;
|
||||||
setShowModalAdvanced(false);
|
case "show":
|
||||||
if (event.includes("show")) {
|
setShowNode((prev) => !prev);
|
||||||
setShowNode((prev) => !prev);
|
updateNodeInternals(data.id);
|
||||||
updateNodeInternals(data.id);
|
break;
|
||||||
|
case "SaveAll":
|
||||||
|
console.log("SaveAll");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -152,7 +154,7 @@ export default function NodeToolbarComponent({
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value={getRandomKeyByssmm() + "advanced"}>
|
<SelectItem value={"advanced"}>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Settings2"
|
name="Settings2"
|
||||||
|
|
@ -161,7 +163,7 @@ export default function NodeToolbarComponent({
|
||||||
Edit{" "}
|
Edit{" "}
|
||||||
</div>{" "}
|
</div>{" "}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
<SelectItem value={getRandomKeyByssmm() + "advanced"}>
|
<SelectItem value={"SaveAll"}>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="SaveAll"
|
name="SaveAll"
|
||||||
|
|
@ -171,7 +173,7 @@ export default function NodeToolbarComponent({
|
||||||
</div>{" "}
|
</div>{" "}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
{isMinimal && (
|
{isMinimal && (
|
||||||
<SelectItem value={getRandomKeyByssmm() + "show"}>
|
<SelectItem value={"show"}>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name={showNode ? "Minimize2" : "Maximize2"}
|
name={showNode ? "Minimize2" : "Maximize2"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue