瀏覽代碼

Prepare UI for queueing

wip/alt-interface
Jared 1 年之前
父節點
當前提交
015b0b9b4d
共有 4 個文件被更改,包括 58 次插入7 次删除
  1. +1
    -0
      package.json
  2. +12
    -4
      src/api/types.ts
  3. +33
    -3
      src/views/AddFundView.vue
  4. +12
    -0
      yarn.lock

+ 1
- 0
package.json 查看文件

@@ -18,6 +18,7 @@
"luxon": "^3.1.0", "luxon": "^3.1.0",
"vue": "^3.2.13", "vue": "^3.2.13",
"vue-router": "^4.0.3", "vue-router": "^4.0.3",
"vuedraggable": "^4.1.0",
"vuex": "^4.0.0" "vuex": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {


+ 12
- 4
src/api/types.ts 查看文件

@@ -7,17 +7,17 @@ export enum Privileges {
} }


export interface Tag { export interface Tag {
CreatedAt: string;
DeletedAt: string;
createdAt: string;
deletedAt: string;
ID: number; ID: number;
UpdatedAt: string;
updatedAt: string;
description: string; description: string;
active: boolean; active: boolean;
contribution: number; contribution: number;
} }


export interface Contribution { export interface Contribution {
CreatedAt: string;
createdAt: string;
amount: number; amount: number;
rewardFundID: number; rewardFundID: number;
tags: Tag[]; tags: Tag[];
@@ -122,6 +122,14 @@ export interface AuthenticationRequest {


export interface LoginResponse { export interface LoginResponse {
token: string | null; token: string | null;
} // TODO: change shape of fund creation request

export interface GetQueueMembersRequest {
id: number;
}

export interface GetQueueMembersResponse {
members: RewardFund[];
} }


export interface GetRewardFundsRequest { export interface GetRewardFundsRequest {


+ 33
- 3
src/views/AddFundView.vue 查看文件

@@ -54,14 +54,14 @@
aria-label="Queue Selection" aria-label="Queue Selection"
ref="queueOptions" ref="queueOptions"
> >
<option :value="-2">None</option>
<option :value="-1">New Queue</option> <option :value="-1">New Queue</option>
<option :value="queue.id" v-for="(queue, i) in queues" v-bind:key="i"> <option :value="queue.id" v-for="(queue, i) in queues" v-bind:key="i">
{{ queue.name }} {{ queue.name }}
</option> </option>
</select> </select>
</div> </div>
<div class="is-flex is-flex-direction-row is-flex-grow-1 ml-1"
v-if="queueSelection === -1">
<div class="is-flex is-flex-direction-row is-flex-grow-1 ml-1" v-if="queueSelection === -1">
<input <input
class="input mr-1" class="input mr-1"
type="text" type="text"
@@ -70,6 +70,20 @@
aria-label="Queue Name" aria-label="Queue Name"
> >
</div> </div>
<div class="is-flex-grow-1 ml-1" v-else-if="queueSelection >= 0">
<Draggable
v-model="queueMembers"
group="people"
@start="drag=true"
@end="drag=false"
item-key="id">
>
<template #item="{ queue }">
{{ queue.title }}
</template>
<div>{{ queue.title }}</div>
</Draggable>
</div>
</div> </div>
</section> </section>
</section> </section>
@@ -91,15 +105,22 @@ import {
CreateQueueRequest, CreateQueueRequest,
CreateQueueResponse, CreateQueueResponse,
FundInfo, FundInfo,
GetQueueMembersRequest,
GetQueueMembersResponse,
GetQueuesResponse, GetQueuesResponse,
Queue, Queue,
RewardFund,
SuccessResponse, SuccessResponse,
} from '@/api/types'; } from '@/api/types';
import { ref } from 'vue';
import {
ref,
watch,
} from 'vue';
import store from '@/store'; import store from '@/store';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import FundTierInput from '@/components/FundTierInput.vue'; import FundTierInput from '@/components/FundTierInput.vue';
import { sanitize } from '@/lib/helpers'; import { sanitize } from '@/lib/helpers';
import Draggable from 'vuedraggable';


const router = useRouter(); const router = useRouter();


@@ -119,6 +140,8 @@ const minContribution = ref(undefined as number | undefined);


const queueSelection = ref(undefined as number | undefined); const queueSelection = ref(undefined as number | undefined);
const queueName = ref(undefined as string | undefined); const queueName = ref(undefined as string | undefined);
const queueMembers = ref(undefined as RewardFund[] | undefined);
const drag = ref(false);


const queues = ref([] as Queue[]); const queues = ref([] as Queue[]);
const fetchQueues = async () => { const fetchQueues = async () => {
@@ -177,6 +200,13 @@ const submit = async () => {
} }
} }
}; };

watch(queueSelection, async (newValue) => {
if (newValue !== undefined && newValue >= 0) {
const resp = await controller.post<GetQueueMembersResponse, GetQueueMembersRequest>('GetQueueMembers', { id: newValue });
queueMembers.value = resp?.members;
}
});
</script> </script>


<style scoped lang="stylus"> <style scoped lang="stylus">


+ 12
- 0
yarn.lock 查看文件

@@ -6669,6 +6669,11 @@ sockjs@^0.3.24:
uuid "^8.3.2" uuid "^8.3.2"
websocket-driver "^0.7.4" websocket-driver "^0.7.4"


sortablejs@1.14.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.14.0.tgz#6d2e17ccbdb25f464734df621d4f35d4ab35b3d8"
integrity sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w==

source-map-js@^1.0.2: source-map-js@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz" resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz"
@@ -7370,6 +7375,13 @@ vue@^3.2.13:
"@vue/server-renderer" "3.2.41" "@vue/server-renderer" "3.2.41"
"@vue/shared" "3.2.41" "@vue/shared" "3.2.41"


vuedraggable@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/vuedraggable/-/vuedraggable-4.1.0.tgz#edece68adb8a4d9e06accff9dfc9040e66852270"
integrity sha512-FU5HCWBmsf20GpP3eudURW3WdWTKIbEIQxh9/8GE806hydR9qZqRRxRE3RjqX7PkuLuMQG/A7n3cfj9rCEchww==
dependencies:
sortablejs "1.14.0"

vuex@^4.0.0: vuex@^4.0.0:
version "4.1.0" version "4.1.0"
resolved "https://registry.npmjs.org/vuex/-/vuex-4.1.0.tgz" resolved "https://registry.npmjs.org/vuex/-/vuex-4.1.0.tgz"


Loading…
取消
儲存