Skip to content

Commit

Permalink
fix(web): fix-return-button-not-showing
Browse files Browse the repository at this point in the history
  • Loading branch information
Harman-singh-waraich committed Apr 5, 2024
1 parent f6a8280 commit 69cb4bb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions web/src/pages/SubmitList/NavigationButtons/PreviousButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import styled from "styled-components";
import { Button } from "@kleros/ui-components-library";
import { useNavigate } from "react-router-dom";
import { useLocation, useNavigate } from "react-router-dom";
import { ListProgress, useSubmitListContext } from "context/SubmitListContext";

const StyledButton = styled(Button)<{ prevRoute: string }>`
Expand All @@ -14,9 +14,15 @@ interface IReturnButton {

const ReturnButton: React.FC<IReturnButton> = ({ prevRoute }) => {
const navigate = useNavigate();
const location = useLocation();

const isDeployPage = location.pathname.includes("/deploy");

const { progress, isSubmittingList } = useSubmitListContext();

const hideReturn = isDeployPage && progress === ListProgress.SubmitSuccess;
return (
progress !== ListProgress.SubmitSuccess && (
!hideReturn && (
<StyledButton
prevRoute={prevRoute}
onClick={() => navigate(prevRoute)}
Expand Down

0 comments on commit 69cb4bb

Please sign in to comment.