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 1
1
import React from "react" ;
2
2
import styled , { css } from "styled-components" ;
3
3
4
+ import { useParams } from "react-router-dom" ;
5
+
4
6
import PaperclipIcon from "svgs/icons/paperclip.svg" ;
5
7
import PolicyIcon from "svgs/icons/policy.svg" ;
6
8
@@ -67,17 +69,23 @@ interface IPolicies {
67
69
}
68
70
69
71
export const Policies : React . FC < IPolicies > = ( { disputePolicyURI, courtId, attachment } ) => {
72
+ const { id } = useParams ( ) ;
73
+
70
74
return (
71
75
< Container >
72
76
< StyledP > Policy documents:</ StyledP >
73
77
{ ! 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
+ >
75
81
< StyledPaperclipIcon />
76
82
{ attachment . label ?? "Attachment" }
77
83
</ StyledInternalLink >
78
84
) : null }
79
85
{ 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
+ >
81
89
< StyledPolicyIcon />
82
90
Dispute Policy
83
91
</ StyledInternalLink >
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import styled, { css } from "styled-components";
3
3
4
4
import Identicon from "react-identicons" ;
5
5
import ReactMarkdown from "react-markdown" ;
6
+ import { useParams } from "react-router-dom" ;
6
7
7
8
import { Card } from "@kleros/ui-components-library" ;
8
9
@@ -224,6 +225,7 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({
224
225
fileURI,
225
226
} ) => {
226
227
const profileLink = `/profile/1/desc/all?address=${ sender } ` ;
228
+ const { id } = useParams ( ) ;
227
229
228
230
const transactionExplorerLink = useMemo ( ( ) => {
229
231
return getTxnExplorerLink ( transactionHash ?? "" ) ;
@@ -258,7 +260,7 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({
258
260
</ BottomLeftContent >
259
261
{ fileURI && fileURI !== "-" ? (
260
262
< FileLinkContainer >
261
- < StyledInternalLink to = { `/attachment/?title=${ "Evidence File" } &url=${ getIpfsUrl ( fileURI ) } ` } >
263
+ < StyledInternalLink to = { `/attachment/?disputeId= ${ id } & title=${ "Evidence File" } &url=${ getIpfsUrl ( fileURI ) } ` } >
262
264
< AttachmentIcon />
263
265
< AttachedFileText />
264
266
</ StyledInternalLink >
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
import styled from "styled-components" ;
3
3
4
- import { useNavigate } from "react-router-dom" ;
4
+ import { useNavigate , useSearchParams } from "react-router-dom" ;
5
5
6
6
import { Button } from "@kleros/ui-components-library" ;
7
7
@@ -66,9 +66,20 @@ const StyledButton = styled(Button)`
66
66
67
67
const Header : React . FC < { title : string } > = ( { title } ) => {
68
68
const navigate = useNavigate ( ) ;
69
+ const [ searchParams ] = useSearchParams ( ) ;
70
+ const disputeId = searchParams . get ( "disputeId" ) ;
71
+ const attachmentTitle = searchParams . get ( "title" ) ;
69
72
70
73
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
+ }
72
83
} ;
73
84
74
85
return (
You can’t perform that action at this time.
0 commit comments