Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit 1bd9907

Browse files
committed
merging in development
2 parents 97f1a3b + 6bfa51e commit 1bd9907

39 files changed

+5275
-414
lines changed

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"@0x/contract-addresses": "^4.1.0",
3838
"@0x/contract-wrappers": "^13.2.0",
3939
"@0x/contracts-dev-utils": "^1.0.2",
40+
"@0x/contracts-treasury": "^1.0.2",
4041
"@0x/json-schemas": "^5.0.2",
4142
"@0x/order-utils": "^10.0.1",
4243
"@0x/subproviders": "^6.0.2",
@@ -67,12 +68,17 @@
6768
"deep-equal": "^1.0.1",
6869
"ethereum-types": "^3.0.0",
6970
"ethereumjs-util": "^5.1.1",
71+
"ethers": "^5.0.24",
7072
"find-versions": "^2.0.0",
73+
"flickity": "^2.2.2",
7174
"fuse.js": "^3.4.6",
75+
"graphql": "^15.5.0",
76+
"graphql-request": "^3.4.0",
7277
"is-mobile": "^0.2.2",
7378
"less": "^2.7.2",
7479
"lodash": "^4.17.11",
7580
"lottie-web": "^5.6.2",
81+
"marked": "^2.0.0",
7682
"material-ui": "^0.20.0",
7783
"mersenne-twister": "^1.1.0",
7884
"moment": "2.21.0",
@@ -86,13 +92,14 @@
8692
"react-chartjs-2": "^2.7.6",
8793
"react-copy-to-clipboard": "^5.0.0",
8894
"react-dom": "^16.12.0",
89-
"react-flickity-component": "^3.1.0",
95+
"react-flickity-component": "^3.6.1",
9096
"react-headroom": "2.2.2",
9197
"react-helmet": "^5.2.1",
9298
"react-highlight": "0xproject/react-highlight#react-peer-deps",
9399
"react-instantsearch-dom": "^5.7.0",
94100
"react-markdown": "^4.0.6",
95101
"react-popper": "^1.0.0-beta.6",
102+
"react-query": "^3.7.1",
96103
"react-redux": "^7.1.3",
97104
"react-responsive": "^6.0.1",
98105
"react-router-dom": "^5.1.2",
@@ -125,6 +132,7 @@
125132
"@babel/preset-env": "^7.5.5",
126133
"@babel/preset-react": "^7.0.0",
127134
"@mdx-js/loader": "^1.3.1",
135+
"@types/marked": "^1.2.2",
128136
"@mdx-js/react": "^1.3.1",
129137
"@types/accounting": "^0.4.1",
130138
"@types/algoliasearch": "^3.30.12",

public/images/governance/cross.svg

Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 14 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

