From e7a0759d24886cf875ccec610d371e664e63752b Mon Sep 17 00:00:00 2001 From: kemuru <102478601+kemuru@users.noreply.github.com> Date: Wed, 28 May 2025 17:40:04 +0200 Subject: [PATCH 1/2] fix: allow return in case evidence was opened in new tab --- web/src/components/EvidenceCard.tsx | 4 +++- web/src/pages/AttachmentDisplay/Header.tsx | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/src/components/EvidenceCard.tsx b/web/src/components/EvidenceCard.tsx index e25340907..f5f5c72d0 100644 --- a/web/src/components/EvidenceCard.tsx +++ b/web/src/components/EvidenceCard.tsx @@ -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"; @@ -224,6 +225,7 @@ const EvidenceCard: React.FC = ({ fileURI, }) => { const profileLink = `/profile/1/desc/all?address=${sender}`; + const { id } = useParams(); const transactionExplorerLink = useMemo(() => { return getTxnExplorerLink(transactionHash ?? ""); @@ -258,7 +260,7 @@ const EvidenceCard: React.FC = ({ {fileURI && fileURI !== "-" ? ( - + diff --git a/web/src/pages/AttachmentDisplay/Header.tsx b/web/src/pages/AttachmentDisplay/Header.tsx index 2283e0a0e..ae622af24 100644 --- a/web/src/pages/AttachmentDisplay/Header.tsx +++ b/web/src/pages/AttachmentDisplay/Header.tsx @@ -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"; @@ -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 ( From dde0dc7844383695259a1a4f2f3b581219019b3e Mon Sep 17 00:00:00 2001 From: kemuru <102478601+kemuru@users.noreply.github.com> Date: Wed, 28 May 2025 18:18:07 +0200 Subject: [PATCH 2/2] fix: few more links handling --- web/src/components/DisputePreview/Policies.tsx | 12 ++++++++++-- web/src/pages/AttachmentDisplay/Header.tsx | 11 ++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/web/src/components/DisputePreview/Policies.tsx b/web/src/components/DisputePreview/Policies.tsx index ad19094e0..013e2208a 100644 --- a/web/src/components/DisputePreview/Policies.tsx +++ b/web/src/components/DisputePreview/Policies.tsx @@ -1,6 +1,8 @@ import React from "react"; import styled, { css } from "styled-components"; +import { useParams } from "react-router-dom"; + import PaperclipIcon from "svgs/icons/paperclip.svg"; import PolicyIcon from "svgs/icons/policy.svg"; @@ -67,17 +69,23 @@ interface IPolicies { } export const Policies: React.FC = ({ disputePolicyURI, courtId, attachment }) => { + const { id } = useParams(); + return ( Policy documents: {!isUndefined(attachment) && !isUndefined(attachment.uri) ? ( - + {attachment.label ?? "Attachment"} ) : null} {isUndefined(disputePolicyURI) ? null : ( - + Dispute Policy diff --git a/web/src/pages/AttachmentDisplay/Header.tsx b/web/src/pages/AttachmentDisplay/Header.tsx index ae622af24..18dd6d9af 100644 --- a/web/src/pages/AttachmentDisplay/Header.tsx +++ b/web/src/pages/AttachmentDisplay/Header.tsx @@ -68,9 +68,18 @@ const Header: React.FC<{ title: string }> = ({ title }) => { const navigate = useNavigate(); const [searchParams] = useSearchParams(); const disputeId = searchParams.get("disputeId"); + const attachmentTitle = searchParams.get("title"); const handleReturn = () => { - navigate(`/cases/${disputeId}/evidence`); + if (attachmentTitle === "Evidence File") { + navigate(`/cases/${disputeId}/evidence`); + } else if (attachmentTitle === "Case Policy" || attachmentTitle === "Dispute Policy") { + navigate(`/cases/${disputeId}/overview`); + } else if (attachmentTitle === "Policy File") { + navigate(`/resolver/policy`); + } else { + navigate("/"); + } }; return (