Explorar el Código

:recycle: extended homeview tofetch and display matches | temporary removing majority of content on home endpoint

tags/0.0.1^2
juancarbajal98 hace 3 años
padre
commit
fdb56858d5

+ 2
- 1
backend/knexfile.js Ver fichero

1
-require('dotenv').config()
1
+require('dotenv').config({path: './server/.env'})
2
+// require('dotenv').config()
2
 
3
 
3
 const local = {
4
 const local = {
4
     host: process.env.DB_HOST,
5
     host: process.env.DB_HOST,

+ 14507
- 6241
backend/package-lock.json
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 4
- 2
backend/server/manifest.js Ver fichero

1
-const Dotenv = require('dotenv')
1
+const Dotenv = require('dotenv').config({path: './server/.env'})
2
+// const Dotenv = require('dotenv')
2
 const Confidence = require('@hapipal/confidence')
3
 const Confidence = require('@hapipal/confidence')
3
 const Inert = require('@hapi/inert')
4
 const Inert = require('@hapi/inert')
4
 const Vision = require('@hapi/vision')
5
 const Vision = require('@hapi/vision')
6
 const HapiSwagger = require('hapi-swagger')
7
 const HapiSwagger = require('hapi-swagger')
7
 
8
 
8
 /** Pull .env into process.env */
9
 /** Pull .env into process.env */
9
-Dotenv.config({ path: `${__dirname}/../.env` })
10
+// Dotenv.config({ path: `${__dirname}/../.env` })
11
+// Dotenv.config({ path: `${__dirname}/../.env` })
10
 
12
 
11
 /** Glue manifest as a confidence store */
13
 /** Glue manifest as a confidence store */
12
 module.exports = new Confidence.Store({
14
 module.exports = new Confidence.Store({

+ 7742
- 862
frontend/package-lock.json
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 27
- 27
frontend/src/App.vue Ver fichero

1
 <template lang="pug">
1
 <template lang="pug">
2
-w-app
3
-    w-drawer(v-model="openDrawer")
4
-    w-flex.my12(:gap="3" align-center wrap)
5
-        w-button.ma1(@click="$waveui.notify('Information.')" bg-color="info") Notify info
6
-        w-button.ma1(@click="$waveui.notify('Success!', 'success')" bg-color="success") Notify success
7
-        w-button.ma1(@click="$waveui.notify('Warning!', 'warning')" bg-color="warning") Notify warning
8
-        w-button.ma1(@click="$waveui.notify('Error :(', 'error', 0)" bg-color="error") Permanent error
9
-    w-flex.my12(align-center wrap)
10
-        w-spinner(bounce)
11
-        w-input Label
12
-        w-checkbox Single option
13
-    w-flex.my12
14
-        w-button(@click="openDrawer = true" outline="")
15
-            | Open drawer
16
-    w-flex.my12(grow column)
17
-        w-slider(:model-value="40" thumb-label step-label :step="20" color="primary-light3").mt12
18
-        .mt4 v-model:
19
-            code.ml1 {{ sliderVal }}
20
-    w-flex.my12(:gap="3" align-center wrap)
21
-        | Show menu on:
22
-        w-menu
23
-            template(#activator="{ on }")
24
-                w-button(v-on="on") Show menu
25
-            | Menu content
26
-        w-badge.mr10(bg-color="error")
27
-            template(#badge) 3
28
-            w-icon(color="grey-light1" size="2.5em") mdi mdi-email
2
+w-app(style="display:flex; flex-direction:row-reverse; gap: 40px; justify-content: flex-end;")
3
+    //- w-drawer(v-model="openDrawer")
4
+    //- w-flex.my12(:gap="3" align-center wrap)
5
+    //-     w-button.ma1(@click="$waveui.notify('Information.')" bg-color="info") Notify info
6
+    //-     w-button.ma1(@click="$waveui.notify('Success!', 'success')" bg-color="success") Notify success
7
+    //-     w-button.ma1(@click="$waveui.notify('Warning!', 'warning')" bg-color="warning") Notify warning
8
+    //-     w-button.ma1(@click="$waveui.notify('Error :(', 'error', 0)" bg-color="error") Permanent error
9
+    //- w-flex.my12(align-center wrap)
10
+    //-     w-spinner(bounce)
11
+    //-     w-input Label
12
+    //-     w-checkbox Single option
13
+    //- w-flex.my12
14
+    //-     w-button(@click="openDrawer = true" outline="")
15
+    //-         | Open drawer
16
+    //- w-flex.my12(grow column)
17
+    //-     w-slider(:model-value="40" thumb-label step-label :step="20" color="primary-light3").mt12
18
+    //-     .mt4 v-model:
19
+    //-         code.ml1 {{ sliderVal }}
20
+    //- w-flex.my12(:gap="3" align-center wrap)
21
+    //-     | Show menu on:
22
+    //-     w-menu
23
+    //-         template(#activator="{ on }")
24
+    //-             w-button(v-on="on") Show menu
25
+    //-         | Menu content
26
+    //-     w-badge.mr10(bg-color="error")
27
+    //-         template(#badge) 3
28
+    //-         w-icon(color="grey-light1" size="2.5em") mdi mdi-email
29
     SideBar(
29
     SideBar(
30
         v-if="showSidebar"
30
         v-if="showSidebar"
31
         :pid="getPid"
31
         :pid="getPid"

+ 1
- 1
frontend/src/components/Messages.vue Ver fichero

7
         :key='profile.profile_id' 
7
         :key='profile.profile_id' 
8
         :class="[pid == profile.profile_id ? 'active' : '', 'sidebar__message', 'f-col', 'start']"
8
         :class="[pid == profile.profile_id ? 'active' : '', 'sidebar__message', 'f-col', 'start']"
9
     )
9
     )
10
-    img(:src='profile.avatar')
10
+    img(:src='profile.avatar' style="max-height:100px")
11
     .message__right
11
     .message__right
12
         h4.message__name {{ profile.name }}
12
         h4.message__name {{ profile.name }}
13
         p.message__content {{ profile.metadata.rawMetadata || &quot;Hello I&apos;m using tinder!&quot; }}
13
         p.message__content {{ profile.metadata.rawMetadata || &quot;Hello I&apos;m using tinder!&quot; }}

+ 2
- 2
frontend/src/main.js Ver fichero

28
 
28
 
29
 const run = entry => {
29
 const run = entry => {
30
     const siimee = createApp(App)
30
     const siimee = createApp(App)
31
-    siimee.use(WaveUI, { components })
32
-    new WaveUI(siimee)
31
+    // siimee.use(WaveUI, { components })
32
+    // new WaveUI(siimee)
33
 
33
 
34
     siimee.use(router)
34
     siimee.use(router)
35
     siimee.component('MainNav', MainNav)
35
     siimee.component('MainNav', MainNav)

+ 1
- 0
frontend/src/utils/mixins.js Ver fichero

11
 const cardMixin = {
11
 const cardMixin = {
12
     data: () => ({
12
     data: () => ({
13
         cards: [],
13
         cards: [],
14
+        matches: [],
14
         loading: true,
15
         loading: true,
15
     }),
16
     }),
16
     watch: {
17
     watch: {

+ 32
- 8
frontend/src/views/HomeView.vue Ver fichero

1
 <template lang="pug">
1
 <template lang="pug">
2
-main.view--home
3
-    header
4
-        h2 home - profile: {{ pid }}
5
-        
6
-    article(v-if="cards.length && !loading")
7
-        ProfileCardList(:profiles="cards" :pid="pid" @reload="getCards")
2
+main(class="view--home"  style="display:flex; flex-direction:row; gap: 40px")
3
+    div
4
+        header
5
+            h2 home - profile: {{ pid }}
6
+  
7
+        article(v-if="cards.length && !loading")
8
+            ProfileCardList(:profiles="cards" :pid="pid" @reload="getCards")
9
+  
10
+        p(v-else) Loading...
8
 
11
 
12
+    MainNav(@show-sidebar="$emit('show-sidebar')")
13
+
14
+    article(v-if="matches.length && !loading")
15
+        ProfileCardList(:profiles="matches" :pid="pid" @reload="getCards")
16
+    
17
+    p(v-else-if="matches.length===0") No matches.
9
     p(v-else) Loading...
18
     p(v-else) Loading...
10
 
19
 
11
-    MainNav(@show-sidebar="$emit('show-sidebar')")
12
 </template>
20
 </template>
13
 
21
 
14
 <script>
22
 <script>
15
 import ProfileCardList from '../components/ProfileCardList.vue'
23
 import ProfileCardList from '../components/ProfileCardList.vue'
16
 
24
 
17
 import { Card } from '../entities'
25
 import { Card } from '../entities'
18
-import { fetchQueueByProfileId } from '../services'
26
+import { fetchQueueByProfileId, fetchMembershipsByProfileId } from '../services'
19
 import { mixins } from '../utils'
27
 import { mixins } from '../utils'
20
 
28
 
21
 /** Callback used to format incoming into card */
29
 /** Callback used to format incoming into card */
33
     })
41
     })
34
 }
42
 }
35
 
43
 
44
+const converGroupingToCard = grouping => {
45
+    if (grouping.type !== 'grouping') {
46
+        console.error(`Cannot convert ${grouping} to Card. Invalid entity.`)
47
+    }
48
+    if (!grouping.profile.isValid()) {
49
+        console.warn(`Profile in ${grouping} is not a valid profile.`)
50
+    }
51
+    return new Card({
52
+        pid: grouping.profile.profile_id,
53
+        name: grouping.profile.user_name,
54
+        avatar: grouping.profile.profile_media[0],
55
+    })
56
+}
57
+
36
 export default {
58
 export default {
37
     name: 'HomeView',
59
     name: 'HomeView',
38
     components: { ProfileCardList },
60
     components: { ProfileCardList },
44
             try {
66
             try {
45
                 const queueList = await fetchQueueByProfileId(this.pid)
67
                 const queueList = await fetchQueueByProfileId(this.pid)
46
                 this.cards = this._reformat(queueList, convertToCard)
68
                 this.cards = this._reformat(queueList, convertToCard)
69
+                const matchList = await fetchMembershipsByProfileId(this.pid)
70
+                this.matches = this._reformat(matchList, converGroupingToCard)
47
             } catch (err) {
71
             } catch (err) {
48
                 console.error(err)
72
                 console.error(err)
49
             }
73
             }

Loading…
Cancelar
Guardar