Skip to content

Commit db886f0

Browse files
committed
feat(web-devtools): display-copiable-ruler-address
1 parent a5b995a commit db886f0

File tree

1 file changed

+57
-20
lines changed

1 file changed

+57
-20
lines changed

web-devtools/src/app/(main)/ruler/SelectArbitrable.tsx

+57-20
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,60 @@
11
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
2-
import styled from "styled-components";
2+
import styled, { css } from "styled-components";
33

44
import { Address } from "viem";
55

6-
import { DropdownSelect, Field } from "@kleros/ui-components-library";
6+
import { Copiable, DropdownSelect, Field } from "@kleros/ui-components-library";
77

88
import { useRulerContext } from "context/RulerContext";
99
import { shortenAddress } from "utils/shortenAddress";
10+
import { klerosCoreAddress } from "hooks/contracts/generated";
11+
import { DEFAULT_CHAIN } from "consts/chains";
12+
import { landscapeStyle } from "styles/landscapeStyle";
1013

11-
const Arbitrables = styled.div`
14+
const Container = styled.div`
1215
width: 100%;
16+
display: flex;
17+
flex-wrap: wrap;
18+
justify-content: space-around;
19+
gap: 16px;
20+
align-items: center;
21+
margin: 16px 0;
22+
padding: 8px 16px;
23+
border-radius: 3px;
1324
background-color: ${({ theme }) => theme.klerosUIComponentsWhiteBackground};
25+
`;
26+
27+
const AddressContainer = styled.div`
28+
display: flex;
29+
gap: 8px;
30+
flex-wrap: wrap;
31+
align-items: center;
32+
justify-content: center;
33+
`;
34+
35+
const Arbitrables = styled.div`
1436
display: flex;
1537
flex-direction: row;
1638
flex-wrap: wrap;
1739
justify-content: center;
1840
align-items: center;
1941
gap: 8px;
20-
margin: 16px 0;
21-
padding: 8px 16px;
22-
border-radius: 3px;
2342
`;
2443
const StyledLabel = styled.label``;
2544

2645
const SelectContainer = styled.div`
2746
position: relative;
2847
`;
48+
49+
const StyledField = styled(Field)`
50+
width: auto;
51+
${landscapeStyle(
52+
() => css`
53+
min-width: 250px;
54+
`
55+
)}
56+
`;
57+
2958
const StyledDropdown = styled(DropdownSelect)`
3059
position: absolute;
3160
z-index: 0;
@@ -74,20 +103,28 @@ const SelectArbitrable: React.FC = () => {
74103
}, [knownArbitrables, ref]);
75104

76105
return (
77-
<Arbitrables suppressHydrationWarning={true}>
78-
<StyledLabel>Arbitrable:</StyledLabel>
79-
<SelectContainer ref={ref}>
80-
<StyledDropdown defaultValue={arbitrable} items={items} callback={(val) => setArbitrable(val as Address)} />
81-
<Field
82-
value={arbitrable}
83-
placeholder="Enter Arbitrable"
84-
onChange={(e) => {
85-
setArbitrable(e.target.value as Address);
86-
}}
87-
onClick={openDropdown}
88-
/>
89-
</SelectContainer>
90-
</Arbitrables>
106+
<Container>
107+
<AddressContainer>
108+
<StyledLabel>Ruler Address:</StyledLabel>
109+
<Copiable copiableContent={klerosCoreAddress[DEFAULT_CHAIN]} info="Ruler Address">
110+
<StyledLabel>{shortenAddress(klerosCoreAddress[DEFAULT_CHAIN])}</StyledLabel>
111+
</Copiable>
112+
</AddressContainer>
113+
<Arbitrables suppressHydrationWarning={true}>
114+
<StyledLabel>Arbitrable:</StyledLabel>
115+
<SelectContainer ref={ref}>
116+
<StyledDropdown defaultValue={arbitrable} items={items} callback={(val) => setArbitrable(val as Address)} />
117+
<StyledField
118+
value={arbitrable}
119+
placeholder="Enter Arbitrable"
120+
onChange={(e) => {
121+
setArbitrable(e.target.value as Address);
122+
}}
123+
onClick={openDropdown}
124+
/>
125+
</SelectContainer>
126+
</Arbitrables>
127+
</Container>
91128
);
92129
};
93130

0 commit comments

Comments
 (0)