From 344ba2ab67d8ff6606a9a4de96bc3815900aa95f Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Wed, 28 Sep 2022 06:49:07 -0700 Subject: [PATCH] Add book double view for large displays. Prettify. --- frontend/src/components/BookPage.js | 146 +++++++++++++----- frontend/src/components/BottomBar.js | 10 +- frontend/src/components/HomePage.js | 8 +- .../components/Robots/RobotAvatar/index.tsx | 6 +- frontend/src/components/UserGenPage.js | 28 ++-- frontend/src/components/i18n.Native.js | 49 +++--- frontend/src/components/i18n.js | 9 +- frontend/src/services/Native/index.d.ts | 26 ++-- frontend/src/services/Native/index.ts | 54 ++++--- .../src/services/api/ApiNativeClient/index.ts | 28 ++-- .../src/services/api/ApiWebClient/index.ts | 4 +- frontend/src/services/api/index.ts | 4 +- frontend/static/css/index.css | 2 +- frontend/webpack.config.ts | 8 +- 14 files changed, 221 insertions(+), 161 deletions(-) diff --git a/frontend/src/components/BookPage.js b/frontend/src/components/BookPage.js index a4621ec12..a2886dd2b 100644 --- a/frontend/src/components/BookPage.js +++ b/frontend/src/components/BookPage.js @@ -107,43 +107,90 @@ class BookPage extends Component { ); }; - mainView = () => { + mainView = (doubleView, widthEm, heightEm) => { if (this.props.bookNotFound) { return this.NoOrdersFound(); } - if (this.state.view === 'depth') { + if (doubleView) { + const width = widthEm * 0.9; + const bookTableWidth = 85; + const chartWidthEm = width - bookTableWidth; + const tableWidthXS = (bookTableWidth / width) * 12; + const chartWidthXS = (chartWidthEm / width) * 12; + console.log(bookTableWidth, chartWidthEm, tableWidthXS, chartWidthXS); return ( - + + + + + + + + ); } else { - return ( - - ); + if (this.state.view === 'depth') { + return ( + + ); + } else { + return ( + + ); + } } }; - getTitle = () => { + getTitle = (doubleView) => { const { t } = this.props; - if (this.state.view == 'list') { + if (this.state.view == 'list' || doubleView) { if (this.props.type == 0) { return t('You are SELLING BTC for {{currencyCode}}', { currencyCode: this.props.bookCurrencyCode, @@ -160,10 +207,10 @@ class BookPage extends Component { } }; - render() { + mainFilters = () => { const { t } = this.props; return ( - + <> this.setState({ loading: true }) & this.getOrderDetails()} @@ -235,13 +282,26 @@ class BookPage extends Component { + + ); + }; + + render() { + const { t } = this.props; + const widthEm = this.props.windowWidth / this.props.theme.typography.fontSize; + const heightEm = this.props.windowHeight / this.props.theme.typography.fontSize; + const doubleView = widthEm > 115; + + return ( + + {this.mainFilters()} - {this.getTitle()} + {this.getTitle(doubleView)} - {this.mainView()} + {this.mainView(doubleView, widthEm, heightEm)} @@ -250,17 +310,23 @@ class BookPage extends Component { - + {doubleView ? null : ( + + )} ) : null}