Explorar el Código

:recycle: move user swap to sidebar

tags/0.0.1
J hace 4 años
padre
commit
7a2dc84082
Se han modificado 2 ficheros con 15 adiciones y 16 borrados
  1. 10
    3
      frontend/src/components/Sidebar.vue
  2. 5
    13
      frontend/src/views/home.vue

+ 10
- 3
frontend/src/components/Sidebar.vue Ver fichero

1
 <template lang="pug">
1
 <template lang="pug">
2
-
3
-aside.sidebar.p-1
2
+aside.sidebar.p-1.f-col.between
4
     h3 Messages
3
     h3 Messages
5
     .search
4
     .search
6
         input
5
         input
7
         label search
6
         label search
8
 
7
 
9
     messages(:title="title" :users="users")
8
     messages(:title="title" :users="users")
9
+    .spacer.f-grow
10
+    .temp-control-box.f-row.start.center
11
+        p.t-up.p-0 current user
12
+        input(v-model='mypid' style="width: 50px")
13
+        button(@click="$emit('updatePid', mypid)").t-up.p-0 switch
10
 </template>
14
 </template>
11
 
15
 
12
 <script>
16
 <script>
16
     components: { messages }, 
20
     components: { messages }, 
17
     data: () => ({
21
     data: () => ({
18
         title:'Messages from Matches',
22
         title:'Messages from Matches',
19
-        uid: 111,
23
+        mypid: 45,
20
         users: [
24
         users: [
21
             {
25
             {
22
                 name: 'Bob McRob',
26
                 name: 'Bob McRob',
32
             },
36
             },
33
         ],
37
         ],
34
     }),
38
     }),
39
+    created() {
40
+        this.$emit('updatePid', this.mypid)
41
+    }
35
 }
42
 }
36
 </script>
43
 </script>
37
 
44
 

+ 5
- 13
frontend/src/views/home.vue Ver fichero

1
 <template lang="pug">
1
 <template lang="pug">
2
-sidebar
2
+sidebar(@updatePid="setPid")
3
 main.f-col.start.w-full
3
 main.f-col.start.w-full
4
     article#home(v-if='!loading')
4
     article#home(v-if='!loading')
5
         h1(v-if='user') {{ user.user_name }}
5
         h1(v-if='user') {{ user.user_name }}
6
         profile-card-list(:profiles='swipables' :pid='parseInt(mypid)' @reloadQueue='getQueue')
6
         profile-card-list(:profiles='swipables' :pid='parseInt(mypid)' @reloadQueue='getQueue')
7
-        input(v-model='mypid')
8
-        button(@click='getQueue') Submit
9
     p(v-else) Loading...
7
     p(v-else) Loading...
10
     main-nav
8
     main-nav
11
 </template>
9
 </template>
29
         mypid: null,
27
         mypid: null,
30
         loading: true
28
         loading: true
31
     }),
29
     }),
32
-    async created() {
33
-        // this.mypid = auth.currentUser?.mypid || "99999";
34
-        this.mypid = 45
35
-        // Uncomment below to use for batch file data
36
-        // this.processProfilesFromBatch(this.parseBatch([batch_10, batch_20, batch_30]))
37
-        this.getQueue()
38
-    },
39
     methods: {
30
     methods: {
31
+        setPid(pid) {
32
+            this.mypid = pid
33
+            this.getQueue()
34
+        },
40
         async getQueue() {
35
         async getQueue() {
41
             this.loading = true
36
             this.loading = true
42
             const queueList = await fetchQueueByProfileId(this.mypid)
37
             const queueList = await fetchQueueByProfileId(this.mypid)
53
                     }
48
                     }
54
                 formattedList.push(formatted)
49
                 formattedList.push(formatted)
55
             })
50
             })
56
-            console.log('formattedList', formattedList)
57
-            // formattedList.reverse()
58
             this.swipables = formattedList
51
             this.swipables = formattedList
59
         },
52
         },
60
         // For Batch Data Parsing & Processing
53
         // For Batch Data Parsing & Processing
93
                 })
86
                 })
94
                 this.swipables.push(p)
87
                 this.swipables.push(p)
95
             })
88
             })
96
-            console.log('swipables', this.swipables)
97
         },
89
         },
98
     },
90
     },
99
 }
91
 }

Loading…
Cancelar
Guardar