Selaa lähdekoodia

Merge branch 'main-nav' of fyindr/siimee into dev

tags/0.0.1^2
maeda 3 vuotta sitten
vanhempi
commit
4a99f460ee

+ 8276
- 10
backend/package-lock.json
File diff suppressed because it is too large
Näytä tiedosto


+ 5275
- 119
frontend/package-lock.json
File diff suppressed because it is too large
Näytä tiedosto


+ 3
- 8
frontend/src/App.vue Näytä tiedosto

@@ -1,13 +1,8 @@
1 1
 <template lang="pug">
2 2
 w-app
3
-    .nav(v-if="profile.isLoggedIn" style="display: flex; justify-content: space-between;")
4
-        header
5
-            h2 current - profile: {{ profile.id }}
6
-        w-drawer(v-model="openDrawer")
7
-            SideBar(@updatePid="setPid" :pid="profile.id.value")
8
-        w-button(@click="openDrawer = true" outline="")
9
-            | Active Chats
10
-
3
+    w-drawer(v-model="openDrawer")
4
+        SideBar(@updatePid="setPid" :pid="profile.id.value")
5
+        
11 6
     RouterView(
12 7
         v-if="profile.isLoggedIn"
13 8
         :pid="profile.id.value"

+ 1
- 7
frontend/src/components/AspectBar.vue Näytä tiedosto

@@ -11,15 +11,9 @@ export default {
11 11
         labels: {
12 12
             required: true,
13 13
             type: Array,
14
-            default: () => ['left', 'right'],
15 14
         },
16 15
         percentage: {
17
-            required: true,
18
-            type: Number,
19
-            default: 50,
20
-        },
21
-        size: {
22
-            required: true,
16
+            required: false,
23 17
             type: Number,
24 18
             default: 50,
25 19
         },

+ 41
- 8
frontend/src/components/NamePlate.vue Näytä tiedosto

@@ -1,16 +1,49 @@
1 1
 <template lang="pug">
2
-.xs12
3
-    h1.text-capitalize first last
4
-        span O    
5
-    p.text-capitalize job title | location, st    
6
-    p.text-capitalize gender 
7
-        span.text-capitalize | pronouns
8
-        span.text-capitalize | ethnicity    
2
+.name-plate.xs12.w-flex.justify-center
3
+    section(v-if="pid" :class="{ box: !isList }")
4
+        router-link(:to="`/profile/${pid}`")
5
+            h1.text-capitalize {{ name }}
6
+                span O
7
+            p.text-capitalize {{role}}&nbsp;
8
+                span.text-capitalize(v-if="isList") |&nbsp;
9
+                    span.text-capitalize location, st
10
+            p.text-capitalize(v-if="!isList") {{ pronouns }}&nbsp;
11
+                span.text-capitalize | ethnicity
9 12
 </template>
10 13
 
11 14
 <script>
12 15
 export default {
13
-    props: {},
16
+    props: {
17
+        pid: {
18
+            type: Number,
19
+            required: true,
20
+        },
21
+        name: {
22
+            type: Object,
23
+            required: true,
24
+        },
25
+        isList: {
26
+            type: Boolean,
27
+            required: false,
28
+            default: true,
29
+        },
30
+    },
14 31
     data: () => ({}),
15 32
 }
16 33
 </script>
34
+<style lang="sass">
35
+.name-plate
36
+    section
37
+        display: flex
38
+        flex-direction: column
39
+        align-items: center
40
+        justify-content: center
41
+        padding: 15px 15px
42
+        min-height: 10vh
43
+        width: 100%
44
+        &.box
45
+            border: 1px black solid
46
+            height: 15vw
47
+            width: 15vw
48
+            text-align: center
49
+</style>

+ 51
- 0
frontend/src/components/ProfileCard.vue Näytä tiedosto

@@ -0,0 +1,51 @@
1
+<template lang="pug">
2
+w-card.profile-card-list--card.xs12.pa12
3
+    header.xs12.w-flex.column.center
4
+        NamePlate(:pid="card.pid" :name="card.name" :role="card.role" :is-list="isList")
5
+        template(v-if="!isList")
6
+            SummaryBar
7
+            TagList
8
+
9
+    article.xs12.w-flex.column.justify-space-between
10
+        AspectBar(
11
+            v-for="aspect in aspects"
12
+            :labels="aspect.labels"
13
+            :percentage="aspect.percentage"
14
+            :key="aspect.name"
15
+        )
16
+    
17
+    footer(v-if="!isList")
18
+        .pa12
19
+            p {{ bio }}
20
+        PairingButton
21
+</template>
22
+
23
+<script setup>
24
+import { computed } from 'vue'
25
+import NamePlate from './NamePlate.vue'
26
+import AspectBar from './AspectBar.vue'
27
+import SummaryBar from './SummaryBar.vue'
28
+import TagList from './TagList.vue'
29
+import PairingButton from './PairingButton.vue'
30
+
31
+const props = defineProps({
32
+    card: {
33
+        type: Object,
34
+        required: true,
35
+    },
36
+    aspects: {
37
+        type: Array,
38
+        required: true,
39
+    },
40
+    bio: {
41
+        type: String,
42
+        required: false,
43
+        default: null,
44
+    },
45
+    isList: {
46
+        type: Boolean,
47
+        required: false,
48
+        default: true,
49
+    },
50
+})
51
+</script>

+ 30
- 60
frontend/src/components/ProfileCardList.vue Näytä tiedosto

@@ -1,58 +1,50 @@
1 1
 <template lang="pug">
2
-section.profile-card-list(:style="{'display': 'flex', 'overflow':'auto',}")
3
-    .swipe(
4
-        v-if="!isGrid"
5
-        :config="config"
6
-        :key="profile.pid"
7
-        @throwout="swipped(profile)"
8
-        v-for="(profile, i) in loadedProfiles"
9
-        :style="{ 'z-index': 1000-i }"
10
-    )
11
-
12
-        w-card.card.randomize(
13
-            :image="`${profile.avatar}`"
14
-            :style="{'top': `${randomize(10)}px`, 'right': `${randomize(20)}px`, 'transform': `rotate(${randomize(7)}deg)`}"
15
-        )
16
-            .card--content
17
-                p(style="color: magenta;") profile: {{ profile.pid }}
18
-                .card--content--lower
19
-                    h4 {{ profile.name }}
20
-                    nav.swipe_icons
21
-                        //- Accept
22
-                        button(@click="accept(profile.pid)") Accept
23
-                        button(@click="view(profile.pid)") view
24
-                        //- Pass
25
-                        button(@click="pass(profile.pid)") Pass
2
+section.profile-card-list.xs12.w-flex.column
3
+    header.xs12.w-flex 
4
+        w-select(:items="['one', 'two', 'three']" outline) Label
26 5
     
27
-    .match-layout(
28
-        v-else
29
-        v-for="(profile, i) in loadedProfiles"
30
-        :key="`${profile.pid}-${i}`"
31
-    )
32
-        .card.bg-cover(
33
-            :style="{ 'background-image': `url(${profile.avatar})` }"
6
+    article
7
+        ProfileCard.match-layout(
8
+            v-for="(card, i) in cards"
9
+            :key="`${card.pid}-${i}`"
10
+            :card="card" :aspects="aspects" :bio="bio" :is-list="true"
34 11
         )
35
-            .card--content
36
-                p(style="color: magenta;") profile: {{ profile.pid }}
37
-                .card--content--lower
38
-                    h4 {{ profile.name }}
39
-                    nav.swipe_icons
40
-                        button(@click="view(profile.pid)") view
41 12
 </template>
42 13
 
43 14
 <script setup>
15
+import { ref } from 'vue'
44 16
 import { useRouter } from 'vue-router'
45 17
 import {
46 18
     updateQueueByProfileId,
47 19
     postMembershipByProfileId,
48 20
     currentProfile,
49 21
 } from '../services'
22
+import ProfileCard from './ProfileCard.vue'
23
+
24
+class Aspect {
25
+    constructor({ name, labels, percentage = 50 }) {
26
+        this.name = name
27
+        this.labels = labels
28
+        this.percentage = percentage
29
+    }
30
+}
31
+const aspects = ref([
32
+    new Aspect({ name: 'creativity', labels: ['creative', 'methodical'] }),
33
+    new Aspect({ name: 'dynamism', labels: ['dynamic', 'ordered'] }),
34
+    new Aspect({ name: 'precision', labels: ['precise', 'resourceful'] }),
35
+    new Aspect({ name: 'vision', labels: ['visionary', 'implementer'] }),
36
+    new Aspect({ name: 'focus', labels: ['big picture', 'focused'] }),
37
+    new Aspect({ name: 'attention', labels: ['guided', 'self-managed'] }),
38
+])
39
+const bio = ref(
40
+    'this is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long description',
41
+)
50 42
 
51 43
 const router = useRouter()
52 44
 const emit = defineEmits(['reload'])
53 45
 
54 46
 const props = defineProps({
55
-    profiles: {
47
+    cards: {
56 48
         type: [Object, Array],
57 49
         default: () => [
58 50
             {
@@ -72,18 +64,6 @@ const props = defineProps({
72 64
     },
73 65
 })
74 66
 
75
-const swipped = profile => {
76
-    const index = loadedProfiles.findIndex(u => u.pid == profile.pid)
77
-    loadedProfiles.splice(index, 1)
78
-    profile.id = Date.now() + (Math.random() * 100000).toFixed()
79
-    loadedProfiles.unshift({ ...profile })
80
-}
81
-
82
-const randomize = max => {
83
-    const pos = Math.random() > 0.5 ? -1 : 1
84
-    return Math.floor(Math.random() * max) * pos
85
-}
86
-
87 67
 // AHP Button behavior
88 68
 const accept = async targetId => {
89 69
     if (targetId == props.pid) return
@@ -133,14 +113,4 @@ const pass = targetId => {
133 113
     updateQueueByProfileId(props.pid, targetId, true)
134 114
     emit('reload')
135 115
 }
136
-
137
-// from the data() section
138
-const config = {
139
-    // allowedDirections: [VueSwing.Direction.LEFT, VueSwing.Direction.RIGHT],
140
-    minThrowOutDistance: 250,
141
-    maxThrowOutDistance: 300,
142
-}
143
-
144
-// Copy profiles so we don't mutate the original
145
-const loadedProfiles = [...props.profiles]
146 116
 </script>

+ 9
- 8
frontend/src/components/SummaryBar.vue Näytä tiedosto

@@ -1,12 +1,13 @@
1 1
 <template lang="pug">
2
-nav.xs12
3
-    ul.xs12.w-flex.row
4
-        li(v-if="showAbout") about
5
-        li(v-for="[label, percentage] in summary" :key="label").w-flex.row
6
-            w-icon(xl).mr1 mdi mdi-heart
7
-            .w-flex.column.justify-start
8
-                p {{ percentage }}%
9
-                p.text-capitalize {{ label }}
2
+section.w-flex.column.pb5
3
+    nav.xs12
4
+        ul.xs12.w-flex.row
5
+            li(v-if="showAbout") about
6
+            li(v-for="[label, percentage] in summary" :key="label").w-flex.row
7
+                w-icon(xl).mr1 mdi mdi-heart
8
+                .w-flex.column.justify-start
9
+                    p {{ percentage }}%
10
+                    p.text-capitalize {{ label }}
10 11
 </template>
11 12
 
12 13
 <script>

+ 9
- 4
frontend/src/components/TagList.vue Näytä tiedosto

@@ -1,7 +1,8 @@
1 1
 <template lang="pug">
2
-w-tag(v-for="tag in tags" color="pink-light1" bg-color="pink-light5")
3
-    w-icon(v-if="icon" class="mr1" sm) {{ icon.family }} {{ icon.family }}-{{ icon.shape }}
4
-    p {{ tag }}
2
+section.w-flex.row.pb5
3
+    w-tag(v-for="tag in tags" color="pink-light1" bg-color="pink-light5").w-flex.grow.mr12.pa12
4
+        w-icon(v-if="icon" class="mr1" sm) {{ icon.family }} {{ icon.family }}-{{ icon.shape }}
5
+        p {{ tag }}
5 6
 </template>
6 7
 
7 8
 <script>
@@ -10,7 +11,11 @@ export default {
10 11
         tags: {
11 12
             required: true,
12 13
             type: Array,
13
-            default: () => ['tag', 'tag', 'tag'],
14
+            default: () => [
15
+                'tag one',
16
+                'tag another thing',
17
+                'tag something long',
18
+            ],
14 19
         },
15 20
         icon: {
16 21
             type: Object,

+ 75
- 12
frontend/src/entities/card/card.js Näytä tiedosto

@@ -1,21 +1,84 @@
1
-/** @module entities/card */
1
+/** @module card/card */
2 2
 
3
-/** Class representing a card */
3
+class Aspect {
4
+    constructor({ name, labels, percentage = 50 }) {
5
+        this.name = name
6
+        this.labels = labels
7
+        this.percentage = percentage
8
+    }
9
+}
10
+
11
+/**
12
+ * Class representing a profile card
13
+ * NOT to be confused with a profile
14
+ * this should be treated as a profile
15
+ * card facade
16
+ */
4 17
 class Card {
5
-    /**
6
-     * Create the a card object.
7
-     * @param {number} pid
8
-     * @param {string} name
9
-     * @param {string} avatar
10
-     * @return {Card} the card instance object
11
-     */
12
-    constructor({ pid, name, avatar }) {
18
+    constructor({ pid, name, role }) {
13 19
         this.pid = pid
20
+
21
+        /**  Fields */
14 22
         this.name = name
15
-        this.avatar = avatar
23
+
24
+        this.role = role ? role : null
25
+
26
+        this.presence = null
27
+        this.urgency = null
28
+        this.pronouns = null
29
+        this.ethinicity = null
30
+        this.locale = null
31
+        this.email = null
32
+
33
+        this.images = []
34
+        this.tags = []
35
+
36
+        this.bio = null
37
+        this.aspects = [
38
+            new Aspect({
39
+                name: 'creativity',
40
+                labels: ['creative', 'methodical'],
41
+            }),
42
+            new Aspect({
43
+                name: 'dynamism',
44
+                labels: ['dynamic', 'ordered'],
45
+            }),
46
+            new Aspect({
47
+                name: 'precision',
48
+                labels: ['precise', 'resourceful'],
49
+            }),
50
+            new Aspect({
51
+                name: 'vision',
52
+                labels: ['visionary', 'implementer'],
53
+            }),
54
+            new Aspect({
55
+                name: 'focus',
56
+                labels: ['big picture', 'focused'],
57
+            }),
58
+            new Aspect({
59
+                name: 'attention',
60
+                labels: ['guided', 'self-managed'],
61
+            }),
62
+        ]
16 63
 
17 64
         return this
18 65
     }
19 66
 }
20 67
 
21
-export { Card }
68
+const makeCardFromProfile = profile => {
69
+    const c = new Card({
70
+        pid: profile.profile_id,
71
+        name: profile.user_name,
72
+        role: profile?.profile_prefs?.role?.val,
73
+    })
74
+
75
+    c.presence = profile?.profile_prefs?.presence?.val
76
+    c.urgency = profile?.profile_prefs?.urgency?.val
77
+    c.pronouns = profile?.profile_prefs?.pronouns?.val
78
+    c.ethinicity = profile?.profile_prefs?.ethnicity?.val
79
+    c.locale = `${profile.city}, ${profile.state}`
80
+    c.email = profile.user_email
81
+    c.bio = profile.profile_description
82
+    return c
83
+}
84
+export { Card, makeCardFromProfile }

+ 3
- 3
frontend/src/services/chat.service.js Näytä tiedosto

@@ -21,6 +21,7 @@ const providerMethods = {
21 21
 const setupPubnub = async uuid => {
22 22
     const publishKey = import.meta.env.VITE_PUBNUB_PUBLISH_KEY
23 23
     const subscribeKey = import.meta.env.VITE_PUBNUB_SUBSCRIBE_KEY
24
+
24 25
     if (!uuid) return console.error('no pubnub uuid set')
25 26
 
26 27
     const pubnubClient = await new PubNub({
@@ -80,8 +81,8 @@ class Chatter {
80 81
         this.uuid = `${uuid}`
81 82
         this.provider = await setupPubnub(this.uuid)
82 83
 
83
-        //  step 1: build the this.groupings object from the backend
84
-        // ? .await for the groupings to be fetched before subscribing to channels
84
+        //  step_1: build the this.groupings object from the backend
85
+        //  await for the groupings to be fetched before subscribing to channels
85 86
         await this._setupAllChannels(groupings)
86 87
         this._listenFor({ listeners: this.listeners })
87 88
         this.subscribe({ channels: this.subscriptions })
@@ -96,7 +97,6 @@ class Chatter {
96 97
      * @return {object} timestamp
97 98
      */
98 99
     async publish(channel, message) {
99
-        // console.log('publishing message to channel:', channel)
100 100
         return providerMethods.publish({
101 101
             channel,
102 102
             message: new ChatMessage(message),

+ 22
- 21
frontend/src/utils/index.js Näytä tiedosto

@@ -22,6 +22,7 @@ const makeKebob = input => {
22 22
 
23 23
 const surveyFactory = new SurveyFactory(possible['usa'])
24 24
 
25
+
25 26
 const mixins = { pidMixin, cardMixin }
26 27
 
27 28
 
@@ -74,31 +75,31 @@ const randomMedia = () => {
74 75
 
75 76
 const randomSurveyResponses = count => {
76 77
     const surveyResponses = [
77
-        { id: null ,"idOrPrompt": "email", "val": `${randomEmail()}` },
78
-        { id: null ,"idOrPrompt": "name", "val": `john test-${count}` },
79
-        { id: 99 ,"idOrPrompt": 15, "val": randomValFrom(possible.usa.pronouns) },
80
-        { id: null ,"idOrPrompt": "seeking", "val": Math.random() > 0.2 ? possible.usa.seeking[0] : possible.usa.seeking[1] },
81
-        { id: 99 ,"idOrPrompt": 13, "val": randomValFrom(possible.usa.urgency) },
82
-        { id: null ,"idOrPrompt": "experience", "val": randomValFrom(possible.usa.experience) },
83
-        { id: 99 ,"idOrPrompt": 14, "val": "swe" },
84
-        { id: 99 ,"idOrPrompt": 10, "val": randomValFrom(possible.usa.duration) },
85
-        { id: 99 ,"idOrPrompt": 9, "val": randomValFrom(possible.usa.language) },
86
-        { id: 99 ,"idOrPrompt": 11, "val": randomValFrom(possible.usa.presence) },
87
-        { id: 99 ,"idOrPrompt": 7, "val": `${randomValFrom(possibleZipcodes)}` },
88
-        { id: 99 ,"idOrPrompt": 16, "val": `${randomNumber(55)}` },
89
-        { id: 99 ,"idOrPrompt": 12, "val": "this is a test of the survey signup" },
90
-        { id: 99 ,"idOrPrompt": 8, "val": randomMedia() },
91
-        { id: 99 ,"idOrPrompt": 1, "val": `${randomNumber(3) - randomNumber(3)}` },
92
-        { id: 99 ,"idOrPrompt": 2, "val": `${randomNumber(3) - randomNumber(3)}` },
93
-        { id: 99 ,"idOrPrompt": 3, "val": `${randomNumber(3) - randomNumber(3)}` },
94
-        { id: 99 ,"idOrPrompt": 4, "val": `${randomNumber(3) - randomNumber(3)}` },
95
-        { id: 99 ,"idOrPrompt": 5, "val": `${randomNumber(3) - randomNumber(3)}` },
96
-        { id: 99 ,"idOrPrompt": 6, "val": `${randomNumber(3) - randomNumber(3)}` }
78
+        { id: null, "idOrPrompt": "email", "val": `${randomEmail()}` },
79
+        { id: null, "idOrPrompt": "name", "val": `john test-${count}` },
80
+        { id: 99, "idOrPrompt": 15, "val": randomValFrom(possible.usa.pronouns) },
81
+        { id: null, "idOrPrompt": "seeking", "val": Math.random() > 0.2 ? possible.usa.seeking[0] : possible.usa.seeking[1] },
82
+        { id: 99, "idOrPrompt": 13, "val": randomValFrom(possible.usa.urgency) },
83
+        { id: null, "idOrPrompt": "experience", "val": randomValFrom(possible.usa.experience) },
84
+        { id: 99, "idOrPrompt": 14, "val": "swe" },
85
+        { id: 99, "idOrPrompt": 10, "val": randomValFrom(possible.usa.duration) },
86
+        { id: 99, "idOrPrompt": 9, "val": randomValFrom(possible.usa.language) },
87
+        { id: 99, "idOrPrompt": 11, "val": randomValFrom(possible.usa.presence) },
88
+        { id: 99, "idOrPrompt": 7, "val": `${randomValFrom(possibleZipcodes)}` },
89
+        { id: 99, "idOrPrompt": 16, "val": `${randomNumber(55)}` },
90
+        { id: 99, "idOrPrompt": 12, "val": "this is a test of the survey signup" },
91
+        { id: 99, "idOrPrompt": 8, "val": randomMedia() },
92
+        { id: 99, "idOrPrompt": 1, "val": `${randomNumber(3) - randomNumber(3)}` },
93
+        { id: 99, "idOrPrompt": 2, "val": `${randomNumber(3) - randomNumber(3)}` },
94
+        { id: 99, "idOrPrompt": 3, "val": `${randomNumber(3) - randomNumber(3)}` },
95
+        { id: 99, "idOrPrompt": 4, "val": `${randomNumber(3) - randomNumber(3)}` },
96
+        { id: 99, "idOrPrompt": 5, "val": `${randomNumber(3) - randomNumber(3)}` },
97
+        { id: 99, "idOrPrompt": 6, "val": `${randomNumber(3) - randomNumber(3)}` }
97 98
     ]
98 99
     return surveyResponses
99 100
 }
100 101
 
101
-export { 
102
+export {
102 103
     api,
103 104
     validatorMapping,
104 105
     surveyFactory,

+ 33
- 12
frontend/src/views/HomeView.vue Näytä tiedosto

@@ -1,20 +1,39 @@
1 1
 <template lang="pug">
2
-main.view--home(
3
-    style='display: flex; flex-direction: column; gap: 40px; margin-top: 1em'
4
-)
5
-    header
6
-        SummaryBar
7
-        TagList(:icon="{ family: 'mdi', shape: 'heart' }")
8
-        AspectBar
9
-        PairingButton
10
-        h2 Match Queue
11
-
2
+main.view--home
3
+    
12 4
     article(v-if='cards.length && !loading')
13
-        ProfileCardList(:pid='pid' :profiles='cards' @reload='getCards')
5
+        ProfileCardList(:pid='pid' :cards='cards' @reload='getCards')
14 6
 
15 7
     p(v-else-if='cards.length === 0') No profiles in match_queue.
16 8
     p(v-else) Loading...
17 9
 
10
+    footer
11
+        w-form
12
+            w-input.mb2(
13
+                inner-icon-left='mdi mdi-account'
14
+                label='Full Name'
15
+                label-position='inside'
16
+                outline
17
+            )
18
+            w-input.mb2(
19
+                inner-icon-left='mdi mdi-mail'
20
+                label='E-mail'
21
+                label-position='inside'
22
+                outline
23
+            )
24
+            w-input.mb2(
25
+                inner-icon-left='mdi mdi-lock'
26
+                label='Password'
27
+                label-position='inside'
28
+                outline
29
+                type='password'
30
+            )
31
+
32
+        SummaryBar
33
+        TagList(:icon='{ family: "mdi", shape: "heart" }')
34
+        AspectBar
35
+        PairingButton
36
+
18 37
     MainNav
19 38
 </template>
20 39
 
@@ -27,6 +46,7 @@ import SummaryBar from '../components/SummaryBar.vue'
27 46
 import PairingButton from '../components/PairingButton.vue'
28 47
 
29 48
 import { Card } from '../entities'
49
+
30 50
 import {
31 51
     fetchQueueByProfileId,
32 52
     fetchMembershipsByProfileId,
@@ -88,9 +108,10 @@ export default {
88 108
             this.loading = false
89 109
         },
90 110
         // this can be placed in utils/notification.js
111
+
91 112
         notify(payload) {
92 113
             this.$waveui.notify({
93
-                message: payload.timetoken,
114
+                message: payload,
94 115
                 timeout: 6000,
95 116
                 bgColor: 'white',
96 117
                 color: 'success',

+ 1
- 18
frontend/src/views/MatchesView.vue Näytä tiedosto

@@ -15,25 +15,9 @@ main.view--matches.f-col.start.w-full
15 15
 <script>
16 16
 import ProfileCardList from '../components/ProfileCardList.vue'
17 17
 
18
-import { Card } from '../entities'
19 18
 import { fetchMembershipsByProfileId } from '../services'
20 19
 import { mixins } from '../utils'
21 20
 
22
-/** Callback used to format incoming into card */
23
-const convertToCard = grouping => {
24
-    if (grouping.type !== 'grouping') {
25
-        console.error(`Cannot convert ${grouping} to Card. Invalid entity.`)
26
-    }
27
-    if (!grouping.profile.isValid()) {
28
-        console.warn(`Profile in ${grouping} is not a valid profile.`)
29
-    }
30
-    return new Card({
31
-        pid: grouping.profile.profile_id,
32
-        name: grouping.profile.user_name,
33
-        avatar: grouping.profile.profile_media[0],
34
-    })
35
-}
36
-
37 21
 export default {
38 22
     name: 'MatchView',
39 23
     components: { ProfileCardList },
@@ -43,8 +27,7 @@ export default {
43 27
         async getCards() {
44 28
             this.loading = true
45 29
             try {
46
-                const matchList = await fetchMembershipsByProfileId(this.pid)
47
-                this.cards = this._reformat(matchList, convertToCard)
30
+                this.cards = await fetchMembershipsByProfileId(this.pid)
48 31
             } catch (err) {
49 32
                 console.error(err)
50 33
             }

+ 39
- 25
frontend/src/views/ProfileView.vue Näytä tiedosto

@@ -1,37 +1,43 @@
1 1
 <template lang="pug">
2
-main.view--profile.f-col.start.w-full
2
+main.view--profile
3 3
     header 
4
-        h2 Profile Page
4
+        button(@click='$router.go(-1)') back
5 5
 
6 6
     article(v-if='!loading')
7
-        h3 name: {{ profile.user_name }}
8
-            span(v-if='profile.profile_prefs?.pronouns') &nbsp;({{ profile.profile_prefs?.pronouns.val }})
9
-        p(v-if='profile.user_email') {{ profile.user_email }}
7
+        ProfileCard(
8
+            :aspects='card.aspects'
9
+            :bio='card.bio'
10
+            :is-list='false'
11
+            :card='card'
12
+        )
13
+        //- h3 name: {{ profile.user_name }}
14
+        //-     span(v-if='profile.profile_prefs?.pronouns') &nbsp;({{ profile.profile_prefs?.pronouns.val }})
15
+        //- p(v-if='profile.user_email') {{ profile.user_email }}
10 16
 
11
-        p I am looking for a&nbsp;
12
-            span {{ profile.profile_prefs?.presence?.val }}&nbsp;
13
-            span {{ profile.profile_prefs?.role?.val }}&nbsp;
14
-            span role&nbsp;
15
-            span no further than {{ profile.profile_prefs?.distance?.val }} miles away&nbsp;
16
-            span from {{ profile.profile_prefs?.zipcode?.val }}
17
+        //- p I am looking for a&nbsp;
18
+        //-     span {{ profile.profile_prefs?.presence?.val }}&nbsp;
19
+        //-     span {{ profile.profile_prefs?.role?.val }}&nbsp;
20
+        //-     span role&nbsp;
21
+        //-     span no further than {{ profile.profile_prefs?.distance?.val }} miles away&nbsp;
22
+        //-     span from {{ profile.profile_prefs?.zipcode?.val }}
17 23
 
18
-        p I am {{ profile.profile_prefs?.urgency?.val.split('_').join(' ') }}.
24
+        //- p I am {{ profile.profile_prefs?.urgency?.val.split('_').join(' ') }}.
19 25
 
20
-        img(
21
-            :src='profile.profile_media[0]'
22
-            alt='profile-avatar'
23
-            style='max-height: 200px; width: auto'
24
-            v-if='profile.reveal.map(t => t.description).includes("image")'
25
-        )
26
-        h3(v-else) image not revealed
26
+        //- img(
27
+        //-     :src='profile.profile_media[0]'
28
+        //-     alt='profile-avatar'
29
+        //-     style='max-height: 200px; width: auto'
30
+        //-     v-if='profile.reveal.map(t => t.description).includes("image")'
31
+        //- )
32
+        //- h3(v-else) image not revealed
27 33
 
28
-        p About: {{ profile.profile_description }}
34
+        //- p About: {{ profile.profile_description }}
29 35
 
30
-        p reveal: {{ profile.reveal.map(t => t.description) }}
31
-        p tags: {{ profile.tags.map(t => t.description) }}
32
-        p images: {{ profile.profile_media }}
33
-        p responses: {{ profile.responses.length }}
34
-        button(@click='$router.go(-1)') back
36
+        //- p reveal: {{ profile.reveal.map(t => t.description) }}
37
+        //- p tags: {{ profile.tags.map(t => t.description) }}
38
+        //- p images: {{ profile.profile_media }}
39
+        //- p responses: {{ profile.responses.length }}
40
+        //- button(@click='$router.go(-1)') back
35 41
 
36 42
     p(v-else) Loading...
37 43
 
@@ -39,13 +45,17 @@ main.view--profile.f-col.start.w-full
39 45
 </template>
40 46
 
41 47
 <script>
48
+import ProfileCard from '../components/ProfileCard.vue'
42 49
 import { fetchProfileByProfileId } from '../services'
50
+import { makeCardFromProfile } from '../entities'
43 51
 
44 52
 export default {
45 53
     name: 'ProfileView',
54
+    components: { ProfileCard },
46 55
     data: () => ({
47 56
         loading: true,
48 57
         profile: {},
58
+        card: {},
49 59
     }),
50 60
     created() {
51 61
         this.getProfile()
@@ -60,6 +70,10 @@ export default {
60 70
             } catch (err) {
61 71
                 console.error(err)
62 72
             }
73
+            this.card = makeCardFromProfile(this.profile)
74
+            this.card.bio = this.profile.profile_description
75
+                ? this.profile.profile_description
76
+                : 'this is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long descriptionthis is a long description'
63 77
             this.loading = false
64 78
         },
65 79
     },

+ 4
- 0
frontend/src/wave.js Näytä tiedosto

@@ -10,12 +10,14 @@ import {
10 10
     WCheckbox,
11 11
     WDrawer,
12 12
     WFlex,
13
+    WForm,
13 14
     WIcon,
14 15
     WImage,
15 16
     WInput,
16 17
     WMenu,
17 18
     WProgress,
18 19
     WOverlay,
20
+    WSelect,
19 21
     WSlider,
20 22
     WSpinner,
21 23
     WSteps,
@@ -32,12 +34,14 @@ export default {
32 34
     WCheckbox,
33 35
     WDrawer,
34 36
     WFlex,
37
+    WForm,
35 38
     WIcon,
36 39
     WImage,
37 40
     WInput,
38 41
     WMenu,
39 42
     WProgress,
40 43
     WOverlay,
44
+    WSelect,
41 45
     WSlider,
42 46
     WSpinner,
43 47
     WSteps,

Loading…
Peruuta
Tallenna