Skip to content

Commit

Permalink
chore: Setup link in sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed May 17, 2024
1 parent 386c755 commit 8fbe1d6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions editor.planx.uk/src/pages/FlowEditor/components/EditorMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import FactCheckIcon from "@mui/icons-material/FactCheck";
import RateReviewIcon from "@mui/icons-material/RateReview";
import TuneIcon from "@mui/icons-material/Tune";
import Box from "@mui/material/Box";
import IconButton from "@mui/material/IconButton";
Expand Down Expand Up @@ -68,10 +69,10 @@ const MenuButton = styled(IconButton, {

function EditorMenu() {
const { navigate } = useNavigation();
const { lastChunk } = useCurrentRoute();
const { url } = useCurrentRoute();
const rootPath = rootFlowPath();

const isActive = (route: string) => lastChunk.url.pathname.endsWith(route);
const isActive = (route: string) => url.pathname.endsWith(route);
const handleClick = (route: string) =>
!isActive(route) && navigate(rootPath + route);

Expand All @@ -91,6 +92,11 @@ function EditorMenu() {
Icon: FactCheckIcon,
route: "/submissions-log",
},
{
title: "Feedback",
Icon: RateReviewIcon,
route: "/feedback",
},
];

return (
Expand Down

0 comments on commit 8fbe1d6

Please sign in to comment.