Переглянути джерело

Merge branch 'summary-tab' of fyindr/siimee into dev

tags/0.0.1^2
maeda 3 роки тому
джерело
коміт
59474c7766

+ 2
- 2
frontend/src/App.vue Переглянути файл

@@ -21,8 +21,8 @@ import TopNav from './components/TopNav.vue'
21 21
 import { currentProfile } from './services'
22 22
 import { surveyFactory } from './utils'
23 23
 
24
-// const DEV_MODE = import.meta.env.VITE_DEV == 'true'
25
-const DEV_MODE = false
24
+const DEV_MODE = import.meta.env.VITE_DEV == 'true'
25
+// const DEV_MODE = false
26 26
 const DEV_PID = 45
27 27
 
28 28
 export default {

+ 6
- 2
frontend/src/components/NamePlate.vue Переглянути файл

@@ -1,7 +1,7 @@
1 1
 <template lang="pug">
2 2
 .name-plate.xs12.w-flex.justify-center
3 3
     section(v-if="pid" :class="{ box: !isList }")
4
-        router-link(:to="`/profile/${pid}`")
4
+        router-link(:to="`/profile/${pid}`" disabled)
5 5
             h1.text-capitalize {{ name }}
6 6
                 span O
7 7
             p.text-capitalize {{role}}&nbsp;
@@ -19,7 +19,11 @@ export default {
19 19
             required: true,
20 20
         },
21 21
         name: {
22
-            type: Object,
22
+            type: String,
23
+            required: true,
24
+        },
25
+        pronouns: {
26
+            type: String,
23 27
             required: true,
24 28
         },
25 29
         isList: {

+ 2
- 2
frontend/src/components/PairingButton.vue Переглянути файл

@@ -1,6 +1,6 @@
1 1
 <template lang="pug">
2
-w-tag(color="mint-green" bg-color="red" xl).xs12.mt4.mb4
3
-    p.pa4.text-upper paired    
2
+w-tag(color="mint-green" bg-color="green" xl).xs12.mt4.mb4
3
+    p.pa4.text-upper pair pending
4 4
 </template>
5 5
 
6 6
 <script>

+ 19
- 11
frontend/src/components/ProfileCard.vue Переглянути файл

@@ -1,11 +1,24 @@
1 1
 <template lang="pug">
2 2
 w-card.profile-card-list--card.xs12.pa12
3 3
     header.xs12.w-flex.column.center
4
-        NamePlate(:pid="card.pid" :name="card.name" :role="card.role" :is-list="isList" :is-paired="isPaired")
5
-        h1(v-if="isPaired && !isList") some other field
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"
11
+        )
12
+        
13
+        w-button.text-upper.xs12.pa6(v-if="isPaired && !isList")
14
+            w-icon(xl).mr1 mdi mdi-heart
15
+            | start chat
6 16
         
7 17
         template(v-if="!isList")
8
-            SummaryBar(:is-paired="isPaired" :show-about="isPaired")
18
+            SummaryBar(
19
+                :is-tab="isPaired"
20
+                :tab-content="card.summary"
21
+            )
9 22
             TagList(v-if="!isPaired || isList")
10 23
 
11 24
     article.xs12.w-flex.column.justify-space-between
@@ -17,9 +30,9 @@ w-card.profile-card-list--card.xs12.pa12
17 30
             :key="aspect.name"
18 31
         )
19 32
     
20
-    footer(v-if="!isList")
33
+    footer(v-if="!isList && !isPaired")
21 34
         .pa12
22
-            p {{ bio }}
35
+            p {{ card.summary.about.tab }}
23 36
         PairingButton(v-if="!isPaired")
24 37
 </template>
25 38
 
@@ -31,8 +44,8 @@ import SummaryBar from './SummaryBar.vue'
31 44
 import TagList from './TagList.vue'
32 45
 import PairingButton from './PairingButton.vue'
33 46
 
34
-// const isPaired = ref(false)
35 47
 const isPaired = ref(true)
48
+// const isPaired = ref(false)
36 49
 
