mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-28 06:44:40 +03:00
Add currency visual flags
This commit is contained in:
parent
f390a8f2f1
commit
91544642ae
@ -89,7 +89,7 @@ class Logics():
|
||||
exchange_rate = get_exchange_rate(Order.currency_dict[str(order.currency)])
|
||||
order_rate = float(order.amount) / (float(order.satoshis) / 100000000)
|
||||
premium = order_rate / exchange_rate - 1
|
||||
premium = int(premium*100) # 2 decimals left
|
||||
premium = int(premium*10000)/100 # 2 decimals left
|
||||
price = order_rate
|
||||
|
||||
significant_digits = 5
|
||||
|
@ -2,6 +2,7 @@ import React, { Component } from "react";
|
||||
import { Paper, Button , CircularProgress, ListItemButton, Typography, Grid, Select, MenuItem, FormControl, FormHelperText, List, ListItem, ListItemText, Avatar, RouterLink, ListItemAvatar} from "@mui/material";
|
||||
import { Link } from 'react-router-dom'
|
||||
import { DataGrid } from '@mui/x-data-grid';
|
||||
import getFlags from './getFlags'
|
||||
|
||||
export default class BookPage extends Component {
|
||||
constructor(props) {
|
||||
@ -100,7 +101,10 @@ export default class BookPage extends Component {
|
||||
} },
|
||||
{ field: 'type', headerName: 'Type', width: 60 },
|
||||
{ field: 'amount', headerName: 'Amount', type: 'number', width: 80 },
|
||||
{ field: 'currency', headerName: 'Currency', width: 100 },
|
||||
{ field: 'currency', headerName: 'Currency', width: 100,
|
||||
renderCell: (params) => {return (
|
||||
<div style={{ cursor: "pointer" }}>{params.row.currency + " " + getFlags(params.row.currency)}</div>
|
||||
)} },
|
||||
{ field: 'payment_method', headerName: 'Payment Method', width: 180 },
|
||||
{ field: 'price', headerName: 'Price', type: 'number', width: 140,
|
||||
renderCell: (params) => {return (
|
||||
|
@ -47,7 +47,7 @@ export default class OrderPage extends Component {
|
||||
this.getCurrencyDict();
|
||||
this.getOrderDetails();
|
||||
|
||||
// Change refresh delay according to Order status
|
||||
// Refresh delais according to Order status
|
||||
this.statusToDelay = {
|
||||
"0": 3000, //'Waiting for maker bond'
|
||||
"1": 30000, //'Public'
|
||||
@ -207,9 +207,9 @@ export default class OrderPage extends Component {
|
||||
}));
|
||||
}
|
||||
|
||||
// set delay to the one matching the order status. If no order status, set delay to 9999999
|
||||
setDelay(val){
|
||||
return val ? this.statusToDelay[val.toString()] : 99999999;
|
||||
// set delay to the one matching the order status. If null order status, delay goes to 9999999.
|
||||
setDelay = (status)=>{
|
||||
return status >= 0 ? this.statusToDelay[status.toString()] : 99999999;
|
||||
}
|
||||
|
||||
getCurrencyCode(val){
|
||||
|
33
frontend/src/components/getFlags.js
Normal file
33
frontend/src/components/getFlags.js
Normal file
@ -0,0 +1,33 @@
|
||||
export default function getFlags(code){
|
||||
if(code == 'AUD') return '🇦🇺';
|
||||
if(code == 'ARS') return '🇦🇷';
|
||||
if(code == 'BRL') return '🇧🇷';
|
||||
if(code == 'CAD') return '🇨🇦';
|
||||
if(code == 'CHF') return '🇨🇭';
|
||||
if(code == 'CLP') return '🇨🇱';
|
||||
if(code == 'CNY') return '🇨🇳';
|
||||
if(code == 'EUR') return '🇪🇺';
|
||||
if(code == 'HKR') return '🇨🇷';
|
||||
if(code == 'CZK') return '🇨🇿';
|
||||
if(code == 'DKK') return '🇩🇰';
|
||||
if(code == 'GBP') return '🇬🇧';
|
||||
if(code == 'HKD') return '🇭🇰';
|
||||
if(code == 'HUF') return '🇭🇺';
|
||||
if(code == 'INR') return '🇮🇳';
|
||||
if(code == 'ISK') return '🇮🇸';
|
||||
if(code == 'JPY') return '🇯🇵';
|
||||
if(code == 'KRW') return '🇰🇷';
|
||||
if(code == 'MXN') return '🇲🇽';
|
||||
if(code == 'NOK') return '🇳🇴';
|
||||
if(code == 'NZD') return '🇳🇿';
|
||||
if(code == 'PLN') return '🇵🇱';
|
||||
if(code == 'RON') return '🇷🇴';
|
||||
if(code == 'RUB') return '🇷🇺';
|
||||
if(code == 'SEK') return '🇸🇪';
|
||||
if(code == 'SGD') return '🇸🇬';
|
||||
if(code == 'VES') return '🇻🇪';
|
||||
if(code == 'TRY') return '🇹🇷';
|
||||
if(code == 'USD') return '🇺🇸';
|
||||
if(code == 'ZAR') return '🇿🇦';
|
||||
return '🏳';
|
||||
};
|
@ -27,5 +27,7 @@
|
||||
"26": "INR",
|
||||
"27": "ISK",
|
||||
"28": "PLN",
|
||||
"29": "RON"
|
||||
"29": "RON",
|
||||
"30": "ARS",
|
||||
"31": "VES"
|
||||
}
|
Loading…
Reference in New Issue
Block a user