import { useLocation } from "react-router-dom";
import Outcomes from "../Pages/Outcomes";
import VotesAndFavorites from "../Pages/VotesAndFavorites";
import { Box } from "@mui/material";
import GovernanceAction from "../Pages/GovernanceAction";
import { useModal } from "../contexts/modal";
import { callAll } from "../lib/callAll";
import { Modal } from "./modal/Modal";
function GlobalWrapper() {
const location = useLocation();
const { modal, openModal, modals } = useModal();
const getActionId = () => {
return location.pathname.split("/").pop() + location.hash;
};
const renderComponentBasedOnPath = () => {
if (location.pathname === "/outcomes") {
return ;
} else if (
location.pathname.includes("outcomes/governance_actions/") &&
getActionId()
) {
return ;
} else if (location.pathname.includes("my/votes_and_favorites")) {
return ;
} else {
return ;
}
};
return (
{renderComponentBasedOnPath()}
{modals[modal.type]?.component && (
openModal({ type: "none", state: null }),
)
: undefined
}
>
{modals[modal.type].component!}
)}
);
}
export default GlobalWrapper;