import "./SequenceNode.css"; import { FC, PropsWithChildren } from "react"; import { useConfirm } from "material-ui-confirm"; import { useSnackbar } from "notistack"; import IconButton from "@mui/material/IconButton"; import DeleteForeverIcon from "@mui/icons-material/DeleteForever"; import ArrowBackIcon from "@mui/icons-material/ArrowBack"; import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined"; import Edit from "@mui/icons-material/Edit"; import KeyboardArrowDownSharpIcon from "@mui/icons-material/KeyboardArrowDownSharp"; import AddOutlined from "@mui/icons-material/AddOutlined"; import InputBoolean from "components/Inputs/Base/InputBoolean"; import { SpeedDial } from "components/SpeedDial"; import { SequenceNodeElementProps } from "./types"; import { useSequenceNodeColor } from "./util"; export const SequenceNodeElement: FC< PropsWithChildren > = ({ label, height, width, onXClick, onEditClick = () => {}, onAdd = {}, onMove = {}, color, flipped, enabled, onSetEnabled, children, isClosed, setIsClosed, }) => { const confirm = useConfirm(); const snackbr = useSnackbar(); const nodeColor = useSequenceNodeColor(color); return ( <>
} > {Object.entries(onMove).map(([key, action]) => ( ))} {Object.entries(onAdd).map(([key, action]) => ( ))} {onXClick && ( { confirm({ description: "Are you sure you want to delete this node?", }) .then(() => { onXClick(); snackbr.enqueueSnackbar("Deleted.", { variant: "info", }); }) .catch(() => snackbr.enqueueSnackbar("Did not delete node.", { variant: "info", }) ); }} size="small" > )} {!!onSetEnabled && ( )} {children}
setIsClosed && setIsClosed(!isClosed)} > {typeof label === "string" ? {label} : label} {!!setIsClosed && }
); };