mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 03:25:15 +00:00
add trade nav sorting
This commit is contained in:
parent
c06e290290
commit
957dfee8ea
|
@ -1,7 +1,13 @@
|
|||
<template>
|
||||
<div>
|
||||
<span>Trade Navigation</span>
|
||||
<b-list-group>
|
||||
<b-list-group-item
|
||||
button
|
||||
class="d-flex flex-wrap justify-content-center align-items-center"
|
||||
:title="'Trade Navigation'"
|
||||
@click="sortNewestFirst = !sortNewestFirst"
|
||||
>Trade Navigation {{ sortNewestFirst ? '↓' : '↑' }}
|
||||
</b-list-group-item>
|
||||
<b-list-group-item
|
||||
v-for="trade in sortedTrades"
|
||||
:key="trade.open_timestamp"
|
||||
|
@ -45,6 +51,7 @@ const emit = defineEmits(['trade-select']);
|
|||
|
||||
const botStore = useBotStore();
|
||||
const selectedTrade = ref({} as Trade);
|
||||
const sortNewestFirst = ref(true);
|
||||
|
||||
const onTradeSelect = (trade: Trade) => {
|
||||
selectedTrade.value = trade;
|
||||
|
@ -52,7 +59,13 @@ const onTradeSelect = (trade: Trade) => {
|
|||
};
|
||||
|
||||
const sortedTrades = computed(() => {
|
||||
return props.trades.slice().sort((a, b) => b.open_timestamp - a.open_timestamp);
|
||||
return props.trades
|
||||
.slice()
|
||||
.sort((a, b) =>
|
||||
sortNewestFirst.value
|
||||
? b.open_timestamp - a.open_timestamp
|
||||
: a.open_timestamp - b.open_timestamp,
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user