Skip to content

Commit f314504

Browse files
authored
Merge pull request #1754 from kleros/feat(web)/ux-ui-impros-in-evidence-cards-and-case-overview
feat: UX & UI impros in various places (evidence cards, voting cards, case overview, top jurors)
2 parents 884674e + fd6a186 commit f314504

File tree

18 files changed

+157
-38
lines changed

18 files changed

+157
-38
lines changed

subgraph/core/schema.graphql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ interface Evidence {
5656
sender: User!
5757
senderAddress: String!
5858
timestamp: BigInt!
59+
transactionHash: Bytes!
5960
name: String
6061
description: String
6162
fileURI: String
@@ -318,6 +319,7 @@ type ClassicEvidence implements Evidence @entity(immutable: true) {
318319
sender: User!
319320
senderAddress: String!
320321
timestamp: BigInt!
322+
transactionHash: Bytes!
321323
name: String
322324
description: String
323325
fileURI: String

subgraph/core/src/EvidenceModule.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export function handleEvidenceEvent(event: EvidenceEvent): void {
1717
evidence.evidenceIndex = evidenceIndex.plus(ONE).toString();
1818
const userId = event.params._party.toHexString();
1919
evidence.timestamp = event.block.timestamp;
20+
evidence.transactionHash = event.transaction.hash;
2021
evidence.evidence = event.params._evidence;
2122
evidence.evidenceGroup = evidenceGroupID.toString();
2223
evidence.sender = userId;

subgraph/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kleros/kleros-v2-subgraph",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"license": "MIT",
55
"scripts": {
66
"update:core:arbitrum-sepolia-devnet": "./scripts/update.sh arbitrumSepoliaDevnet arbitrum-sepolia core/subgraph.yaml",

web/src/assets/svgs/icons/calendar.svg

Lines changed: 1 addition & 1 deletion
Loading

web/src/assets/svgs/icons/law-balance.svg

Lines changed: 1 addition & 1 deletion
Loading

web/src/components/DisputePreview/Policies.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from "react";
22
import styled, { css } from "styled-components";
33

4+
import { Link } from "react-router-dom";
5+
46
import PaperclipIcon from "svgs/icons/paperclip.svg";
57
import PolicyIcon from "svgs/icons/policy.svg";
68

@@ -59,6 +61,12 @@ const LinkContainer = styled.div`
5961
display: flex;
6062
gap: ${responsiveSize(16, 24)};
6163
flex-wrap: wrap;
64+
align-items: center;
65+
`;
66+
67+
const StyledLink = styled(Link)`
68+
display: flex;
69+
gap: 4px;
6270
`;
6371

6472
type Attachment = {
@@ -83,10 +91,10 @@ export const Policies: React.FC<IPolicies> = ({ disputePolicyURI, courtId, attac
8391
</StyledA>
8492
) : null}
8593
{isUndefined(disputePolicyURI) ? null : (
86-
<StyledA href={getIpfsUrl(disputePolicyURI)} target="_blank" rel="noreferrer">
94+
<StyledLink to={`policy/attachment/?url=${getIpfsUrl(disputePolicyURI)}`}>
8795
<StyledPolicyIcon />
8896
Dispute Policy
89-
</StyledA>
97+
</StyledLink>
9098
)}
9199
{isUndefined(courtId) ? null : (
92100
<StyledA href={`#/courts/${courtId}/purpose?section=description`}>

web/src/components/DisputeView/DisputeInfo/DisputeInfoCard.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { getCourtsPath } from "pages/Courts/CourtDetails";
1212

1313
import CardLabel from "../CardLabels";
1414

15-
import { FieldItem, IDisputeInfo } from ".";
15+
import { FieldItem, IDisputeInfo } from "./index";
1616

1717
const Container = styled.div`
1818
display: flex;
@@ -59,6 +59,7 @@ const StyledField = styled(Field)`
5959
margin-left: 8px;
6060
overflow: hidden;
6161
text-overflow: ellipsis;
62+
text-wrap: auto;
6263
}
6364
}
6465
`;
@@ -86,7 +87,13 @@ const DisputeInfoCard: React.FC<IDisputeInfoCard> = ({
8687
<Container>
8788
{court && courtId && isOverview && (
8889
<CourtBranchFieldContainer>
89-
<StyledField icon={LawBalanceIcon} name="Court Branch" value={courtBranchValue} {...{ isOverview }} />
90+
<StyledField
91+
link={`/courts/${courtId}`}
92+
icon={LawBalanceIcon}
93+
name="Court Branch"
94+
value={courtBranchValue}
95+
{...{ isOverview }}
96+
/>
9097
</CourtBranchFieldContainer>
9198
)}
9299
<RestOfFieldsContainer {...{ isOverview }}>

web/src/components/EvidenceCard.tsx

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { useMemo } from "react";
22
import styled, { css } from "styled-components";
33

44
import Identicon from "react-identicons";
@@ -9,6 +9,7 @@ import { Card } from "@kleros/ui-components-library";
99

1010
import AttachmentIcon from "svgs/icons/attachment.svg";
1111

12+
import { DEFAULT_CHAIN, getChain } from "consts/chains";
1213
import { formatDate } from "utils/date";
1314
import { getIpfsUrl } from "utils/getIpfsUrl";
1415
import { shortenAddress } from "utils/shortenAddress";
@@ -116,6 +117,19 @@ const StyledLink = styled(Link)`
116117
)}
117118
`;
118119

120+
const StyledA = styled.a`
121+
:hover {
122+
text-decoration: underline;
123+
p {
124+
color: ${({ theme }) => theme.primaryBlue};
125+
}
126+
label {
127+
cursor: pointer;
128+
color: ${({ theme }) => theme.primaryBlue};
129+
}
130+
}
131+
`;
132+
119133
const AttachedFileText: React.FC = () => (
120134
<>
121135
<DesktopText>View attached file</DesktopText>
@@ -126,9 +140,27 @@ const AttachedFileText: React.FC = () => (
126140
interface IEvidenceCard extends Pick<Evidence, "evidence" | "timestamp" | "name" | "description" | "fileURI"> {
127141
sender: string;
128142
index: number;
143+
transactionHash: string;
129144
}
130145

131-
const EvidenceCard: React.FC<IEvidenceCard> = ({ evidence, sender, index, timestamp, name, description, fileURI }) => {
146+
const EvidenceCard: React.FC<IEvidenceCard> = ({
147+
evidence,
148+
sender,
149+
index,
150+
timestamp,
151+
transactionHash,
152+
name,
153+
description,
154+
fileURI,
155+
}) => {
156+
const addressExplorerLink = useMemo(() => {
157+
return `${getChain(DEFAULT_CHAIN)?.blockExplorers?.default.url}/address/${sender}`;
158+
}, [sender]);
159+
160+
const transactionExplorerLink = useMemo(() => {
161+
return `${getChain(DEFAULT_CHAIN)?.blockExplorers?.default.url}/tx/${transactionHash}`;
162+
}, [transactionHash]);
163+
132164
return (
133165
<StyledCard>
134166
<TextContainer>
@@ -145,15 +177,19 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({ evidence, sender, index, timest
145177
<BottomShade>
146178
<AccountContainer>
147179
<Identicon size="24" string={sender} />
148-
<p>{shortenAddress(sender)}</p>
180+
<StyledA href={addressExplorerLink} rel="noopener noreferrer" target="_blank">
181+
<p>{shortenAddress(sender)}</p>
182+
</StyledA>
149183
</AccountContainer>
150-
<Timestamp>{formatDate(Number(timestamp), true)}</Timestamp>
151-
{fileURI && (
184+
<StyledA href={transactionExplorerLink} rel="noopener noreferrer" target="_blank">
185+
<Timestamp>{formatDate(Number(timestamp), true)}</Timestamp>
186+
</StyledA>
187+
{fileURI && fileURI !== "-" ? (
152188
<StyledLink to={`attachment/?url=${getIpfsUrl(fileURI)}`}>
153189
<AttachmentIcon />
154190
<AttachedFileText />
155191
</StyledLink>
156-
)}
192+
) : null}
157193
</BottomShade>
158194
</StyledCard>
159195
);

web/src/components/Field.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from "react";
22
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
34

45
import { Link } from "react-router-dom";
56

6-
import { landscapeStyle } from "styles/landscapeStyle";
7+
import { useScrollTop } from "hooks/useScrollTop";
78

89
const FieldContainer = styled.div<FieldContainerProps>`
910
display: flex;
@@ -61,6 +62,8 @@ const LinkContainer = styled.div``;
6162

6263
const StyledLink = styled(Link)`
6364
color: ${({ theme }) => theme.primaryBlue};
65+
text-wrap: auto;
66+
justify-content: end;
6467
`;
6568

6669
type FieldContainerProps = {
@@ -93,6 +96,8 @@ const Field: React.FC<IField> = ({
9396
isJurorBalance,
9497
className,
9598
}) => {
99+
const scrollTop = useScrollTop();
100+
96101
return (
97102
<FieldContainer isList={displayAsList} {...{ isOverview, isJurorBalance, width, className }}>
98103
<Icon />
@@ -103,6 +108,7 @@ const Field: React.FC<IField> = ({
103108
to={link}
104109
onClick={(event) => {
105110
event.stopPropagation();
111+
scrollTop();
106112
}}
107113
>
108114
{value}

web/src/hooks/queries/useEvidences.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const evidenceFragment = graphql(`
1515
id
1616
}
1717
timestamp
18+
transactionHash
1819
name
1920
description
2021
fileURI

0 commit comments

Comments
 (0)