mirror of
https://github.com/rottenwheel/moner.ooo.git
synced 2024-12-22 16:17:46 +00:00
feat: Add preferred currencies ordering support
Enhanced the configuration and display logic to allow specifying preferred currencies, which are now ordered at the top of the list. This improves user experience by prioritizing commonly used currencies. This also eliminates duplicate entries for the currently selected currency in the drop-down.
This commit is contained in:
parent
bd29ffd43c
commit
bc4761ac46
2 changed files with 15 additions and 4 deletions
|
@ -5,5 +5,8 @@ return [
|
||||||
'footer_links' => [ // Custom links to show in the footer
|
'footer_links' => [ // Custom links to show in the footer
|
||||||
['text' => 'Clearnet', 'url' => 'https://calc.revuo-xmr.com'],
|
['text' => 'Clearnet', 'url' => 'https://calc.revuo-xmr.com'],
|
||||||
['text' => 'Tor', 'url' => 'http://calc.revuo75joezkbeitqmas4ab6spbrkr4vzbhjmeuv75ovrfqfp47mtjid.onion']
|
['text' => 'Tor', 'url' => 'http://calc.revuo75joezkbeitqmas4ab6spbrkr4vzbhjmeuv75ovrfqfp47mtjid.onion']
|
||||||
|
],
|
||||||
|
'preferred_currencies' => [ // Currencies that should be displayed at the top of the lists
|
||||||
|
'usd', 'eur', 'gbp', 'cad', 'btc', 'eth', 'ltc'
|
||||||
]
|
]
|
||||||
];
|
];
|
16
index.php
16
index.php
|
@ -54,6 +54,16 @@ if (file_exists('config.php')) {
|
||||||
|
|
||||||
$display_servers_guru = isset($config['servers_guru']) && $config['servers_guru'] === true;
|
$display_servers_guru = isset($config['servers_guru']) && $config['servers_guru'] === true;
|
||||||
$attribution = isset($config['attribution']) ? $config['attribution'] : '';
|
$attribution = isset($config['attribution']) ? $config['attribution'] : '';
|
||||||
|
$preferred_currencies = isset($config['preferred_currencies']) ? $config['preferred_currencies'] : [];
|
||||||
|
|
||||||
|
// Order preferred currencies to the top
|
||||||
|
foreach (array_reverse($preferred_currencies) as $currency) {
|
||||||
|
$currency = strtoupper($currency);
|
||||||
|
if (($key = array_search($currency, $currencies)) !== false) {
|
||||||
|
unset($currencies[$key]);
|
||||||
|
array_unshift($currencies, $currency);
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -148,12 +158,10 @@ $attribution = isset($config['attribution']) ? $config['attribution'] : '';
|
||||||
<input class="form-control" id="fiatInput" type="text" spellcheck="false" autocorrect="off" inputmode="numeric" aria-label="<?php echo $l_fiatInput; ?>" value="<?php echo $xmr_in_fiat; ?>">
|
<input class="form-control" id="fiatInput" type="text" spellcheck="false" autocorrect="off" inputmode="numeric" aria-label="<?php echo $l_fiatInput; ?>" value="<?php echo $xmr_in_fiat; ?>">
|
||||||
<select class="input-group-text cursor-pointer" id="selectBox" aria-label="<?php echo $l_fiatSelect; ?>">
|
<select class="input-group-text cursor-pointer" id="selectBox" aria-label="<?php echo $l_fiatSelect; ?>">
|
||||||
<?php
|
<?php
|
||||||
if (isset($xmr_in)) {
|
|
||||||
echo '<option value="' . $xmr_in . '">' . (isset(${"l_" . strtolower($xmr_in)}) ? ${"l_" . strtolower($xmr_in)} : $xmr_in) . '</option>';
|
|
||||||
}
|
|
||||||
foreach ($currencies as $currency) {
|
foreach ($currencies as $currency) {
|
||||||
|
$selected = $currency == $xmr_in ? 'selected' : '';
|
||||||
$currencyName = isset(${"l_" . strtolower($currency)}) ? ${"l_" . strtolower($currency)} : $currency;
|
$currencyName = isset(${"l_" . strtolower($currency)}) ? ${"l_" . strtolower($currency)} : $currency;
|
||||||
echo "<option value=\"{$currency}\">{$currencyName}</option>";
|
echo "<option {$selected} value=\"{$currency}\">{$currencyName}</option>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in a new issue