Add currency visual flags

This commit is contained in:
Reckless_Satoshi 2022-01-15 07:12:26 -08:00
parent f390a8f2f1
commit 91544642ae
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
5 changed files with 46 additions and 7 deletions

View File

@ -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

View File

@ -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 (

View File

@ -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){

View 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 '🏳';
};

View File

@ -27,5 +27,7 @@
"26": "INR",
"27": "ISK",
"28": "PLN",
"29": "RON"
"29": "RON",
"30": "ARS",
"31": "VES"
}