-
Notifications
You must be signed in to change notification settings - Fork 250
/
Copy pathFarms.tsx
58 lines (51 loc) · 1.29 KB
/
Farms.tsx
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
import React from 'react'
import {
Route,
Switch,
useRouteMatch,
} from 'react-router-dom'
import { useWallet } from 'use-wallet'
import farmer from '../../assets/img/farmer.png'
import Button from '../../components/Button'
import Page from '../../components/Page'
import PageHeader from '../../components/PageHeader'
import Farm from '../Farm'
import FarmCards from './components/FarmCards'
const Farms: React.FC = () => {
const { path } = useRouteMatch()
const { account, connect } = useWallet()
return (
<Switch>
<Page>
{!!account ? (
<>
<Route exact path={path}>
<PageHeader
icon={<img src={farmer} height="96" />}
subtitle="Earn YAM tokens by providing liquidity."
title="Select a farm."
/>
<FarmCards />
</Route>
<Route path={`${path}/:farmId`}>
<Farm />
</Route>
</>
) : (
<div style={{
alignItems: 'center',
display: 'flex',
flex: 1,
justifyContent: 'center',
}}>
<Button
onClick={() => connect('injected')}
text="Unlock Wallet"
/>
</div>
)}
</Page>
</Switch>
)
}
export default Farms