Only show supported currencies - Tweak UI

This commit is contained in:
nymkappa 2023-02-15 15:01:07 +09:00
parent e009c78c3e
commit fddbf51084
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
4 changed files with 12 additions and 61 deletions

View File

@ -159,19 +159,11 @@ export const specialBlocks = {
};
export const fiatCurrencies = {
AED: {
name: 'UAE Dirham',
code: 'AED'
},
AUD: {
name: 'Australian Dollar',
code: 'AUD',
indexed: true,
},
BRL: {
name: 'Brazilian Real',
code: 'BRL'
},
CAD: {
name: 'Canadian Dollar',
code: 'CAD',
@ -192,62 +184,14 @@ export const fiatCurrencies = {
code: 'GBP',
indexed: true,
},
HKD: {
name: 'Hong Kong Dollar',
code: 'HKD'
},
IDR: {
name: 'Indonesian Rupiah',
code: 'IDR'
},
JPY: {
name: 'Japanese Yen',
code: 'JPY',
indexed: true,
},
KRW: {
name: 'Korean Won',
code: 'KRW'
},
MYR: {
name: 'Malaysian Ringgit',
code: 'MYR'
},
NGN: {
name: 'Nigerian Naira',
code: 'NGN'
},
NZD: {
name: 'New Zealand Dollar',
code: 'NZD'
},
PLN: {
name: 'Polish Złoty',
code: 'PLN'
},
RUB: {
name: 'Russian Ruble',
code: 'RUB'
},
SGD: {
name: 'Singapore Dollar',
code: 'SGD'
},
TRY: {
name: 'Turkish Lira',
code: 'TRY'
},
UAH: {
name: 'Ukrainian Hryvnia',
code: 'UAH'
},
USD: {
name: 'US Dollar',
code: 'USD',
indexed: true,
},
ZAR: {
name: 'South African Rand',
code: 'ZAR'
},
};

View File

@ -1,5 +1,5 @@
<div [formGroup]="fiatForm" class="text-small text-center">
<select formControlName="fiat" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 180px;" (change)="changeFiat()">
<option *ngFor="let currency of currencyList" [value]="currency">{{ currencies[currency].name }}</option>
<select formControlName="fiat" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 200px;" (change)="changeFiat()">
<option *ngFor="let currency of currencies" [value]="currency[1].code">{{ currency[1].name + " (" + currency[1].code + ")" }}</option>
</select>
</div>

View File

@ -12,8 +12,15 @@ import { StateService } from '../../services/state.service';
})
export class FiatSelectorComponent implements OnInit {
fiatForm: UntypedFormGroup;
currencies = fiatCurrencies;
currencyList = Object.keys(fiatCurrencies).sort();
currencies = Object.entries(fiatCurrencies).sort((a: any, b: any) => {
if (a[1].name < b[1].name) {
return -1;
}
if (a[1].name > b[1].name) {
return 1;
}
return 0;
});
constructor(
private formBuilder: UntypedFormBuilder,

View File

@ -1,5 +1,5 @@
<div [formGroup]="languageForm" class="text-small text-center">
<select formControlName="language" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 180px;" (change)="changeLanguage()">
<select formControlName="language" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 200px;" (change)="changeLanguage()">
<option *ngFor="let lang of languages" [value]="lang.code">{{ lang.name }}</option>
</select>
</div>