Просмотр исходного кода

:recycle: adding back button to send to back of matchQueue | adding back button to match and create grouping from matchQueue

tags/0.0.1^2
j 3 лет назад
Родитель
Сommit
1412bf605e

+ 1759
- 1776
frontend/package-lock.json
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 14
- 2
frontend/src/components/PairingButton.vue Просмотреть файл

@@ -1,11 +1,23 @@
1 1
 <template lang="pug">
2
-w-tag(color="mint-green" bg-color="green" xl).xs12.mt4.mb4
3
-    p.pa4.text-upper pair pending
2
+.pairing-button.w-flex.row
3
+    w-button.xs6.mt4.mb4(@click='pass' bg-color='red' color='white' xl)
4
+        p.pa4.text-upper pass
5
+    w-button.xs6.mt4.mb4(@click='pair' bg-color='green' color='mint-green' xl)
6
+        p.pa4.text-upper pair
4 7
 </template>
5 8
 
6 9
 <script>
7 10
 export default {
8 11
     props: {},
12
+    emits: ['pair', 'pass'],
9 13
     data: () => ({}),
14
+    methods: {
15
+        pair() {
16
+            this.$emit('pair')
17
+        },
18
+        pass() {
19
+            this.$emit('pass')
20
+        },
21
+    },
10 22
 }
11 23
 </script>

+ 46
- 26
frontend/src/components/ProfileCard.vue Просмотреть файл

@@ -2,50 +2,55 @@
2 2
 w-card.profile-card-list--card.xs12.pa12
3 3
     header.xs12.w-flex.column.center
4 4
         NamePlate(
5
-            :pid="card.pid"
6
-            :name="card.name"
7
-            :pronouns="card.pronouns"
8
-            :role="card.role"
9
-            :is-list="isList"
10
-            :is-paired="isPaired"
5
+            :is-list='isList'
6
+            :is-paired='isPaired'
7
+            :name='card.name'
8
+            :pid='card.pid'
9
+            :pronouns='card.pronouns'
10
+            :role='card.role'
11 11
         )
12
-        
13
-        w-button.text-upper.xs12.pa6(v-if="isPaired && !isList")
14
-            w-icon(xl).mr1 mdi mdi-chat
12
+
13
+        w-button.text-upper.xs12.pa6(v-if='isPaired && !isList')
14
+            w-icon.mr1(xl) mdi mdi-chat
15 15
             | start chat
16
-        
17
-        template(v-if="!isList")
18
-            SummaryBar(
19
-                :is-tab="isPaired"
20
-                :tab-content="card.summary"
21
-            )
22
-            TagList(v-if="!isPaired || isList")
16
+
17
+        template(v-if='!isList')
18
+            SummaryBar(:is-tab='isPaired' :tab-content='card.summary')
19
+            TagList(v-if='!isPaired || isList')
23 20
 
24 21
     article.xs12.w-flex.column.justify-space-between
25 22
         AspectBar(
26
-            v-if="!isPaired || isList"
27
-            v-for="aspect in aspects"
28
-            :labels="aspect.labels"
29
-            :percentage="aspect.percentage"
30
-            :key="aspect.name"
23
+            :key='aspect.name'
24
+            :labels='aspect.labels'
25
+            :percentage='aspect.percentage'
26
+            v-for='aspect in aspects'
27
+            v-if='!isPaired || isList'
31 28
         )
32
-    
33
-    footer(v-if="!isList && !isPaired")
29
+
30
+    footer(v-if='!isList && !isPaired')
34 31
         .pa12
35 32
             p {{ card.summary.about.tab }}
36
-        PairingButton(v-if="!isPaired")
33
+        PairingButton(@pair='onPair' @pass='onPass' v-if='!isPaired')
37 34
 </template>
38 35
 
39 36
 <script setup>
40 37
 import { ref } from 'vue'
38
+import { useRouter } from 'vue-router'
39
+import {
40
+    updateQueueByProfileId,
41
+    postMembershipByProfileId,
42
+    currentProfile,
43
+} from '../services'
44
+
41 45
 import NamePlate from './NamePlate.vue'
42 46
 import AspectBar from './AspectBar.vue'
43 47
 import SummaryBar from './SummaryBar.vue'
44 48
 import TagList from './TagList.vue'
45 49
 import PairingButton from './PairingButton.vue'
46 50
 
47
-const isPaired = ref(true)
48
-// const isPaired = ref(false)
51
+const router = useRouter()
52
+// const isPaired = ref(true)
53
+const isPaired = ref(false)
49 54
 
50 55
 const props = defineProps({
51 56
     card: {
@@ -62,6 +67,21 @@ const props = defineProps({
62 67
         default: true,
63 68
     },
64 69
 })
70
+
71
+const onPair = async () => {
72
+    const group = await postMembershipByProfileId({
73
+        profileId: currentProfile.id.value,
74
+        targetId: props.card.pid,
75
+    })
76
+    updateQueueByProfileId(currentProfile.id.value, props.card.pid, false)
77
+    console.warn('created grouping:', group)
78
+    console.log('is grouping a match?:', group.membershipMatch.hasMatch)
79
+    router.push({ name: 'HomeView' })
80
+}
81
+const onPass = async () => {
82
+    updateQueueByProfileId(currentProfile.id.value, props.card.pid, true)
83
+    router.push({ name: 'HomeView' })
84
+}
65 85
 </script>
66 86
 
67 87
 <style lang="sass">

+ 1
- 0
frontend/src/services/grouping.service.js Просмотреть файл

@@ -40,6 +40,7 @@ const postMembershipByProfileId = async ({
40 40
         grouping_type: groupingType,
41 41
         grouping_name: `${utcDateInSeconds}_${profileId}_${targetId}`,
42 42
     }
43
+    console.log('membership :', membership)
43 44
     const membershipMatch = await db.post(
44 45
         `/membership/${profileId}/join`,
45 46
         membership,

Загрузка…
Отмена
Сохранить