Skip to content

fix: allow return in case evidence was opened in new tab #2013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion web/src/components/EvidenceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styled, { css } from "styled-components";

import Identicon from "react-identicons";
import ReactMarkdown from "react-markdown";
import { useParams } from "react-router-dom";

import { Card } from "@kleros/ui-components-library";

Expand Down Expand Up @@ -224,6 +225,7 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({
fileURI,
}) => {
const profileLink = `/profile/1/desc/all?address=${sender}`;
const { id } = useParams();

const transactionExplorerLink = useMemo(() => {
return getTxnExplorerLink(transactionHash ?? "");
Expand Down Expand Up @@ -258,7 +260,7 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({
</BottomLeftContent>
{fileURI && fileURI !== "-" ? (
<FileLinkContainer>
<StyledInternalLink to={`/attachment/?title=${"Evidence File"}&url=${getIpfsUrl(fileURI)}`}>
<StyledInternalLink to={`/attachment/?disputeId=${id}&title=${"Evidence File"}&url=${getIpfsUrl(fileURI)}`}>
<AttachmentIcon />
<AttachedFileText />
</StyledInternalLink>
Expand Down
6 changes: 4 additions & 2 deletions web/src/pages/AttachmentDisplay/Header.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 { useNavigate } from "react-router-dom";
import { useNavigate, useSearchParams } from "react-router-dom";

import { Button } from "@kleros/ui-components-library";

Expand Down Expand Up @@ -66,9 +66,11 @@ const StyledButton = styled(Button)`

const Header: React.FC<{ title: string }> = ({ title }) => {
const navigate = useNavigate();
const [searchParams] = useSearchParams();
const disputeId = searchParams.get("disputeId");

const handleReturn = () => {
navigate(-1);
navigate(`/cases/${disputeId}/evidence`);
};

return (
Expand Down
Loading