Skip to content

Commit 3a41d0b

Browse files
Merge branch 'dev' into fix(web)-prevent-long-text-overflow
2 parents 28f26bd + a8e8699 commit 3a41d0b

File tree

4 files changed

+22
-29
lines changed

4 files changed

+22
-29
lines changed

web/src/components/EnsureChain.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22

3-
import { useChainId } from "wagmi";
3+
import { useAccount } from "wagmi";
44

55
import { DEFAULT_CHAIN } from "consts/chains";
66

@@ -12,7 +12,7 @@ interface IEnsureChain {
1212
}
1313

1414
export const EnsureChain: React.FC<IEnsureChain> = ({ children, className }) => {
15-
const chainId = useChainId();
15+
const { chainId } = useAccount();
1616

1717
return chainId === DEFAULT_CHAIN ? children : <ConnectWallet {...{ className }} />;
1818
};

web/src/components/Field.tsx

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ const FieldContainer = styled.div<FieldContainerProps>`
2424
flex-shrink: 0;
2525
}
2626
27-
.link {
28-
color: ${({ theme }) => theme.primaryBlue};
29-
:hover {
30-
cursor: pointer;
31-
}
32-
}
3327
${({ isList }) =>
3428
isList &&
3529
css`
@@ -63,6 +57,12 @@ const FieldContainer = styled.div<FieldContainerProps>`
6357
`};
6458
`;
6559

60+
const LinkContainer = styled.div``;
61+
62+
const StyledLink = styled(Link)`
63+
color: ${({ theme }) => theme.primaryBlue};
64+
`;
65+
6666
type FieldContainerProps = {
6767
width?: string;
6868
isList?: boolean;
@@ -98,15 +98,16 @@ const Field: React.FC<IField> = ({
9898
<Icon />
9999
{(!displayAsList || isOverview || isJurorBalance) && <label>{name}:</label>}
100100
{link ? (
101-
<Link
102-
className="link value"
103-
to={link}
104-
onClick={(event) => {
105-
event.stopPropagation();
106-
}}
107-
>
108-
{value}
109-
</Link>
101+
<LinkContainer className="value">
102+
<StyledLink
103+
to={link}
104+
onClick={(event) => {
105+
event.stopPropagation();
106+
}}
107+
>
108+
{value}
109+
</StyledLink>
110+
</LinkContainer>
110111
) : (
111112
<label className="value">{value}</label>
112113
)}

web/src/utils/commify.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
export function commify(value: string | number): string {
22
const comps = String(value).split(".");
33

4-
if (
5-
comps.length > 2 ||
6-
!comps[0].match(/^-?[0-9]*$/) ||
7-
(comps[1] && !comps[1].match(/^[0-9]*$/)) ||
8-
value === "." ||
9-
value === "-."
10-
) {
11-
return value.toString();
4+
if (!String(value).match(/^-?[0-9]*\.?[0-9]*$/)) {
5+
return "0";
126
}
137

148
// Make sure we have at least one whole digit (0 if none)

web/src/utils/uri.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ import { Dispute_Filter } from "src/graphql/graphql";
55
export const encodeURIFilter = (filter: Dispute_Filter): string => {
66
if (Object.keys(filter).length === 0) {
77
return "all";
8-
} else {
9-
return encodeURI(JSON.stringify(filter));
108
}
9+
return encodeURIComponent(JSON.stringify(filter));
1110
};
1211

1312
export const decodeURIFilter = (filter: string): Dispute_Filter => {
1413
if (filter === "all") {
1514
return {};
16-
} else {
17-
return JSON.parse(decodeURI(filter));
1815
}
16+
return JSON.parse(decodeURI(filter));
1917
};
2018

2119
export const useRootPath = () => {

0 commit comments

Comments
 (0)