Store orders in app state. Fix typos.

This commit is contained in:
Reckless_Satoshi 2022-05-02 09:32:15 -07:00
parent 0d4922a6e2
commit 416aab46d0
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
11 changed files with 36 additions and 29 deletions

View File

@ -23,21 +23,23 @@ class BookPage extends Component {
constructor(props) {
super(props);
this.state = {
orders: new Array({id:0,}),
loading: true,
pageSize: 6,
};
this.getOrderDetails(2, 0)
if(this.props.orders.length == 0){
this.getOrderDetails(2, 0)
}
}
getOrderDetails(type, currency) {
this.props.setAppState({bookLoading: true});
fetch('/api/book' + '?currency=' + currency + "&type=" + type)
.then((response) => response.json())
.then((data) => this.setState({
orders: data,
not_found: data.not_found,
loading: false,
}));
.then((data) => (this.props.setAppState({
bookNotFound: data.not_found,
bookLoading: false,
bookOrders: data,
})));
}
handleRowClick=(e)=>{
@ -83,7 +85,7 @@ class BookPage extends Component {
<div style={{ height: 422, width: '100%' }}>
<DataGrid
rows={
this.state.orders.filter(order => order.type == this.props.type || this.props.type == 2)
this.props.orders.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,
@ -101,7 +103,7 @@ class BookPage extends Component {
premium: order.premium,
})
)}
loading={this.state.loading}
loading={this.props.loading}
columns={[
// { field: 'id', headerName: 'ID', width: 40 },
{ field: 'robot', headerName: t("Robot"), width: 240,
@ -164,7 +166,7 @@ class BookPage extends Component {
</Stack>
)
}}
pageSize={this.state.loading ? 0 : this.state.pageSize}
pageSize={this.props.loading ? 0 : this.state.pageSize}
rowsPerPageOptions={[6,20,50]}
onPageSizeChange={(newPageSize) => this.setState({pageSize:newPageSize})}
onRowClick={(params) => this.handleRowClick(params.row.id)} // Whole row is clickable, but the mouse only looks clickly in some places.
@ -178,9 +180,9 @@ class BookPage extends Component {
return (
<div style={{ height: 422, width: '100%' }}>
<DataGrid
loading={this.state.loading}
loading={this.props.loading}
rows={
this.state.orders.filter(order => order.type == this.props.type || this.props.type == 2)
this.props.orders.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,
@ -265,7 +267,7 @@ class BookPage extends Component {
</Stack>
)
}}
pageSize={this.state.loading ? 0 : this.state.pageSize}
pageSize={this.props.loading ? 0 : this.state.pageSize}
rowsPerPageOptions={[6,20,50]}
onPageSizeChange={(newPageSize) => this.setState({pageSize:newPageSize})}
onRowClick={(params) => this.handleRowClick(params.row.id)} // Whole row is clickable, but the mouse only looks clickly in some places.
@ -401,7 +403,7 @@ class BookPage extends Component {
</Select>
</FormControl>
</Grid>
{ this.state.not_found ? "" :
{ this.props.notFound ? "" :
<Grid item xs={12} align="center">
<Typography component="h5" variant="h5">
{this.props.type == 0 ?
@ -417,7 +419,7 @@ class BookPage extends Component {
</Grid>
}
{ this.state.not_found ?
{ this.props.notFound ?
<this.NoOrdersFound/>
:
<Grid item xs={12} align="center">

View File

@ -19,6 +19,8 @@ export default class HomePage extends Component {
bookType:2,
bookCurrency:0,
bookCurrencyCode:'ANY',
bookOrders:new Array(),
bookLoading: true,
}
}
@ -38,7 +40,7 @@ export default class HomePage extends Component {
<Route exact path='/' render={(props) => <UserGenPage {...props} {...this.state} setAppState={this.setAppState}/>}/>
<Route path='/ref/:refCode' render={(props) => <UserGenPage {...props} {...this.state} setAppState={this.setAppState}/>}/>
<Route path='/make' component={MakerPage}/>
<Route path='/book' render={(props) => <BookPage {...props} buyChecked={this.state.buyChecked} sellChecked={this.state.sellChecked} type={this.state.bookType} currencyCode={this.state.bookCurrencyCode} currency={this.state.bookCurrency} setAppState={this.setAppState} />}/>
<Route path='/book' render={(props) => <BookPage {...props} buyChecked={this.state.buyChecked} sellChecked={this.state.sellChecked} orders={this.state.bookOrders} loading={this.state.bookLoading} notFound={this.state.bookNotFound} type={this.state.bookType} currencyCode={this.state.bookCurrencyCode} currency={this.state.bookCurrency} setAppState={this.setAppState} />}/>
<Route path="/order/:orderId" component={OrderPage}/>
</Switch>
</div>

View File

@ -400,7 +400,7 @@ class TradeBox extends Component {
<Divider/>
<ListItem>
<Typography component="body2" variant="body2" align="left">
<p>{t("Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.", this.depositHoursMinutes() )} </p>
<p>{t("Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m to reply. If you do not reply, you risk losing your bond.", this.depositHoursMinutes() )} </p>
<p>{t("If the order expires untaken, your bond will return to you (no action needed).")}</p>
</Typography>
</ListItem>

View File

@ -15,7 +15,7 @@ export default function BuySatsIcon(props) {
138.476,194.816 143.92,199.672 146.813,202.254 152.256,207.109 155.712,210.195 157.527,211.816 163.973,207.854
161.154,205.34 "/>
<rect x="173.431" y="172.686" transform="matrix(0.7405 0.672 -0.672 0.7405 165.1439 -72.7109)" fill="#1976D2" width="6.611" height="9.654"/>
<rect x="173.431" y="172.686" transform="matrix(0.7405 0.672 -0.672 0.7405 165.1439 -72.7109)" fill={props.color} width="6.611" height="9.654"/>
<polygon fill={props.color} points="141.129,211.877 147.035,215.203 150.877,210.975 145.981,206.533 "/>
<polygon fill={props.color} points="186.961,57.038 189.855,59.621 195.298,64.477 198.756,67.562 204.199,72.418 205.449,73.534
210.271,68.126 209.643,67.562 204.199,62.705 200.742,59.621 195.298,54.764 192.402,52.182 186.963,47.326 184.453,45.086
@ -27,7 +27,7 @@ export default function BuySatsIcon(props) {
189.747,90.282 194.57,84.875 192.402,82.942 186.962,78.085 183.505,75 178.062,70.144 175.167,67.562 169.723,62.705
167.82,61.006 162.998,66.415 164.282,67.562 "/>
<rect x="199.243" y="45.425" transform="matrix(0.7403 0.6723 -0.6723 0.7403 86.3919 -123.1221)" fill="#1976D2" width="6.609" height="9.656"/>
<rect x="199.243" y="45.425" transform="matrix(0.7403 0.6723 -0.6723 0.7403 86.3919 -123.1221)" fill={props.color} width="6.609" height="9.656"/>
<polygon fill={props.color} points="165.298,86.425 170.193,90.867 176.684,83.72 171.789,79.28 "/>
<polygon fill={props.color} points="88.684,102.6 87.755,101.77 82.927,107.177 105.743,127.533 109.679,131.046 114.503,125.64
112.599,123.938 "/>
@ -36,7 +36,7 @@ export default function BuySatsIcon(props) {
<polygon fill={props.color} points="72.049,118.52 67.228,123.928 84.469,139.311 92.184,146.195 93.051,146.968 93.978,147.795
98.659,142.548 98.802,142.389 91.107,135.525 "/>
<rect x="103.471" y="102.94" transform="matrix(0.7405 0.6721 -0.6721 0.7405 100.1373 -43.7934)" fill="#1976D2" width="6.609" height="9.654"/>
<rect x="103.471" y="102.94" transform="matrix(0.7405 0.6721 -0.6721 0.7405 100.1373 -43.7934)" fill={props.color} width="6.609" height="9.654"/>
<polygon fill={props.color} points="69.529,143.938 72.38,146.525 74.422,148.381 80.622,141.554 80.914,141.234 76.019,136.792 "/>
<path fill={props.color} d="M187.466,112.718c7.511,0,14.995-1.878,21.647-5.43c10.848-5.793,18.796-15.48,22.379-27.277
c3.583-11.796,2.365-24.266-3.426-35.113c-8.033-15.037-23.645-24.379-40.742-24.379c-7.51,0-14.996,1.878-21.648,5.431

View File

@ -258,7 +258,7 @@
"Your maker bond was unlocked":"Deine Maker-Kaution wurde freigegeben",
"Your taker bond was unlocked":"Deine Taker-Kaution wurde freigegeben.",
"Your order is public":"Deine Order ist öffentlich",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.": "Sei geduldig, während die Roboter das Buch ansehen. Diese Box läutet 🔊, sobald ein Roboter deine Order annimmt, dann hast du {{deposit_timer_hours}} Stunden {{deposit_timer_minutes}} Minuten Zeit zu antworten. Wenn du nicht antwortest, riskierst du den Verlust deiner Kaution.",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m to reply. If you do not reply, you risk losing your bond.": "Sei geduldig, während die Roboter das Buch ansehen. Diese Box läutet 🔊, sobald ein Roboter deine Order annimmt, dann hast du {{deposit_timer_hours}} Stunden {{deposit_timer_minutes}} Minuten Zeit zu antworten. Wenn du nicht antwortest, riskierst du den Verlust deiner Kaution.",
"If the order expires untaken, your bond will return to you (no action needed).":"Wenn die Order nicht angenommen wird und abläuft, erhältst du die Kaution zurück (keine Aktion erforderlich).",
"Enable Telegram Notifications":"Telegram-Benachrichtigungen aktivieren",
"Enable TG Notifications":"Aktiviere TG-Benachrichtigungen",

View File

@ -265,7 +265,7 @@
"Your maker bond was unlocked":"Your maker bond was unlocked",
"Your taker bond was unlocked":"Your taker bond was unlocked",
"Your order is public":"Your order is public",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.":"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m to reply. If you do not reply, you risk losing your bond.":"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m to reply. If you do not reply, you risk losing your bond.",
"If the order expires untaken, your bond will return to you (no action needed).":"If the order expires untaken, your bond will return to you (no action needed).",
"Enable Telegram Notifications":"Enable Telegram Notifications",
"Enable TG Notifications":"Enable TG Notifications",
@ -337,7 +337,10 @@
"Invoice not submitted":"Invoice not submitted",
"Neither escrow locked or invoice submitted":"Neither escrow locked or invoice submitted",
"Renew Order":"Renew Order",
"Pause the public order":"Pause the public order",
"Your order is paused":"Your order is paused",
"Your public order has been paused. At the moment it cannot be seen or taken by other robots. You can choose to unpause it at any time.":"Your public order has been paused. At the moment it cannot be seen or taken by other robots. You can choose to unpause it at any time.",
"Unpause Order":"Unpause Order",
"INFO DIALOG - InfoDiagog.js":"App information and clarifications and terms of use",
"Close":"Close",

View File

@ -268,7 +268,7 @@
"Your maker bond was unlocked": "Tu fianza se ha desbloqueado",
"Your taker bond was unlocked": "Tu fianza se ha desbloqueado",
"Your order is public": "Tu orden es pública",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.": "Se paciente hasta que un robot tome tu orden. Esta ventana sonará 🔊 una vez que algún Robot tome tu orden. Entonces tendrás {{deposit_timer_hours}}h {{deposit_timer_minutes}}min para responder, si no respondes arriesgas perder tu fianza.",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m to reply. If you do not reply, you risk losing your bond.": "Se paciente hasta que un robot tome tu orden. Esta ventana sonará 🔊 una vez que algún Robot tome tu orden. Entonces tendrás {{deposit_timer_hours}}h {{deposit_timer_minutes}}min para responder, si no respondes arriesgas perder tu fianza.",
"If the order expires untaken, your bond will return to you (no action needed).": "Si tu oferta expira sin ser tomada, tu fianza será desbloqueada en tu cartera automáticamente.",
"Enable Telegram Notifications": "Notificar en Telegram",
"Enable TG Notifications": "Activar Notificaciones TG",

View File

@ -258,7 +258,7 @@
"Your maker bond was unlocked":"Votre obligation de createur a été déverrouillée",
"Your taker bond was unlocked":"Votre obligation de preneur a été déverrouillée",
"Your order is public":"Votre ordre est publique",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{invoice_escrow_duration}} hours to reply. If you do not reply, you risk losing your bond.":"Soyez patient pendant que les robots vérifient le livre. Cette case sonnera 🔊 dès qu'un robot prendra votre ordre, puis vous aurez {{invoice_escrow_duration}} heures pour répondre. Si vous ne répondez pas, vous risquez de perdre votre caution",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{invoice_escrow_duration}} to reply. If you do not reply, you risk losing your bond.":"Soyez patient pendant que les robots vérifient le livre. Cette case sonnera 🔊 dès qu'un robot prendra votre ordre, puis vous aurez {{invoice_escrow_duration}} heures pour répondre. Si vous ne répondez pas, vous risquez de perdre votre caution",
"If the order expires untaken, your bond will return to you (no action needed).":"Si l'ordre expire sans être prise, votre caution vous sera rendue (aucune action n'est nécessaire).",
"Enable Telegram Notifications":"Activer les notifications Telegram",
"Enable TG Notifications":"Activer notifications TG",

View File

@ -258,7 +258,7 @@
"Your maker bond was unlocked":"Twoja obligacja twórcy została odblokowana",
"Your taker bond was unlocked":"Twoja więź przyjmującego została odblokowana",
"Your order is public":"Twoje zamówienie jest publiczne",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.":"Bądź cierpliwy, gdy roboty sprawdzają książkę. To pole zadzwoni 🔊, gdy robot odbierze Twoje zamówienie, będziesz mieć {{deposit_timer_hours}}g {{deposit_timer_minutes}}m na odpowiedź. Jeśli nie odpowiesz, ryzykujesz utratę więzi.",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m to reply. If you do not reply, you risk losing your bond.":"Bądź cierpliwy, gdy roboty sprawdzają książkę. To pole zadzwoni 🔊, gdy robot odbierze Twoje zamówienie, będziesz mieć {{deposit_timer_hours}}g {{deposit_timer_minutes}}m na odpowiedź. Jeśli nie odpowiesz, ryzykujesz utratę więzi.",
"If the order expires untaken, your bond will return to you (no action needed).":"Jeśli zamówienie wygaśnie i nie zostanie zrealizowane, Twoja kaucja zostanie Ci zwrócona (nie musisz nic robić).",
"Enable Telegram Notifications":"Włącz powiadomienia telegramu",
"Enable TG Notifications":"Włącz powiadomienia TG",

View File

@ -265,7 +265,7 @@
"Your maker bond was unlocked":"Your maker bond was unlocked",
"Your taker bond was unlocked":"Your taker bond was unlocked",
"Your order is public":"Your order is public",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.":"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m to reply. If you do not reply, you risk losing your bond.":"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.",
"If the order expires untaken, your bond will return to you (no action needed).":"If the order expires untaken, your bond will return to you (no action needed).",
"Enable Telegram Notifications":"Enable Telegram Notifications",
"Enable TG Notifications":"Enable TG Notifications",

View File

@ -265,7 +265,7 @@
"Your maker bond was unlocked":"Your maker bond was unlocked",
"Your taker bond was unlocked":"Your taker bond was unlocked",
"Your order is public":"Your order is public",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.":"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.",
"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m to reply. If you do not reply, you risk losing your bond.":"Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m hours to reply. If you do not reply, you risk losing your bond.",
"If the order expires untaken, your bond will return to you (no action needed).":"If the order expires untaken, your bond will return to you (no action needed).",
"Enable Telegram Notifications":"Enable Telegram Notifications",
"Enable TG Notifications":"Enable TG Notifications",