-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPriceChart.js
More file actions
60 lines (43 loc) · 1.52 KB
/
Copy pathPriceChart.js
File metadata and controls
60 lines (43 loc) · 1.52 KB
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
import { useSelector } from 'react-redux';
import Chart from 'react-apexcharts';
import arrowDown from '../assets/down-arrow.svg';
import arrowUp from '../assets/up-arrow.svg'
import { options, defaultSeries } from './PriceChart.config';
import { priceChartSelector } from '../store/selectors';
import Banner from './Banner';
const PriceChart = () => {
const account = useSelector(state => state.provider.account)
const symbols = useSelector(state => state.tokens.symbols)
const priceChart = useSelector(priceChartSelector)
return (
<div className="component exchange__chart">
<div className='component__header flex-between'>
<div className='flex'>
<h2>{symbols && `${symbols[0]}/${symbols[1]}`}</h2>
{priceChart && (
<div className='flex'>
{priceChart.lastPriceChange === '+' ? (
<img src={arrowUp} alt="Arrow up" />
) : (
<img src={arrowDown} alt="Arrow down" />
)}
<span className='up'>{priceChart.lastPrice}</span>
</div>
)}
</div>
</div>
{!account ? (
<Banner text={'Please connect with Metamask...'}/>
) : (
<Chart
type="candlestick"
options={options}
series={priceChart ? priceChart.series : defaultSeries }
width="100%"
height="100%"
/>
)}
</div>
);
}
export default PriceChart;