removed unused location store context

This commit is contained in:
Lucas Oliveira 2024-01-08 16:22:18 -03:00
commit c723924388
4 changed files with 1 additions and 55 deletions

View file

@ -26,15 +26,11 @@ import { useTypesStore } from "./stores/typesStore";
export default function App() {
const setCurrent = useLocationStore((state) => state.setCurrent);
const setShowSideBar = useLocationStore((state) => state.setShowSideBar);
const setIsStackedOpen = useLocationStore((state) => state.setIsStackedOpen);
let location = useLocation();
useEffect(() => {
setCurrent(location.pathname.replace(/\/$/g, "").split("/"));
setShowSideBar(true);
setIsStackedOpen(true);
}, [location.pathname, setCurrent, setIsStackedOpen, setShowSideBar]);
}, [location.pathname, setCurrent]);
const errorData = useAlertStore((state) => state.errorData);
const errorOpen = useAlertStore((state) => state.errorOpen);

View file

@ -155,12 +155,6 @@ export default function Page({
const [selectionMenuVisible, setSelectionMenuVisible] = useState(false);
const setExtraComponent = useLocationStore(
(state) => state.setExtraComponent
);
const setExtraNavigation = useLocationStore(
(state) => state.setExtraNavigation
);
const setErrorData = useAlertStore((state) => state.setErrorData);
const edgeUpdateSuccessful = useRef(true);
@ -304,11 +298,6 @@ export default function Page({
[getNodeId, setNodes, takeSnapshot, paste]
);
useEffect(() => {
setExtraComponent(<ExtraSidebar />);
setExtraNavigation({ title: "Components" });
}, []);
const onEdgeUpdateStart = useCallback(() => {
edgeUpdateSuccessful.current = false;
}, []);

View file

@ -10,19 +10,4 @@ export const useLocationStore = create<LocationStoreType>((set, get) => ({
setCurrent: (newState) => {
set({ current: newState });
},
setIsStackedOpen: (newState) => {
set({ isStackedOpen: newState });
},
showSideBar: window.location.pathname.split("/")[1] ? true : false,
setShowSideBar: (newState) => {
set({ showSideBar: newState });
},
extraNavigation: { title: "" },
setExtraNavigation: (newState) => {
set({ extraNavigation: newState });
},
extraComponent: <></>,
setExtraComponent: (newState) => {
set({ extraComponent: newState });
},
}));

View file

@ -1,28 +1,4 @@
export type LocationStoreType = {
current: Array<string>;
setCurrent: (newState: Array<string>) => void;
isStackedOpen: boolean;
setIsStackedOpen: (newState: boolean) => void;
showSideBar: boolean;
setShowSideBar: (newState: boolean) => void;
extraNavigation: {
title: string;
options?: Array<{
name: string;
href: string;
icon: React.ElementType;
children?: Array<JSX.Element>;
}>;
};
setExtraNavigation: (newState: {
title: string;
options?: Array<{
name: string;
href: string;
icon: React.ElementType;
children?: Array<JSX.Element>;
}>;
}) => void;
extraComponent: any;
setExtraComponent: (newState: JSX.Element) => void;
};