diff --git a/frontend/src/components/Charts/DepthChart/index.tsx b/frontend/src/components/Charts/DepthChart/index.tsx
index e8ab70ef..172dbaf5 100644
--- a/frontend/src/components/Charts/DepthChart/index.tsx
+++ b/frontend/src/components/Charts/DepthChart/index.tsx
@@ -21,8 +21,7 @@ import {
import { AddCircleOutline, RemoveCircleOutline } from '@mui/icons-material';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
-import { Order } from '../../../models/Order.model';
-import { LimitList } from '../../../models/Limit.model';
+import { Order, LimitList } from '../../../models';
import RobotAvatar from '../../Robots/RobotAvatar';
import { amountToString } from '../../../utils/prettyNumbers';
import currencyDict from '../../../../static/assets/currencies.json';
diff --git a/frontend/src/components/FlagWithProps/FlagWithProps.tsx b/frontend/src/components/FlagWithProps/FlagWithProps.tsx
index 501e8009..517f73f1 100644
--- a/frontend/src/components/FlagWithProps/FlagWithProps.tsx
+++ b/frontend/src/components/FlagWithProps/FlagWithProps.tsx
@@ -91,7 +91,7 @@ const FlagWithProps = ({ code }: Props): JSX.Element => {
if (code === 'XAU') flag =
;
if (code === 'BTC') flag =
;
- return
{flag}
;
+ return
{flag}
;
};
export default FlagWithProps;
diff --git a/frontend/src/components/HomePage.js b/frontend/src/components/HomePage.js
index c1e6d40e..ff23a840 100644
--- a/frontend/src/components/HomePage.js
+++ b/frontend/src/components/HomePage.js
@@ -7,6 +7,8 @@ import BookPage from './BookPage';
import OrderPage from './OrderPage';
import BottomBar from './BottomBar';
+import { apiClient } from '../services/api';
+
export default class HomePage extends Component {
constructor(props) {
super(props);
@@ -20,7 +22,7 @@ export default class HomePage extends Component {
type: null,
currency: 0,
bookCurrencyCode: 'ANY',
- bookOrders: new Array(),
+ orders: new Array(),
bookLoading: true,
bookRefreshing: false,
activeOrderId: null,
@@ -29,14 +31,21 @@ export default class HomePage extends Component {
referralCode: '',
lastDayPremium: 0,
limits: {},
+ loadingLimits: true,
+ maker: {},
};
}
componentDidMount = () => {
if (typeof window !== undefined) {
- this.setState({ windowWidth: window.innerWidth, windowHeight: window.innerHeight });
+ this.setState({
+ windowWidth: window.innerWidth / this.props.theme.typography.fontSize,
+ windowHeight: window.innerHeight / this.props.theme.typography.fontSize,
+ });
window.addEventListener('resize', this.onResize);
}
+ this.fetchBook(true, false);
+ this.fetchLimits(true);
};
componentWillUnmount = () => {
@@ -46,7 +55,10 @@ export default class HomePage extends Component {
};
onResize = () => {
- this.setState({ windowWidth: window.innerWidth, windowHeight: window.innerHeight });
+ this.setState({
+ windowWidth: window.innerWidth / this.props.theme.typography.fontSize,
+ windowHeight: window.innerHeight / this.props.theme.typography.fontSize,
+ });
};
setAppState = (newState) => {
@@ -62,10 +74,29 @@ export default class HomePage extends Component {
// Only for Android
return window.location.pathname;
}
-
return '';
}
+ fetchBook = (loading, refreshing) => {
+ this.setState({ bookLoading: loading, bookRefreshing: refreshing });
+ apiClient.get('/api/book/').then((data) =>
+ this.setState({
+ bookLoading: false,
+ bookRefreshing: false,
+ orders: data.not_found ? [] : data,
+ }),
+ );
+ };
+
+ fetchLimits = (loading) => {
+ this.setState({ loadingLimits: loading });
+ const limits = apiClient.get('/api/limits/').then((data) => {
+ this.setState({ limits: data, loadingLimits: false });
+ return data;
+ });
+ return limits;
+ };
+
render() {
const fontSize = this.props.theme.typography.fontSize;
const fontSizeFactor = fontSize / 14; // default fontSize is 14
@@ -105,6 +136,7 @@ export default class HomePage extends Component {
{...props}
{...this.state}
{...this.props}
+ fetchLimits={this.fetchLimits}
setAppState={this.setAppState}
/>
)}
@@ -116,6 +148,8 @@ export default class HomePage extends Component {
{...props}
{...this.state}
{...this.props}
+ fetchBook={this.fetchBook}
+ fetchLimits={this.fetchLimits}
setAppState={this.setAppState}
/>
)}
@@ -135,7 +169,10 @@ export default class HomePage extends Component {