diff --git a/frontend/src/components/BookPage.js b/frontend/src/components/BookPage.js
index 055b114a..93cb63d8 100644
--- a/frontend/src/components/BookPage.js
+++ b/frontend/src/components/BookPage.js
@@ -1,5 +1,5 @@
import React, { Component } from "react";
-import { Paper, Button , Divider, Card, CardActionArea, CardContent, Typography, Grid, Select, MenuItem, FormControl, FormHelperText, List, ListItem, ListItemText, Avatar, Link, RouterLink, ListItemAvatar} from "@material-ui/core"
+import { Button , Divider, Card, CardActionArea, CardContent, Typography, Grid, Select, MenuItem, FormControl, FormHelperText, List, ListItem, ListItemText, Avatar, Link, RouterLink, ListItemAvatar} from "@material-ui/core"
export default class BookPage extends Component {
constructor(props) {
@@ -19,7 +19,10 @@ export default class BookPage extends Component {
fetch('/api/book' + '?currency=' + this.state.currency + "&type=" + this.state.type)
.then((response) => response.json())
.then((data) => //console.log(data));
- this.setState({orders: data}));
+ this.setState({
+ orders: data,
+ not_found: data.not_found,
+ }));
}
handleCardClick=(e)=>{
@@ -53,6 +56,63 @@ export default class BookPage extends Component {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
+ bookCards=()=>{
+ return (this.state.orders.map((order) =>
+
+
+
+ this.handleCardClick(order.id)}>
+
+
+
+
+
+
+
+
+
+ {order.maker_nick}
+
+
+
+
+ {/* CARD PARAGRAPH CONTENT */}
+
+
+ ◑{order.type == 0 ? Buys : Sells }
+ {parseFloat(parseFloat(order.amount).toFixed(4))}
+ {" " +this.getCurrencyCode(order.currency)} worth of bitcoin
+
+
+
+ ◑ Payment via {order.payment_method}
+
+
+
+ ◑ Priced {order.is_explicit ?
+ " explicitly at " + this.pn(order.satoshis) + " Sats" : (
+ " at " +
+ parseFloat(parseFloat(order.premium).toFixed(4)) + "% over the market"
+ )}
+
+
+
+ ◑ {" 42,354 "}{this.getCurrencyCode(order.currency)}/BTC (Binance API)
+
+
+
+
+
+
+
+
+
+ ));
+ }
+
render() {
return (
@@ -102,66 +162,30 @@ export default class BookPage extends Component {
- {this.state.orders.map((order) =>
-
-
-
- {/* To fix! does not pass order.id to handleCardCLick. Instead passes the clicked >*/}
- this.handleCardClick(order.id)}>
-
-
-
-
-
-
-
-
-
- {order.maker_nick}
-
-
-
-
- {/* CARD PARAGRAPH CONTENT */}
-
-
- ◑{order.type == 0 ? Buys : Sells }
- {parseFloat(parseFloat(order.amount).toFixed(4))}
- {" " +this.getCurrencyCode(order.currency)} worth of bitcoin
-
-
-
- ◑ Payment via {order.payment_method}
-
-
-
- ◑ Priced {order.is_explicit ?
- " explicitly at " + this.pn(order.satoshis) + " Sats" : (
- " at " +
- parseFloat(parseFloat(order.premium).toFixed(4)) + "% over the market"
- )}
-
-
-
- ◑ {" 42,354 "}{this.getCurrencyCode(order.currency)}/BTC (Binance API)
-
-
-
-
-
-
-
-
-
- )}
+ { this.state.not_found ? "" :
You are {this.state.type == 0 ? " selling " : " buying "} BTC for {this.state.currencyCode}
+ }
+
+ { this.state.not_found ?
+ (
+
+
+ No orders found to {this.state.type == 0 ? ' sell ' :' buy ' } BTC for {this.state.currencyCode}
+
+
+ Be the first one to create an order
+
+
+
+
+
+ )
+ : this.bookCards()
+ }