aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/dropdowns/developers_drop_down.tsx
blob: 1db1e89b87aabb1d3e9b65796544f71105ddd4f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import { ALink, colors, Link } from '@0xproject/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
import { Container } from 'ts/components/ui/container';
import { DropDown } from 'ts/components/ui/drop_down';
import { Text } from 'ts/components/ui/text';
import { Deco, Key, WebsitePaths } from 'ts/types';
import { constants } from 'ts/utils/constants';
import { Translate } from 'ts/utils/translate';

const gettingStartedKeyToLinkInfo1: ALink[] = [
    {
        title: Key.BuildARelayer,
        to: `${WebsitePaths.Wiki}#Build-A-Relayer`,
    },
    {
        title: Key.OrderBasics,
        to: `${WebsitePaths.Wiki}#Create,-Validate,-Fill-Order`,
    },
];
const gettingStartedKeyToLinkInfo2: ALink[] = [
    {
        title: Key.DevelopOnEthereum,
        to: `${WebsitePaths.Wiki}#Ethereum-Development`,
    },
    {
        title: Key.UseSharedLiquidity,
        to: `${WebsitePaths.Wiki}#Find,-Submit,-Fill-Order-From-Relayer`,
    },
];
const popularDocsToLinkInfos: ALink[] = [
    {
        title: Key.ZeroExJs,
        to: WebsitePaths.ZeroExJs,
    },
    {
        title: Key.Connect,
        to: WebsitePaths.Connect,
    },
    {
        title: Key.SmartContract,
        to: WebsitePaths.SmartContracts,
    },
];
const usefulLinksToLinkInfo: ALink[] = [
    {
        title: Key.Wiki,
        to: WebsitePaths.Wiki,
    },
    {
        title: Key.Github,
        to: constants.URL_GITHUB_ORG,
        shouldOpenInNewTab: true,
    },
    {
        title: Key.Whitepaper,
        to: WebsitePaths.Whitepaper,
        shouldOpenInNewTab: true,
    },
];

interface DevelopersDropDownProps {
    location: Location;
    translate: Translate;
    menuItemStyles: React.CSSProperties;
    menuIconStyle: React.CSSProperties;
}

interface DevelopersDropDownState {}

