Refactor menuBar and headerComponent to use "nodes" instead of "n"

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-09 22:21:26 -03:00
commit 1f62ff3280
2 changed files with 6 additions and 6 deletions

View file

@ -34,7 +34,7 @@ export const MenuBar = ({
const redo = useFlowsManagerStore((state) => state.redo); const redo = useFlowsManagerStore((state) => state.redo);
const saveLoading = useFlowsManagerStore((state) => state.saveLoading); const saveLoading = useFlowsManagerStore((state) => state.saveLoading);
const [openSettings, setOpenSettings] = useState(false); const [openSettings, setOpenSettings] = useState(false);
const n = useFlowStore((state) => state.nodes); const nodes = useFlowStore((state) => state.nodes);
const uploadFlow = useFlowsManagerStore((state) => state.uploadFlow); const uploadFlow = useFlowsManagerStore((state) => state.uploadFlow);
const hasApiKey = useStoreStore((state) => state.hasApiKey); const hasApiKey = useStoreStore((state) => state.hasApiKey);
const validApiKey = useStoreStore((state) => state.validApiKey); const validApiKey = useStoreStore((state) => state.validApiKey);
@ -65,7 +65,7 @@ export const MenuBar = ({
<div className="round-button-div"> <div className="round-button-div">
<button <button
onClick={() => { onClick={() => {
removeFunction(n); removeFunction(nodes);
navigate(-1); navigate(-1);
}} }}
> >

View file

@ -33,7 +33,7 @@ export default function Header(): JSX.Element {
const removeFlow = useFlowsManagerStore((store) => store.removeFlow); const removeFlow = useFlowsManagerStore((store) => store.removeFlow);
const hasStore = useStoreStore((state) => state.hasStore); const hasStore = useStoreStore((state) => state.hasStore);
const { id } = useParams(); const { id } = useParams();
const n = useFlowStore((state) => state.nodes); const nodes = useFlowStore((state) => state.nodes);
const dark = useDarkStore((state) => state.dark); const dark = useDarkStore((state) => state.dark);
const setDark = useDarkStore((state) => state.setDark); const setDark = useDarkStore((state) => state.setDark);
@ -57,7 +57,7 @@ export default function Header(): JSX.Element {
return ( return (
<div className="header-arrangement"> <div className="header-arrangement">
<div className="header-start-display lg:w-[30%]"> <div className="header-start-display lg:w-[30%]">
<Link to="/" onClick={() => checkForChanges(n)}> <Link to="/" onClick={() => checkForChanges(nodes)}>
<span className="ml-4 text-2xl">⛓️</span> <span className="ml-4 text-2xl">⛓️</span>
</Link> </Link>
<MenuBar removeFunction={checkForChanges} /> <MenuBar removeFunction={checkForChanges} />
@ -74,7 +74,7 @@ export default function Header(): JSX.Element {
} }
size="sm" size="sm"
onClick={() => { onClick={() => {
checkForChanges(n); checkForChanges(nodes);
}} }}
> >
<IconComponent name="Home" className="h-4 w-4" /> <IconComponent name="Home" className="h-4 w-4" />
@ -100,7 +100,7 @@ export default function Header(): JSX.Element {
variant={location.pathname === "/store" ? "primary" : "secondary"} variant={location.pathname === "/store" ? "primary" : "secondary"}
size="sm" size="sm"
onClick={() => { onClick={() => {
checkForChanges(n); checkForChanges(nodes);
}} }}
> >
<IconComponent name="Store" className="h-4 w-4" /> <IconComponent name="Store" className="h-4 w-4" />