diff --git a/frontend/src/components/BookPage.js b/frontend/src/components/BookPage.js
index eac6186f..4331abbe 100644
--- a/frontend/src/components/BookPage.js
+++ b/frontend/src/components/BookPage.js
@@ -49,7 +49,7 @@ class BookPage extends Component {
handleCurrencyChange=(e)=>{
var currency = e.target.value;
this.props.setAppState({
- bookCurrency: currency,
+ currency: currency,
bookCurrencyCode: this.getCurrencyCode(currency),
})
}
@@ -85,8 +85,8 @@ class BookPage extends Component {
order.type == this.props.bookType || this.props.bookType == 2)
- .filter(order => order.currency == this.props.bookCurrency || this.props.bookCurrency == 0)
+ this.props.bookOrders.filter(order => order.type == this.props.type || this.props.type == 2)
+ .filter(order => order.currency == this.props.currency || this.props.currency == 0)
.map((order) =>
({id: order.id,
avatar: window.location.origin +'/static/assets/avatars/' + order.maker_nick + '.png',
@@ -186,8 +186,8 @@ class BookPage extends Component {
order.type == this.props.bookType || this.props.bookType == 2)
- .filter(order => order.currency == this.props.bookCurrency || this.props.bookCurrency == 0)
+ this.props.bookOrders.filter(order => order.type == this.props.type || this.props.type == 2)
+ .filter(order => order.currency == this.props.currency || this.props.currency == 0)
.map((order) =>
({id: order.id,
avatar: window.location.origin +'/static/assets/avatars/' + order.maker_nick + '.png',
@@ -294,7 +294,7 @@ class BookPage extends Component {
} else if (sellChecked) {
var type = 0
}
- this.props.setAppState({bookType: type})
+ this.props.setAppState({type: type})
}
handleClickBuy=(e)=>{
@@ -316,7 +316,7 @@ class BookPage extends Component {
- {this.props.bookType == 0 ?
+ {this.props.type == 0 ?
t("No orders found to sell BTC for {{currencyCode}}",{currencyCode:this.props.bookCurrencyCode})
:
t("No orders found to buy BTC for {{currencyCode}}",{currencyCode:this.props.bookCurrencyCode})
@@ -328,7 +328,7 @@ class BookPage extends Component {
- {t("Be the first one to create an order")}
+ {t("Be the first one to create an order")}
@@ -389,14 +389,14 @@ class BookPage extends Component {
- {this.props.bookType == 0 ? t("and receive") : (this.props.bookType == 1 ? t("and pay with") : t("and use") )}
+ {this.props.type == 0 ? t("and receive") : (this.props.type == 1 ? t("and pay with") : t("and use") )}
);
diff --git a/frontend/src/components/HomePage.js b/frontend/src/components/HomePage.js
index 2f986718..c83301e8 100644
--- a/frontend/src/components/HomePage.js
+++ b/frontend/src/components/HomePage.js
@@ -17,8 +17,8 @@ export default class HomePage extends Component {
avatarLoaded: false,
buyChecked: false,
sellChecked: false,
- bookType:2,
- bookCurrency:0,
+ type:2,
+ currency:0,
bookCurrencyCode:'ANY',
bookOrders:new Array(),
bookLoading: true,
diff --git a/frontend/src/components/MakerPage.js b/frontend/src/components/MakerPage.js
index bb9456fb..fafdda4f 100644
--- a/frontend/src/components/MakerPage.js
+++ b/frontend/src/components/MakerPage.js
@@ -66,8 +66,13 @@ class MakerPage extends Component {
}
componentDidMount() {
- this.getLimits()
- }
+ this.getLimits()
+ // if currency or type have changed in HomePage state, change in MakerPage state too.
+ this.setState({
+ currency: !this.props.currency === 0 ? this.props.currency : this.state.currency,
+ type: !this.props.type === 2 ? this.props.type : this.state.type,
+ })
+ }
getLimits() {
this.setState({loadingLimits:true})
@@ -94,13 +99,26 @@ class MakerPage extends Component {
handleTypeChange=(e)=>{
this.setState({
type: e.target.value,
- });
+ })
+ // Share state with HomePage and OrderPage
+ this.props.setAppState({
+ type: e.target.value,
+ buyChecked: e.target.value == 0 ? true: false,
+ sellChecked: e.target.value == 1 ? true: false,
+ })
+ ;
}
handleCurrencyChange=(e)=>{
+ var currencyCode = this.getCurrencyCode(e.target.value)
this.setState({
currency: e.target.value,
- currencyCode: this.getCurrencyCode(e.target.value),
+ currencyCode: currencyCode,
});
+ this.props.setAppState({
+ type: e.target.value,
+ currency: e.target.value,
+ bookCurrencyCode: currencyCode,
+ })
if(this.state.enableAmountRange){
this.setState({
minAmount: parseFloat(Number(this.state.limits[e.target.value]['max_amount']*0.25).toPrecision(2)),
@@ -231,7 +249,7 @@ class MakerPage extends Component {
has_range: this.state.enableAmountRange,
min_amount: this.state.minAmount,
max_amount: this.state.maxAmount,
- payment_method: this.state.payment_method,
+ payment_method: this.state.payment_method === ""? this.defaultPaymentMethod: this.state.payment_method,
is_explicit: this.state.is_explicit,
premium: this.state.is_explicit ? null: this.state.premium,
satoshis: this.state.is_explicit ? this.state.satoshis: null,
@@ -384,7 +402,7 @@ class MakerPage extends Component {
- {t("From")}
+ {t("From")}
- {t("to")}
+ {t("to")}
- {this.state.currencyCode}
+ {this.state.currencyCode}
)