export class DevelopersDropDown extends React.Component<DevelopersDropDownProps, DevelopersDropDownState> {
    public render(): React.ReactNode {
        const activeNode = (
            <Container className="flex relative" paddingRight="10">
                <Text fontColor={this.props.menuIconStyle.color}>
                    {this.props.translate.get(Key.Developers, Deco.Cap)}
                </Text>
            </Container>
        );
        return (
            <DropDown
                activeNode={activeNode}
                popoverContent={this._renderDropdownMenu()}
                anchorOrigin={{ horizontal: 'left', vertical: 'bottom' }}
                targetOrigin={{ horizontal: 'left', vertical: 'top' }}
                style={this.props.menuItemStyles}
                popoverStyle={{ borderRadius: 4, width: 397, height: 373, marginTop: 0 }}
            />
        );
    }
    private _renderDropdownMenu(): React.ReactNode {
        const dropdownMenu = (
            <Container>
                <Container padding="1.75rem">
                    {this._renderTitle('Getting started')}
                    <Container className="flex">
                        <Container className="pr4 mr2">
                            {this._renderLinkSection(gettingStartedKeyToLinkInfo1)}
                        </Container>
                        <Container>{this._renderLinkSection(gettingStartedKeyToLinkInfo2)}</Container>
                    </Container>
                </Container>
                <Container width="100%" height="1px" backgroundColor={colors.grey300} />
                <Container className="flex" padding="1.75rem">
                    <Container className="pr4 mr2">
                        <Container>{this._renderTitle('Popular docs')}</Container>
                        <Container>{this._renderLinkSection(popularDocsToLinkInfos)}</Container>
                    </Container>
                    <Container>
                        <Container>{this._renderTitle('Useful links')}</Container>
                        <Container>{this._renderLinkSection(usefulLinksToLinkInfo)}</Container>
                    </Container>
                </Container>
                <Link to={WebsitePaths.Docs} fontColor={colors.lightBlueA700}>
                    <Container
                        padding="0.9rem"
                        backgroundColor={colors.lightBgGrey}
                        borderBottomLeftRadius={4}
                        borderBottomRightRadius={4}
                    >
                        <Text fontColor={colors.lightBlueA700} fontWeight="bold" fontSize="14px" textAlign="center">
                            {this.props.translate.get(Key.ViewAllDocumentation, Deco.Upper)}
                        </Text>
                    </Container>
                </Link>
            </Container>
        );
        return dropdownMenu;
    }
    private _renderTitle(title: string): React.ReactNode {
        return (
            <Container paddingBottom="12px">
                <Text letterSpacing={1} fontColor={colors.linkSectionGrey} fontSize="14px" fontWeight={600}>
                    {title.toUpperCase()}
                </Text>
            </Container>
        );
    }
    private _renderLinkSection(links: ALink[]): React.ReactNode {
        const numLinks = links.length;
        let i = 0;
        const renderLinks = _.map(links, (link: ALink) => {
            const isWikiLink = _.startsWith(link.to, WebsitePaths.Wiki) && _.includes(link.to, '#');
            const isOnWiki = this.props.location.pathname === WebsitePaths.Wiki;
            let to = link.to;
            if (isWikiLink && isOnWiki) {
                to = `${link.to.split('#')[1]}`;
            }
            i++;
            const isLast = i === numLinks;
            const linkText = this.props.translate.get(link.title as Key, Deco.Cap);
            return (
                <Container className={`pr1 pt1 ${!isLast && 'pb1'}`} key={`dev-dropdown-link-${link.title}`}>
                    <Link to={to} shouldOpenInNewTab={!!link.shouldOpenInNewTab}>
                        <Text fontFamily="Roboto, Roboto Mono" fontColor={colors.lightBlueA700}>
                            {linkText}
                        </Text>
                    </Link>
                </Container>
            );
        });
        return <Container>{renderLinks}</Container>;
    }
}
estnet (#47)Wei-Ning Huang2019-06-122-3/+38 * core: various changes on tps tuning (#46)Wei-Ning Huang2019-06-121-2/+2 * governance: implement delegate/undelegate function and add tests (#33)Wei-Ning Huang2019-06-122-5/+5 * core: vm: add minStake to governance contract variable (#31)Wei-Ning Huang2019-06-122-1/+12 * core: validate DKG set with correct nodeset in round-2 (#19)Wei-Ning Huang2019-06-121-1/+1 * params: Do not use DEXON config for test. (#15)Jimmy Hu2019-06-121-1/+1 * test: increase numChains to 6Wei-Ning Huang2019-06-121-1/+1 * params: fix genesis block config and use testnet for test (#10)Wei-Ning Huang2019-06-121-4/+4 * app: fix core testBJ42019-06-121-4/+5 * core: vm: governance: remove maxIntervalWei-Ning Huang2019-06-122-11/+1 * dex: add block gas limit into governanceWei-Ning Huang2019-06-122-1/+11 * Remove reference of Rinkeby and Goerli network.Wei-Ning Huang2019-06-122-80/+0 * core: populate genesisAlloc in source code with DEXON genesis dataWei-Ning Huang2019-06-121-14/+39 * core: vm: add blockReward to governanceWei-Ning Huang2019-06-122-16/+16 * core: set governance owner in genesisWei-Ning Huang2019-06-122-13/+22 * params: load blockReward from genesis JSON fileWei-Ning Huang2019-06-122-0/+110 * core: vm: implement RAND opcode supportWei-Ning Huang2019-06-121-0/+1 * params: update seed node ipWei-Ning Huang2019-06-121-2/+2 * dex/core: misc bug fixesWei-Ning Huang2019-06-121-1/+2 * dex: run consensus core on StartWei-Ning Huang2019-06-121-2/+2 * app: add default block rewardBojie Wu2019-06-121-3/+4 * params: update bootnode infoWei-Ning Huang2019-06-121-10/+2 * app: calculate block reward according to chain numBojie Wu2019-06-121-11/+12 * dex: network: implement the network interfaceSonic2019-06-121-1/+1 * core: populate genesis CRS in genesis stateWei-Ning Huang2019-06-121-1/+3 * core: populate dexon configuration in SetupGenesisBlockWei-Ning Huang2019-06-121-4/+24 * Change import go github.com/dexon-foundation/dexonWei-Ning Huang2019-06-122-2/+2 * Update testchain config and add test bootnode keyWei-Ning Huang2019-06-122-10/+7 * Add initial DEXON consensus engine implementation skeletonWei-Ning Huang2019-06-121-3/+14 * params, swarm: release Geth v1.8.27 (noop Swarm v0.3.15)Péter Szilágyi2019-04-171-1/+1 * eth, les, light: enforce CHT checkpoints on fast-sync tooPéter Szilágyi2019-04-171-0/+9 * params, swarm: release Geth v1.8.26 (+noop Swarm v0.3.14)Péter Szilágyi2019-04-101-1/+1 * params, swarm: hotfix Geth v1.8.25 release to restore rpc flagsPéter Szilágyi2019-04-091-1/+1 * params, swarm: release Geth v1.8.24 (noop Swarm 0.3.12)Péter Szilágyi2019-04-081-1/+1