Parcourir la source

:sparkles: using tab layout condtionally for summary bar

tags/0.0.1^2
J il y a 3 ans
Parent
révision
e3e871ead8

+ 2
- 2
frontend/src/App.vue Voir le fichier

21
 import { currentProfile } from './services'
21
 import { currentProfile } from './services'
22
 import { surveyFactory } from './utils'
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
 const DEV_PID = 45
26
 const DEV_PID = 45
27
 
27
 
28
 export default {
28
 export default {

+ 6
- 2
frontend/src/components/NamePlate.vue Voir le fichier

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

+ 2
- 2
frontend/src/components/PairingButton.vue Voir le fichier

1
 <template lang="pug">
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
 </template>
4
 </template>
5
 
5
 
6
 <script>
6
 <script>

+ 20
- 12
frontend/src/components/ProfileCard.vue Voir le fichier

1
 <template lang="pug">
1
 <template lang="pug">
2
 w-card.profile-card-list--card.xs12.pa12
2
 w-card.profile-card-list--card.xs12.pa12
3
     header.xs12.w-flex.column.center
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
         template(v-if="!isList")
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
             TagList(v-if="!isPaired || isList")
22
             TagList(v-if="!isPaired || isList")
10
 
23
 
11
     article.xs12.w-flex.column.justify-space-between
24
     article.xs12.w-flex.column.justify-space-between
17
             :key="aspect.name"
30
             :key="aspect.name"
18
         )
31
         )
19
     
32
     
20
-    footer(v-if="!isList")
33
+    footer(v-if="!isList && !isPaired")
21
         .pa12
34
         .pa12
22
-            p {{ bio }}
35
+            p {{ card.summary.about.tab }}
23
         PairingButton(v-if="!isPaired")
36
         PairingButton(v-if="!isPaired")
24
 </template>
37
 </template>
25
 
38
 
31
 import TagList from './TagList.vue'
44
 import TagList from './TagList.vue'
32
 import PairingButton from './PairingButton.vue'
45
 import PairingButton from './PairingButton.vue'
33
 
46
 
34
-// const isPaired = ref(false)
35
-const isPaired = ref(true)
47
+// const isPaired = ref(true)
48
+const isPaired = ref(false)
36
 
49
 
37
 const props = defineProps({
50
 const props = defineProps({
38
     card: {
51
     card: {
43
         type: Array,
56
         type: Array,
44
         required: true,
57
         required: true,
45
     },
58
     },
46
-    bio: {
47
-        type: String,
48
-        required: false,
49
-        default: null,
50
-    },
51
     isList: {
59
     isList: {
52
         type: Boolean,
60
         type: Boolean,
53
         required: false,
61
         required: false,

+ 3
- 8
frontend/src/components/ProfileCardList.vue Voir le fichier

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

+ 23
- 16
frontend/src/components/SummaryBar.vue Voir le fichier

1
 <template lang="pug">
1
 <template lang="pug">
2
 section.w-flex.column.pb5
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
                 .w-flex.column.justify-start
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
+            template(v-if="isTab" #item-content="{ item }")
13
+                .tab 
14
+                    p {{ tabContent[item].tab }}
15
+
16
+        // Untabbed Layout
17
+        ul.w-flex.row.justify-space-between(v-else)
18
+            template(v-for="(item, index) in Object.keys(tabContent)" :key="index")
19
+                li.w-flex.row(v-if="item !== 'about'")
20
+                    w-icon(xl).mr1 mdi mdi-heart
21
+                    .w-flex.column.justify-start
22
+                        p {{ tabContent[item].matchPerc }}%
23
+                        p {{ item }}
11
 </template>
24
 </template>
12
 
25
 
13
 <script>
26
 <script>
14
 export default {
27
 export default {
15
     props: {
28
     props: {
16
-        summary: {
29
+        tabContent: {
17
             required: true,
30
             required: true,
18
-            type: Array,
19
-            default: () => [
20
-                ['passion', 50],
21
-                ['aspirations', 50],
22
-                ['skills', 50],
23
-            ],
31
+            type: Object,
24
         },
32
         },
25
-        showAbout: {
33
+        isTab: {
26
             required: false,
34
             required: false,
27
             type: Boolean,
35
             type: Boolean,
28
             default: false,
36
             default: false,
33
             default: true,
41
             default: true,
34
         },
42
         },
35
     },
43
     },
36
-    data: () => ({}),
37
 }
44
 }
38
 </script>
45
 </script>

+ 50
- 3
frontend/src/entities/card/card.js Voir le fichier

1
 /** @module card/card */
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
 class Aspect {
42
 class Aspect {
4
     constructor({ name, labels, percentage = 50 }) {
43
     constructor({ name, labels, percentage = 50 }) {
5
         this.name = name
44
         this.name = name
25
 
64
 
26
         this.presence = null
65
         this.presence = null
27
         this.urgency = null
66
         this.urgency = null
28
-        this.pronouns = null
67
+        this.pronouns = 'she/her/hers'
29
         this.ethinicity = null
68
         this.ethinicity = null
30
         this.locale = null
69
         this.locale = null
31
         this.email = null
70
         this.email = null
33
         this.images = []
72
         this.images = []
34
         this.tags = []
73
         this.tags = []
35
 
74
 
36
-        this.bio = null
75
+        this.summary = new SummaryGroup()
76
+
37
         this.aspects = [
77
         this.aspects = [
38
             new Aspect({
78
             new Aspect({
39
                 name: 'creativity',
79
                 name: 'creativity',
75
     c.presence = profile?.profile_prefs?.presence?.val
115
     c.presence = profile?.profile_prefs?.presence?.val
76
     c.urgency = profile?.profile_prefs?.urgency?.val
116
     c.urgency = profile?.profile_prefs?.urgency?.val
77
     c.pronouns = profile?.profile_prefs?.pronouns?.val
117
     c.pronouns = profile?.profile_prefs?.pronouns?.val
118
+        ? profile?.profile_prefs?.pronouns?.val
119
+        : c.pronouns
78
     c.ethinicity = profile?.profile_prefs?.ethnicity?.val
120
     c.ethinicity = profile?.profile_prefs?.ethnicity?.val
79
     c.locale = `${profile.city}, ${profile.state}`
121
     c.locale = `${profile.city}, ${profile.state}`
80
     c.email = profile.user_email
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
     return c
129
     return c
83
 }
130
 }
84
 export { Card, makeCardFromProfile }
131
 export { Card, makeCardFromProfile }

+ 0
- 4
frontend/src/views/ProfileView.vue Voir le fichier

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

+ 2
- 0
frontend/src/wave.js Voir le fichier

18
     WMenu,
18
     WMenu,
19
     WProgress,
19
     WProgress,
20
     WOverlay,
20
     WOverlay,
21
+    WTabs,
21
     WRadio,
22
     WRadio,
22
     WRadios,
23
     WRadios,
23
     WSelect,
24
     WSelect,
45
     WMenu,
46
     WMenu,
46
     WProgress,
47
     WProgress,
47
     WOverlay,
48
     WOverlay,
49
+    WTabs,
48
     WRadio,
50
     WRadio,
49
     WRadios,
51
     WRadios,
50
     WSelect,
52
     WSelect,

Chargement…
Annuler
Enregistrer