ソースを参照

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

tags/0.0.1^2
juancarbajal98 3年前
コミット
fdb56858d5

+ 2
- 1
backend/knexfile.js ファイルの表示

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

+ 14507
- 6241
backend/package-lock.json
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 4
- 2
backend/server/manifest.js ファイルの表示

@@ -1,4 +1,5 @@
1
-const Dotenv = require('dotenv')
1
+const Dotenv = require('dotenv').config({path: './server/.env'})
2
+// const Dotenv = require('dotenv')
2 3
 const Confidence = require('@hapipal/confidence')
3 4
 const Inert = require('@hapi/inert')
4 5
 const Vision = require('@hapi/vision')
@@ -6,7 +7,8 @@ const Schwifty = require('@hapipal/schwifty')
6 7
 const HapiSwagger = require('hapi-swagger')
7 8
 
8 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 13
 /** Glue manifest as a confidence store */
12 14
 module.exports = new Confidence.Store({

+ 7742
- 862
frontend/package-lock.json
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 27
- 27
frontend/src/App.vue ファイルの表示

@@ -1,31 +1,31 @@
1 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 29
     SideBar(
30 30
         v-if="showSidebar"
31 31
         :pid="getPid"

+ 1
- 1
frontend/src/components/Messages.vue ファイルの表示

@@ -7,7 +7,7 @@
7 7
         :key='profile.profile_id' 
8 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 11
     .message__right
12 12
         h4.message__name {{ profile.name }}
13 13
         p.message__content {{ profile.metadata.rawMetadata || &quot;Hello I&apos;m using tinder!&quot; }}

+ 2
- 2
frontend/src/main.js ファイルの表示

@@ -28,8 +28,8 @@ router.beforeEach((to, from, next) => {
28 28
 
29 29
 const run = entry => {
30 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 34
     siimee.use(router)
35 35
     siimee.component('MainNav', MainNav)

+ 1
- 0
frontend/src/utils/mixins.js ファイルの表示

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

+ 32
- 8
frontend/src/views/HomeView.vue ファイルの表示

@@ -1,21 +1,29 @@
1 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 18
     p(v-else) Loading...
10 19
 
11
-    MainNav(@show-sidebar="$emit('show-sidebar')")
12 20
 </template>
13 21
 
14 22
 <script>
15 23
 import ProfileCardList from '../components/ProfileCardList.vue'
16 24
 
17 25
 import { Card } from '../entities'
18
-import { fetchQueueByProfileId } from '../services'
26
+import { fetchQueueByProfileId, fetchMembershipsByProfileId } from '../services'
19 27
 import { mixins } from '../utils'
20 28
 
21 29
 /** Callback used to format incoming into card */
@@ -33,6 +41,20 @@ const convertToCard = profile => {
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 58
 export default {
37 59
     name: 'HomeView',
38 60
     components: { ProfileCardList },
@@ -44,6 +66,8 @@ export default {
44 66
             try {
45 67
                 const queueList = await fetchQueueByProfileId(this.pid)
46 68
                 this.cards = this._reformat(queueList, convertToCard)
69
+                const matchList = await fetchMembershipsByProfileId(this.pid)
70
+                this.matches = this._reformat(matchList, converGroupingToCard)
47 71
             } catch (err) {
48 72
                 console.error(err)
49 73
             }

読み込み中…
キャンセル
保存