frequi_origin/src/components/ftbot/PairlistConfigItem.vue

79 lines
2.2 KiB
Vue
Raw Normal View History

2023-05-23 18:27:33 +00:00
<template>
<b-card no-body class="mb-2">
<template #header>
2023-05-29 06:51:40 +00:00
<div class="d-flex text-start align-items-center">
<div class="d-flex flex-grow-1 align-items-center">
2023-05-31 18:51:06 +00:00
<i-mdi-reorder-horizontal
role="button"
class="handle me-2 fs-4 flex-shrink-0"
width="24"
height="24"
/>
2023-05-29 17:51:54 +00:00
<div
role="button"
2023-06-11 17:54:01 +00:00
class="d-flex flex-grow-1 align-items-start flex-column user-select-none"
@click="toggleVisible"
2023-05-29 17:51:54 +00:00
>
2023-06-01 19:06:32 +00:00
<span class="fw-bold">{{ pairlist.name }}</span>
<span class="text-small">{{ pairlist.description }}</span>
2023-05-29 17:51:54 +00:00
</div>
2023-05-29 06:51:40 +00:00
</div>
2023-05-31 20:37:29 +00:00
<i-mdi-close
role="button"
width="24"
height="24"
class="mx-2"
@click="pairlistStore.removeFromConfig(index)"
/>
<i-mdi-chevron-down
2023-06-13 13:00:45 +00:00
v-if="!pairlist.showParameters"
:class="hasParameters && !pairlist.showParameters ? 'visible' : 'invisible'"
role="button"
class="fs-4"
@click="toggleVisible"
/>
<i-mdi-chevron-up
2023-06-13 13:00:45 +00:00
v-if="pairlist.showParameters"
:class="hasParameters && pairlist.showParameters ? 'visible' : 'invisible'"
role="button"
class="fs-4"
@click="toggleVisible"
/>
2023-05-29 06:51:40 +00:00
</div>
2023-05-23 18:27:33 +00:00
</template>
2023-06-13 13:00:45 +00:00
<b-collapse v-model="pairlist.showParameters">
2023-05-31 20:37:29 +00:00
<b-card-body>
<PairlistConfigParameter
v-for="(parameter, key) in pairlist.params"
:key="key"
v-model="pairlist.params[key].value"
:param="parameter"
/>
</b-card-body>
</b-collapse>
2023-05-23 18:27:33 +00:00
</b-card>
</template>
<script setup lang="ts">
2023-05-31 20:37:29 +00:00
import { usePairlistConfigStore } from '@/stores/pairlistConfig';
2023-06-10 06:46:36 +00:00
import { Pairlist } from '@/types';
2023-05-31 20:37:29 +00:00
const pairlistStore = usePairlistConfigStore();
2023-05-23 18:27:33 +00:00
2023-05-28 15:25:15 +00:00
defineProps<{
2023-05-23 18:27:33 +00:00
index: number;
}>();
2023-05-28 15:25:15 +00:00
const pairlist = defineModel<Pairlist>({ required: true });
const hasParameters = computed(() => Object.keys(pairlist.value.params).length > 0);
function toggleVisible() {
if (hasParameters.value) {
2023-06-13 13:00:45 +00:00
pairlist.value.showParameters = !pairlist.value.showParameters;
}
}
2023-05-23 18:27:33 +00:00
</script>
2023-05-31 18:33:43 +00:00
<style lang="scss" scoped></style>