From 567c8693486d3f78bed4ac6428874fdd1c3a96f4 Mon Sep 17 00:00:00 2001 From: Tako Date: Wed, 7 Jun 2023 18:33:22 +0000 Subject: [PATCH] use groups in exchange select --- src/components/ftbot/ExchangeSelect.vue | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/ftbot/ExchangeSelect.vue b/src/components/ftbot/ExchangeSelect.vue index 5a8c806d..ab127a1e 100644 --- a/src/components/ftbot/ExchangeSelect.vue +++ b/src/components/ftbot/ExchangeSelect.vue @@ -29,19 +29,18 @@ const exchangeModel = defineModel({ const botStore = useBotStore(); const exchangeList = computed(() => { - return botStore.activeBot.exchangeList - .filter((ex) => ex.valid === true) - .sort((a, b) => { - // Sort by supported (alphabetically), then by name (alphabetically). - if (a.supported && !b.supported) { - return -1; - } else if (!a.supported && b.supported) { - return 1; - } else { - return a.name.localeCompare(b.name); - } - }) - .map((e) => e.name); + const supported = botStore.activeBot.exchangeList + .filter((ex) => ex.valid && ex.supported) + .sort((a, b) => a.name.localeCompare(b.name)); + + const unsupported = botStore.activeBot.exchangeList + .filter((ex) => ex.valid && !ex.supported) + .sort((a, b) => a.name.localeCompare(b.name)); + + return [ + { label: 'Supported', options: supported.map((e) => e.name) }, + { label: 'Unsupported', options: unsupported.map((e) => e.name) }, + ]; }); const tradeModesTyped = computed(() => {