mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-20 19:06:43 -05:00
feat: cargo project at root
This commit is contained in:
parent
aa0c0623ca
commit
709a2820c4
313 changed files with 1 additions and 740 deletions
19
src-gui/src/utils/sortUtils.ts
Normal file
19
src-gui/src/utils/sortUtils.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { ExtendedProviderStatus } from 'models/apiModel';
|
||||
|
||||
export function sortProviderList(list: ExtendedProviderStatus[]) {
|
||||
return list.concat().sort((firstEl, secondEl) => {
|
||||
// If neither of them have a relevancy score, sort by max swap amount
|
||||
if (firstEl.relevancy === undefined && secondEl.relevancy === undefined) {
|
||||
if (firstEl.maxSwapAmount > secondEl.maxSwapAmount) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// If only on of the two don't have a relevancy score, prioritize the one that does
|
||||
if (firstEl.relevancy === undefined) return 1;
|
||||
if (secondEl.relevancy === undefined) return -1;
|
||||
if (firstEl.relevancy > secondEl.relevancy) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue