@@ -27,51 +27,58 @@ const Evidence: React.FC<IEvidence> = async ({ evidenceGroupId }) => {
2727 return (
2828 < div className = "w-full px-4 space-y-6" >
2929 < h3 className = "text-primary-text text-lg text-center" > { t ( "title" ) } </ h3 >
30- { data . evidences . map ( ( evidence , i ) => (
31- < div key = { evidence . evidenceIndex } className = "w-full" >
32- < h4
33- className = "text-base md:text-md text-primary-text font-semibold"
34- dir = "auto"
35- >
36- #{ i + 1 } { evidence . name }
37- </ h4 >
38- < Separator className = "bg-stroke my-1" />
39- < p className = "text-primary-text text-base pl-2" dir = "auto" >
40- { evidence . description }
41- </ p >
42- < div
43- className = {
44- "mt-1 bg-stroke flex justify-between items-center px-2 py-1"
45- }
46- >
47- < span
30+ { data . evidences . map ( ( evidence , i ) => {
31+ const hasFileURI = evidence . fileURI && evidence . fileURI . length > 0 ;
32+ const isIpfsPath = hasFileURI && evidence . fileURI . startsWith ( "/ipfs/" ) ;
33+
34+ return (
35+ < div key = { evidence . evidenceIndex } className = "w-full" >
36+ < h4
37+ className = "text-base md:text-md text-primary-text font-semibold"
38+ dir = "auto"
39+ >
40+ #{ i + 1 } { evidence . name }
41+ </ h4 >
42+ < Separator className = "bg-stroke my-1" />
43+ < p className = "text-primary-text text-base pl-2" dir = "auto" >
44+ { evidence . description }
45+ </ p >
46+ < div
4847 className = {
49- "text-xs md:text-base align-middle text-secondary-text "
48+ "mt-1 bg-stroke flex justify-between items-center px-2 py-1 "
5049 }
5150 >
52- { t ( "from" , { user : shortenAddress ( evidence . sender . id ) } ) }
53- </ span >
54- < Link
55- href = { ipfsUrl ( evidence . fileURI ) }
56- target = "_blank"
57- rel = "noopener noreferrer"
58- >
59- < div className = "flex gap-2 items-center" >
60- < Image
61- src = "/attachment.svg"
62- alt = "attachment"
63- width = "24"
64- height = "24"
65- className = "inline w-4"
66- />
67- < span className = "text-base text-primary-blue" >
68- { t ( "attachment" ) }
69- </ span >
70- </ div >
71- </ Link >
51+ < span
52+ className = {
53+ "text-xs md:text-base align-middle text-secondary-text"
54+ }
55+ >
56+ { t ( "from" , { user : shortenAddress ( evidence . sender . id ) } ) }
57+ </ span >
58+ { isIpfsPath && (
59+ < Link
60+ href = { ipfsUrl ( evidence . fileURI ) }
61+ target = "_blank"
62+ rel = "noopener noreferrer"
63+ >
64+ < div className = "flex gap-2 items-center" >
65+ < Image
66+ src = "/attachment.svg"
67+ alt = "attachment"
68+ width = "24"
69+ height = "24"
70+ className = "inline w-4"
71+ />
72+ < span className = "text-base text-primary-blue" >
73+ { t ( "attachment" ) }
74+ </ span >
75+ </ div >
76+ </ Link >
77+ ) }
78+ </ div >
7279 </ div >
73- </ div >
74- ) ) }
80+ ) ;
81+ } ) }
7582 </ div >
7683 ) ;
7784} ;
0 commit comments