+
+
+
+ Select an option from the menu
+ {{ props.orientation === 'vertical' ? 'above' : 'to the left' }}
+
+
-
{{ element.title }} ({{ element.asset }})
+
{{ element.asset }}
{{ element.order }}
@@ -49,23 +66,22 @@ import {
} from 'vue';
import {
Queue,
+ QueueMember,
RewardFund,
} from '@/api/types';
import {
getQueueMembers,
getQueues,
+ reorderQueue,
} from '@/api/composed';
import { VueDraggableNext as Draggable } from 'vue-draggable-next';
-
-interface QueueMember {
- id?: number;
- title: string;
- asset: string;
- order: number;
-}
+import { useDebounceFn } from '@vueuse/core';
// eslint-disable-next-line no-undef
-const props = defineProps<{ newMember: RewardFund & { order: number; } }>();
+const props = defineProps<{
+ newMember: RewardFund & { order: number; },
+ orientation: 'horizontal' | 'vertical'
+}>();
// eslint-disable-next-line no-undef
const emits = defineEmits(['selected', 'created']);
@@ -75,13 +91,21 @@ const queueName = ref(undefined as string | undefined);
const queueMembers = ref(undefined as QueueMember[] | undefined);
const serverQueues = ref(0);
-const reorder = () => {
+const sendQueueOrder = useDebounceFn(async () => {
+ if (queueSelection.value && queueMembers.value) {
+ await reorderQueue(queueSelection.value, queueMembers.value);
+ }
+}, 2000);
+
+const reorder = async () => {
if (queueMembers.value) {
for (let i = 0; i < queueMembers.value.length; i += 1) {
if (queueMembers.value[i]) {
queueMembers.value[i].order = (i + 1);
}
}
+
+ await sendQueueOrder();
}
};
@@ -107,16 +131,14 @@ const populateQueueMembers = async (id: number) => {
const resp = await getQueueMembers(id) as { members: (RewardFund & { order: number; })[] };
queueMembers.value = resp?.members.map((m) => ({
id: m.id,
- title: m.title,
asset: m.asset,
order: m.order,
}));
serverQueues.value = queueMembers.value.length;
- if (queueMembers.value && props.newMember.title && props.newMember.asset) {
+ if (queueMembers.value && props.newMember.asset) {
const newMember = {
id: undefined,
- title: props.newMember.title,
asset: props.newMember.asset,
order: queueMembers.value.length + 1,
};
@@ -134,10 +156,9 @@ watch(queueSelection, async (newValue) => {
const addedMember = computed(() => props.newMember);
watch(addedMember, (newVal) => {
- if (newVal.title && newVal.asset) {
+ if (newVal.asset) {
const assembleNewMember = (order: number) => ({
id: undefined,
- title: newVal.title,
asset: newVal.asset,
order,
});
diff --git a/src/components/FundLink.vue b/src/components/FundLink.vue
index fda07c1..8746218 100644
--- a/src/components/FundLink.vue
+++ b/src/components/FundLink.vue
@@ -1,8 +1,19 @@
-
- {{ fund.asset }}
+
+
+ {{ fund.asset }}
+
+
+ {{ props.aside }}
+
@@ -30,15 +41,18 @@
+
+
diff --git a/src/views/AdminView.vue b/src/views/AdminView.vue
index 31ecc94..fd3921e 100644
--- a/src/views/AdminView.vue
+++ b/src/views/AdminView.vue
@@ -1,15 +1,17 @@
-