37 50
 const props = defineProps({
38 51
     card: {
@@ -43,11 +56,6 @@ const props = defineProps({
43 56
         type: Array,
44 57
         required: true,
45 58
     },
46
-    bio: {
47
-        type: String,
48
-        required: false,
49
-        default: null,
50
-    },
51 59
     isList: {
52 60
         type: Boolean,
53 61
         required: false,

+ 3
- 8
frontend/src/components/ProfileCardList.vue Переглянути файл

@@ -7,7 +7,9 @@ section.profile-card-list.xs12.w-flex.column
7 7
         ProfileCard.match-layout(
8 8
             v-for="(card, i) in cards"
9 9
             :key="`${card.pid}-${i}`"
10
-            :card="card" :aspects="aspects" :bio="bio" :is-list="true"
10
+            :card="card"
11
+            :aspects="aspects"
12
+            :is-list="true"
11 13
         )
12 14
 </template>
13 15
 
@@ -36,9 +38,6 @@ const aspects = ref([
36 38
     new Aspect({ name: 'focus', labels: ['big picture', 'focused'] }),
37 39
     new Aspect({ name: 'attention', labels: ['guided', 'self-managed'] }),
38 40
 ])
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
-)
42 41
 
43 42
 const router = useRouter()
44 43
 const emit = defineEmits(['reload'])
@@ -87,10 +86,6 @@ const accept = async targetId => {
87 86
     emit('reload')
88 87
 }
89 88
 
90
-const view = pid => {
91
-    router.push({ path: `/matches/${pid}` })
92
-}
93
-
94 89
 const subscribeToChannel = async channelName => {
95 90
     // create a chatter reference from the current profile
96 91
     const chatter = currentProfile.chatter

+ 43
- 16
frontend/src/components/SummaryBar.vue Переглянути файл

@@ -1,28 +1,56 @@
1 1
 <template lang="pug">
2 2
 section.w-flex.column.pb5
3
-    nav.fill-width.w-flex.row
4
-        h1(v-if="showAbout") about
5
-        ul.xs12.w-flex.row
6
-            li(v-for="[label, percentage] in summary" :key="label").w-flex.row
7
-                w-icon(xl).mr1 mdi mdi-heart
3
+    nav.fill-width.w-flex.column.justify-space-between
4
+
5
+        // Tabbed Layout
6
+        w-tabs(v-if="isTab" :items="Object.keys(tabContent)" center fill-bar)
7
+            template(#item-title="{ item }")
8 8
                 .w-flex.column.justify-start
9
-                    p {{ percentage }}%
10
-                    p.text-capitalize {{ label }}
9
+                    p(v-if="tabContent[item].matchPerc") {{ tabContent[item].matchPerc }}%
10
+                    p(v-else) &nbsp;
11
+                    p {{ item }}
12
+            // About Tab
13
+            template(#item-content.1="{ item }")
14
+                .tab--about
15
+                    p {{ tabContent[item].tab }}
16
+                    br
17
+                    p {{ tabContent[item].tab }}
18
+                    br
19
+                    hr
20
+            
21
+            // Passion Tab
22
+            template(#item-content.2="{ item }")
23
+                .tab--passion
24
+                    p {{ tabContent[item].tab }}
25
+
26
+            // Aspirations Tab
27
+            template(#item-content.3="{ item }")
28
+                .tab--aspirations
29
+                    p {{ tabContent[item].tab }}
30
+
31
+            // Skills Tab
32
+            template(#item-content.4="{ item }")
33
+                .tab--skills
34
+                    p {{ tabContent[item].tab }}
35
+
36
+        // Untabbed Layout
37
+        ul.w-flex.row.justify-space-between(v-else)
38
+            template(v-for="(item, index) in Object.keys(tabContent)" :key="index")
39
+                li.w-flex.row(v-if="item !== 'about'")
40
+                    w-icon(xl).mr1 mdi mdi-heart
41
+                    .w-flex.column.justify-start
42
+                        p {{ tabContent[item].matchPerc }}%
43
+                        p {{ item }}
11 44
 </template>
12 45
 
13 46
 <script>
14 47
 export default {
15 48
     props: {
16
-        summary: {
49
+        tabContent: {
17 50
             required: true,
18
-            type: Array,
19
-            default: () => [
20
-                ['passion', 50],
21
-                ['aspirations', 50],
22
-                ['skills', 50],
23
-            ],
51
+            type: Object,
24 52
         },
25
-        showAbout: {
53
+        isTab: {
26 54
             required: false,
27 55
             type: Boolean,
28 56
             default: false,
@@ -33,6 +61,5 @@ export default {
33 61
             default: true,
34 62
         },
35 63
     },
36
-    data: () => ({}),
37 64
 }
38 65
 </script>

+ 50
- 3
frontend/src/entities/card/card.js Переглянути файл

@@ -1,5 +1,44 @@
1 1
 /** @module card/card */
2 2
 
3
+const DEFAULT_ABOUT =
4
+    'A really really really really really. Really really really really really really really really really really really long bio.'
5
+
6
+class SummaryGroup {
7
+    constructor() {
8
+        this.about = {
9
+            tab: null,
10
+            matchPerc: null,
11
+            disabled: false,
12
+        }
13
+        this.passion = {
14
+            tab: 'This is a passion tab content.',
15
+            matchPerc: 50,
16
+            disabled: false,
17
+        }
18
+        this.aspirations = {
19
+            tab: 'This is a aspirations tab content.',
20
+            matchPerc: 50,
21
+            disabled: false,
22
+        }
23
+        this.skills = {
24
+            tab: 'This is a skils tab content.',
25
+            matchPerc: 50,
26
+            disabled: false,
27
+        }
28
+    }
29
+    updateTab(tab, content) {
30
+        this[tab].tab = content
31
+        return this[tab]
32
+    }
33
+    updateMatch(tab, percentage) {
34
+        this[tab].matchPerc = percentage
35
+        return this[tab]
36
+    }
37
+    toggle(tab) {
38
+        this[tab].disabled = !this[tab].disabled
39
+    }
40
+}
41
+
3 42
 class Aspect {
4 43
     constructor({ name, labels, percentage = 50 }) {
5 44
         this.name = name
@@ -25,7 +64,7 @@ class Card {
25 64
 
26 65
         this.presence = null
27 66
         this.urgency = null
28
-        this.pronouns = null
67
+        this.pronouns = 'she/her/hers'
29 68
         this.ethinicity = null
30 69
         this.locale = null
31 70
         this.email = null
@@ -33,7 +72,8 @@ class Card {
33 72
         this.images = []
34 73
         this.tags = []
35 74
 
36
-        this.bio = null
75
+        this.summary = new SummaryGroup()
76
+
37 77
         this.aspects = [
38 78
             new Aspect({
39 79
                 name: 'creativity',
@@ -75,10 +115,17 @@ const makeCardFromProfile = profile => {
75 115
     c.presence = profile?.profile_prefs?.presence?.val
76 116
     c.urgency = profile?.profile_prefs?.urgency?.val
77 117
     c.pronouns = profile?.profile_prefs?.pronouns?.val
118
+        ? profile?.profile_prefs?.pronouns?.val
119
+        : c.pronouns
78 120
     c.ethinicity = profile?.profile_prefs?.ethnicity?.val
79 121
     c.locale = `${profile.city}, ${profile.state}`
80 122
     c.email = profile.user_email
81
-    c.bio = profile.profile_description
123
+    // TODO: delete me later
124
+    if (profile.profile_description) {
125
+        c.summary.updateTab('about', profile.profile_description)
126
+    } else {
127
+        c.summary.updateTab('about', DEFAULT_ABOUT)
128
+    }
82 129
     return c
83 130
 }
84 131
 export { Card, makeCardFromProfile }

+ 0
- 4
frontend/src/views/ProfileView.vue Переглянути файл

@@ -4,7 +4,6 @@ main.view--profile
4 4
     article(v-if='!loading')
5 5
         ProfileCard(
6 6
             :aspects='card.aspects'
7
-            :bio='card.bio'
8 7
             :is-list='false'
9 8
             :card='card'
10 9
         )
@@ -40,9 +39,6 @@ export default {
40 39
                 console.error(err)
41 40
             }
42 41
             this.card = makeCardFromProfile(this.profile)
43
-            this.card.bio = this.profile.profile_description
44
-                ? this.profile.profile_description
45
-                : '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'
46 42
             this.loading = false
47 43
         },
48 44
     },

+ 2
- 0
frontend/src/wave.js Переглянути файл

@@ -18,6 +18,7 @@ import {
18 18
     WMenu,
19 19
     WProgress,
20 20
     WOverlay,
21
+    WTabs,
21 22
     WRadio,
22 23
     WRadios,
23 24
     WSelect,
@@ -45,6 +46,7 @@ export default {
45 46
     WMenu,
46 47
     WProgress,
47 48
     WOverlay,
49
+    WTabs,
48 50
     WRadio,
49 51
     WRadios,
50 52
     WSelect,

Завантаження…
Відмінити
Зберегти