-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Danylo Prudnikov
committed
Sep 15, 2022
1 parent
a7e7821
commit 78c5f5f
Showing
29 changed files
with
1,792 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +0,0 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
scroll-behavior: smooth; | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { configureStore } from "@reduxjs/toolkit"; | ||
import { cryptoApi } from "../services/cryptoApi"; | ||
import { cryptoNewsApi } from "../services/cryptoNewsApi"; | ||
|
||
export default configureStore({ | ||
reducer: { | ||
[cryptoApi.reducerPath]: cryptoApi.reducer, | ||
[cryptoNewsApi.reducerPath]: cryptoNewsApi.reducer, | ||
}, | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import React from "react"; | ||
import { Line } from "react-chartjs-2"; | ||
import { Col, Row, Typography } from "antd"; | ||
import { | ||
Chart, | ||
LineController, | ||
LineElement, | ||
PointElement, | ||
LinearScale, | ||
CategoryScale, | ||
} from "chart.js"; | ||
|
||
const { Title } = Typography; | ||
|
||
const LineChart = ({ coinHistory, currentPrice, coinName }) => { | ||
Chart.register( | ||
LineController, | ||
LineElement, | ||
PointElement, | ||
LinearScale, | ||
CategoryScale | ||
); | ||
const coinPrice = []; | ||
const coinTimestamp = []; | ||
|
||
for (let i = 0; i < coinHistory?.data?.history?.length; i += 1) { | ||
coinPrice.push(coinHistory?.data?.history[i].price); | ||
} | ||
|
||
for (let i = 0; i < coinHistory?.data?.history?.length; i += 1) { | ||
coinTimestamp.push( | ||
//Incorrect time data in API | ||
// new Date( | ||
// coinHistory?.data?.history[i].timestamp | ||
// ).toLocaleDateString() | ||
new Date().toLocaleDateString() | ||
); | ||
} | ||
|
||
const data = { | ||
labels: coinTimestamp, | ||
datasets: [ | ||
{ | ||
label: "Price In USD", | ||
data: coinPrice, | ||
fill: false, | ||
backgroundColor: "#0071bd", | ||
borderColor: "#0071bd", | ||
}, | ||
], | ||
}; | ||
|
||
const options = { | ||
scales: { | ||
y: [ | ||
{ | ||
ticks: { | ||
beginAtZero: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
return ( | ||
<> | ||
<Row className="chart-header"> | ||
<Title level={2} className="chart-title"> | ||
{coinName} Price Chart{" "} | ||
</Title> | ||
<Col className="price-container"> | ||
<Title level={5} className="price-change"> | ||
Change: {coinHistory?.data?.change}% | ||
</Title> | ||
<Title level={5} className="current-price"> | ||
Current {coinName} Price: $ {currentPrice} | ||
</Title> | ||
</Col> | ||
</Row> | ||
<Line data={data} options={options} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default LineChart; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.