ts/components/button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Button.defaultProps = {
8282
const ButtonBase = styled.button<ButtonInterface>`
8383
appearance: none;
8484
border: 1px solid transparent;
85-
display: inline-block;
85+
display: ${(props) => (props.isInline ? 'inline' : 'inline-block')};
8686
background-color: ${(props) => props.bgColor || colors.brandLight};
8787
background-color: ${(props) =>
8888
(props.isTransparent || props.isWithArrow) && (props.transparentBgColor || 'transparent')};
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import { BigNumber } from '@0x/utils';
2+
import { Web3Wrapper } from '@0x/web3-wrapper';
3+
import React from 'react';
4+
import { useSelector } from 'react-redux';
5+
import MediaQuery from 'react-responsive';
6+
import styled from 'styled-components';
7+
8+
import { Button } from 'ts/components/button';
9+
import { Text } from 'ts/components/ui/text';
10+
import { State } from 'ts/redux/reducer';
11+
import { colors } from 'ts/style/colors';
12+
import { AccountReady, WebsitePaths } from 'ts/types';
13+
import { constants } from 'ts/utils/constants';
14+
import { formatZrx } from 'ts/utils/format_number';
15+
16+
export const RegisterBanner: React.FC<{}> = () => {
17+
const [userZRXBalance, setZRXBalance] = React.useState<number>();
18+
19+
const providerState = useSelector((state: State) => state.providerState);
20+
React.useEffect(() => {
21+
if (providerState) {
22+
const { zrxBalanceBaseUnitAmount } = providerState.account as AccountReady;
23+
let zrxBalance: BigNumber | undefined;
24+
if (zrxBalanceBaseUnitAmount) {
25+
zrxBalance = Web3Wrapper.toUnitAmount(zrxBalanceBaseUnitAmount, constants.DECIMAL_PLACES_ZRX);
26+
}
27+
28+
if (zrxBalance) {
29+
const roundedZrxBalance = formatZrx(zrxBalance).roundedValue;
30+
setZRXBalance(roundedZrxBalance);
31+
}
32+
}
33+
}, [providerState]);
34+
35+
if (userZRXBalance && userZRXBalance > 0) {
36+
return (
37+
<Container>
38+
<BannerImage src="/images/governance/register_banner.svg" />
39+
<MediaQuery minWidth={768}>
40+
<TextContent>
41+
<Text
42+
noWrap={true}
43+
fontColor={colors.textDarkPrimary}
44+
Tag="h1"
45+
fontSize="28px"
46+
fontFamily="Formular"
47+
>
48+
Register to vote with your ZRX!
49+
</Text>
50+
<Text
51+
noWrap={true}
52+
fontColor={colors.textDarkSecondary}
53+
fontSize="22px"
54+
fontFamily="Formular"
55+
fontWeight={300}
56+
>
57+
Register to vote on upcoming treasury proposals
58+
</Text>
59+
</TextContent>
60+
</MediaQuery>
61+
<MediaQuery maxWidth={768}>
62+
<TextContent>
63+
<Text noWrap={true} fontColor={colors.textDarkPrimary} Tag="h1" fontSize="22px">
64+
Register to vote with your ZRX!
65+
</Text>
66+
<Text noWrap={true} fontColor={colors.textDarkSecondary} fontSize="14px">
67+
Register to vote on upcoming treasury proposals
68+
</Text>
69+
</TextContent>
70+
</MediaQuery>
71+
<Button to={WebsitePaths.Register} color={colors.white}>
72+
Register your ZRX
73+
</Button>
74+
</Container>
75+
);
76+
}
77+
return null;
78+
};
79+
80+
const Container = styled.div`
81+
background-color: ${({ theme }) => theme.lightBgColor};
82+
display: flex;
83+
flex-direction: column;
84+
align-items: center;
85+
width: 100%;
86+
padding-bottom: 20px;
87+
max-width: 1500px;
88+
89+
@media (min-width: 768px) {
90+
height: 120px;
91+
flex-direction: row;
92+
padding-right: 50px;
93+
padding-bottom: 0px;
94+
width: auto;
95+
margin: auto;
96+
}
97+
`;
98+
99+
const BannerImage = styled.img`
100+
height: 100%;
101+
`;
102+
103+
const TextContent = styled.div`
104+
display: flex;
105+
flex-direction: column;
106+
height: 100%;
107+
flex: 1;
108+
justify-content: center;
109+
white-space: normal;
110+
text-align: center;
111+
margin: 20px 0;
112+
113+
@media (min-width: 768px) {
114+
margin: 0;
115+
padding: 0 50px;
116+
white-space: nowrap;
117+
text-align: left;
118+
}
119+
`;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import marked, { Token, Tokens } from 'marked';
2+
import React from 'react';
3+
4+
import { Heading, Paragraph } from 'ts/components/text';
5+
6+
export const TreasurySummary: React.FC<{ description: string }> = ({ description }) => {
7+
const tokens = marked.lexer(description);
8+
const heading = tokens.find(
9+
(token: Token) => (token as Tokens.Heading).type === 'heading' && (token as Tokens.Heading).depth === 1,
10+
);
11+
const paragraph = tokens.find((token: Token) => (token as Tokens.Paragraph).type === 'paragraph');
12+
let summary = '';
13+
// @ts-ignore
14+
paragraph.tokens.forEach((token) => {
15+
summary += token.text;
16+
});
17+
18+
return (
19+
<>
20+
<Heading marginBottom="15px">{(heading as Tokens.Heading).text}</Heading>
21+
<Paragraph marginBottom="20px">{summary}</Paragraph>
22+
</>
23+
);
24+
};

0 commit comments

Comments
 (0)