File tree Expand file tree Collapse file tree 3 files changed +26
-5
lines changed
Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 11import React from "react" ;
22import styled , { css } from "styled-components" ;
33
4+ import { useParams } from "react-router-dom" ;
5+
46import PaperclipIcon from "svgs/icons/paperclip.svg" ;
57import PolicyIcon from "svgs/icons/policy.svg" ;
68
@@ -67,17 +69,23 @@ interface IPolicies {
6769}
6870
6971export const Policies : React . FC < IPolicies > = ( { disputePolicyURI, courtId, attachment } ) => {
72+ const { id } = useParams ( ) ;
73+
7074 return (
7175 < Container >
7276 < StyledP > Policy documents:</ StyledP >
7377 { ! isUndefined ( attachment ) && ! isUndefined ( attachment . uri ) ? (
74- < StyledInternalLink to = { `/attachment/?title=${ "Case Policy" } &url=${ getIpfsUrl ( attachment . uri ) } ` } >
78+ < StyledInternalLink
79+ to = { `/attachment/?disputeId=${ id } &title=${ "Case Policy" } &url=${ getIpfsUrl ( attachment . uri ) } ` }
80+ >
7581 < StyledPaperclipIcon />
7682 { attachment . label ?? "Attachment" }
7783 </ StyledInternalLink >
7884 ) : null }
7985 { isUndefined ( disputePolicyURI ) ? null : (
80- < StyledInternalLink to = { `/attachment/?title=${ "Dispute Policy" } &url=${ getIpfsUrl ( disputePolicyURI ) } ` } >
86+ < StyledInternalLink
87+ to = { `/attachment/?disputeId=${ id } &title=${ "Dispute Policy" } &url=${ getIpfsUrl ( disputePolicyURI ) } ` }
88+ >
8189 < StyledPolicyIcon />
8290 Dispute Policy
8391 </ StyledInternalLink >
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import styled, { css } from "styled-components";
33
44import Identicon from "react-identicons" ;
55import ReactMarkdown from "react-markdown" ;
6+ import { useParams } from "react-router-dom" ;
67
78import { Card } from "@kleros/ui-components-library" ;
89
@@ -224,6 +225,7 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({
224225 fileURI,
225226} ) => {
226227 const profileLink = `/profile/1/desc/all?address=${ sender } ` ;
228+ const { id } = useParams ( ) ;
227229
228230 const transactionExplorerLink = useMemo ( ( ) => {
229231 return getTxnExplorerLink ( transactionHash ?? "" ) ;
@@ -258,7 +260,7 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({
258260 </ BottomLeftContent >
259261 { fileURI && fileURI !== "-" ? (
260262 < FileLinkContainer >
261- < StyledInternalLink to = { `/attachment/?title=${ "Evidence File" } &url=${ getIpfsUrl ( fileURI ) } ` } >
263+ < StyledInternalLink to = { `/attachment/?disputeId= ${ id } & title=${ "Evidence File" } &url=${ getIpfsUrl ( fileURI ) } ` } >
262264 < AttachmentIcon />
263265 < AttachedFileText />
264266 </ StyledInternalLink >
Original file line number Diff line number Diff line change 11import React from "react" ;
22import styled from "styled-components" ;
33
4- import { useNavigate } from "react-router-dom" ;
4+ import { useNavigate , useSearchParams } from "react-router-dom" ;
55
66import { Button } from "@kleros/ui-components-library" ;
77
@@ -66,9 +66,20 @@ const StyledButton = styled(Button)`
6666
6767const Header : React . FC < { title : string } > = ( { title } ) => {
6868 const navigate = useNavigate ( ) ;
69+ const [ searchParams ] = useSearchParams ( ) ;
70+ const disputeId = searchParams . get ( "disputeId" ) ;
71+ const attachmentTitle = searchParams . get ( "title" ) ;
6972
7073 const handleReturn = ( ) => {
71- navigate ( - 1 ) ;
74+ if ( attachmentTitle === "Evidence File" ) {
75+ navigate ( `/cases/${ disputeId } /evidence` ) ;
76+ } else if ( attachmentTitle === "Case Policy" || attachmentTitle === "Dispute Policy" ) {
77+ navigate ( `/cases/${ disputeId } /overview` ) ;
78+ } else if ( attachmentTitle === "Policy File" ) {
79+ navigate ( `/resolver/policy` ) ;
80+ } else {
81+ navigate ( "/" ) ;
82+ }
7283 } ;
7384
7485 return (
You can’t perform that action at this time.
0 commit comments