Skip to content

Commit 527c970

Browse files
Conditionally render Attachment link in Evidence component
The Attachment link in the Evidence component is now rendered only if evidence.fileURI has a value. This prevents a broken link from showing when no attachment is available.
1 parent fb94edb commit 527c970

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/app/[locale]/case/[disputeId]/components/Evidence.tsx

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,26 @@ const Evidence: React.FC<IEvidence> = async ({ evidenceGroupId }) => {
5151
>
5252
{t("from", { user: shortenAddress(evidence.sender.id) })}
5353
</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>
54+
{evidence.fileURI && evidence.fileURI.length > 0 && (
55+
<Link
56+
href={ipfsUrl(evidence.fileURI)}
57+
target="_blank"
58+
rel="noopener noreferrer"
59+
>
60+
<div className="flex gap-2 items-center">
61+
<Image
62+
src="/attachment.svg"
63+
alt="attachment"
64+
width="24"
65+
height="24"
66+
className="inline w-4"
67+
/>
68+
<span className="text-base text-primary-blue">
69+
{t("attachment")}
70+
</span>
71+
</div>
72+
</Link>
73+
)}
7274
</div>
7375
</div>
7476
))}

0 commit comments

Comments
 (0)