2021-12-22 05:44:09 +00:00
|
|
|
<template>
|
2021-12-31 15:28:34 +00:00
|
|
|
<div class="h-100 overflow-auto p-1">
|
|
|
|
<b-list-group id="tradeList">
|
2021-12-25 09:05:38 +00:00
|
|
|
<b-list-group-item
|
2021-12-25 18:50:00 +00:00
|
|
|
v-for="trade in filteredTrades"
|
2021-12-25 09:05:38 +00:00
|
|
|
:key="trade.trade_id"
|
2021-12-31 15:28:34 +00:00
|
|
|
class="border border-secondary rounded my-05 px-1"
|
2021-12-30 08:42:41 +00:00
|
|
|
@click="tradeClick(trade)"
|
2021-12-25 09:05:38 +00:00
|
|
|
>
|
2021-12-22 05:44:09 +00:00
|
|
|
<CustomTradeListEntry :trade="trade" :stake-currency-decimals="stakeCurrencyDecimals" />
|
|
|
|
</b-list-group-item>
|
|
|
|
</b-list-group>
|
|
|
|
|
2021-12-25 09:05:38 +00:00
|
|
|
<span v-if="trades.length == 0" class="mt-5">{{ emptyText }}</span>
|
|
|
|
|
2021-12-31 15:28:34 +00:00
|
|
|
<div class="w-100 d-flex justify-content-between mt-1">
|
2021-12-22 05:44:09 +00:00
|
|
|
<b-pagination
|
|
|
|
v-if="!activeTrades"
|
|
|
|
v-model="currentPage"
|
|
|
|
:total-rows="rows"
|
|
|
|
:per-page="perPage"
|
2021-12-31 15:28:34 +00:00
|
|
|
aria-controls="tradeList"
|
2021-12-22 05:44:09 +00:00
|
|
|
></b-pagination>
|
2022-11-18 16:10:06 +00:00
|
|
|
<b-form-input
|
2021-12-22 05:44:09 +00:00
|
|
|
v-if="showFilter"
|
|
|
|
v-model="filterText"
|
|
|
|
type="text"
|
|
|
|
placeholder="Filter"
|
|
|
|
size="sm"
|
|
|
|
style="width: unset"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-05-09 18:04:57 +00:00
|
|
|
<script setup lang="ts">
|
2022-08-03 04:41:16 +00:00
|
|
|
import { Trade } from '@/types';
|
2021-12-22 05:44:09 +00:00
|
|
|
import CustomTradeListEntry from '@/components/ftbot/CustomTradeListEntry.vue';
|
2023-05-09 18:04:57 +00:00
|
|
|
import { computed, ref } from 'vue';
|
2022-04-19 04:53:35 +00:00
|
|
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
2021-12-22 05:44:09 +00:00
|
|
|
|
2023-05-09 18:04:57 +00:00
|
|
|
const props = defineProps({
|
|
|
|
trades: { required: true, type: Array as () => Trade[] },
|
|
|
|
title: { default: 'Trades', type: String },
|
|
|
|
stakeCurrency: { required: false, default: '', type: String },
|
|
|
|
activeTrades: { default: false, type: Boolean },
|
|
|
|
showFilter: { default: false, type: Boolean },
|
|
|
|
multiBotView: { default: false, type: Boolean },
|
|
|
|
emptyText: { default: 'No Trades to show.', type: String },
|
|
|
|
stakeCurrencyDecimals: { default: 3, type: Number },
|
|
|
|
});
|
|
|
|
const botStore = useBotStore();
|
|
|
|
const currentPage = ref(1);
|
|
|
|
const filterText = ref('');
|
|
|
|
const perPage = props.activeTrades ? 200 : 25;
|
2022-04-16 12:16:22 +00:00
|
|
|
|
2023-05-09 18:04:57 +00:00
|
|
|
const rows = computed(() => props.trades.length);
|
2022-04-16 12:16:22 +00:00
|
|
|
|
2023-05-09 18:04:57 +00:00
|
|
|
const filteredTrades = computed(() => {
|
|
|
|
return props.trades.slice((currentPage.value - 1) * perPage, currentPage.value * perPage);
|
|
|
|
});
|
2022-04-16 12:16:22 +00:00
|
|
|
|
2023-05-09 18:04:57 +00:00
|
|
|
const tradeClick = (trade) => {
|
|
|
|
botStore.activeBot.setDetailTrade(trade);
|
|
|
|
};
|
2021-12-22 05:44:09 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-12-25 09:05:38 +00:00
|
|
|
.my-05 {
|
|
|
|
margin-top: 0.125rem;
|
|
|
|
margin-bottom: 0.125rem;
|
|
|
|
}
|
2021-12-22 05:44:09 +00:00
|
|
|
</style>
|