Преглед изворни кода

Merge branch '19-waveui' of fyindr/siimee into master

tags/0.0.1
maeda пре 3 година
родитељ
комит
6737eebfc0
51 измењених фајлова са 693 додато и 2736 уклоњено
  1. 8
    6
      backend/.prettierrc
  2. 1
    1
      backend/lib/index.js
  3. 1
    1
      backend/lib/plugins/survey.js
  4. 19
    13
      backend/lib/routes/membership/join.js
  5. 8
    4
      backend/lib/routes/notification/index.js
  6. 11
    7
      backend/lib/routes/profile/get.js
  7. 12
    8
      backend/lib/routes/profile/match.js
  8. 11
    7
      backend/lib/routes/profile/respond.js
  9. 11
    7
      backend/lib/routes/profile/update.js
  10. 5
    3
      backend/lib/routes/survey/questions.js
  11. 6
    4
      backend/lib/routes/survey/responses.js
  12. 1
    1
      backend/lib/routes/user/create-profile.js
  13. 1
    1
      backend/lib/routes/user/list-profiles.js
  14. 3
    1
      backend/lib/routes/user/login.js
  15. 4
    4
      backend/lib/routes/user/signup.js
  16. 1
    0
      backend/lib/services/matchqueue.js
  17. 21
    12
      backend/lib/services/notification.js
  18. 27
    18
      backend/lib/services/profile/index.js
  19. 34
    10
      backend/lib/services/profile/profiler.js
  20. 7
    7
      backend/lib/services/profile/scorer.js
  21. 2
    2
      backend/lib/services/profile/tagger.js
  22. 3
    3
      backend/lib/services/profile/zipcoder.js
  23. 5
    2
      backend/lib/services/user.js
  24. 2
    2
      backend/server/index.js
  25. 0
    0
      frontend/.eslintrc
  26. 1
    1
      frontend/.prettierrc
  27. 254
    1848
      frontend/package-lock.json
  28. 4
    8
      frontend/package.json
  29. 0
    9
      frontend/postcss.config.js
  30. 50
    61
      frontend/src/App.vue
  31. 4
    17
      frontend/src/components/MainNav.vue
  32. 6
    49
      frontend/src/components/Messages.vue
  33. 14
    44
      frontend/src/components/ProfileCardList.vue
  34. 6
    24
      frontend/src/components/SideBar.vue
  35. 14
    9
      frontend/src/main.js
  36. 1
    1
      frontend/src/router/index.js
  37. 0
    48
      frontend/src/sss/_variables.sss
  38. 0
    18
      frontend/src/sss/card.scss
  39. 0
    4
      frontend/src/sss/import.css
  40. 0
    217
      frontend/src/sss/partials/_helpers.sss
  41. 0
    13
      frontend/src/sss/partials/_ratios.sss
  42. 0
    40
      frontend/src/sss/partials/_reset.sss
  43. 0
    43
      frontend/src/sss/partials/_typography.sss
  44. 0
    16
      frontend/src/sss/theme.sss
  45. 8
    20
      frontend/src/views/HomeView.vue
  46. 5
    9
      frontend/src/views/LoginView.vue
  47. 6
    10
      frontend/src/views/MatchesView.vue
  48. 0
    2
      frontend/src/views/ProfileView.vue
  49. 64
    99
      frontend/src/views/SurveyView.vue
  50. 42
    0
      frontend/src/wave.js
  51. 10
    2
      frontend/vite.config.js

+ 8
- 6
backend/.prettierrc Прегледај датотеку

1
-trailingComma: "all"
2
-tabWidth: 4
3
-semi: false
4
-singleQuote: true
5
-bracketSpacing: true
6
-arrowParens: "avoid"
1
+{
2
+    "trailingComma": "all",
3
+    "tabWidth": 4,
4
+    "semi": false,
5
+    "singleQuote": true,
6
+    "bracketSpacing": true,
7
+    "arrowParens": "avoid"
8
+}

+ 1
- 1
backend/lib/index.js Прегледај датотеку

41
         await server.register(ProfilePlugin, {
41
         await server.register(ProfilePlugin, {
42
             routes: { prefix: '/profile' },
42
             routes: { prefix: '/profile' },
43
         })
43
         })
44
-        
44
+
45
         await server.register(NotificationPlugin, {
45
         await server.register(NotificationPlugin, {
46
             routes: { prefix: '/notification' },
46
             routes: { prefix: '/notification' },
47
         })
47
         })

+ 1
- 1
backend/lib/plugins/survey.js Прегледај датотеку

24
 
24
 
25
         await server.route(ResponseQuestionsRoute)
25
         await server.route(ResponseQuestionsRoute)
26
     },
26
     },
27
-    models: { ReponseKeyModel }
27
+    models: { ReponseKeyModel },
28
 }
28
 }

+ 19
- 13
backend/lib/routes/membership/join.js Прегледај датотеку

15
 
15
 
16
 const validators = {
16
 const validators = {
17
     params: params.profileId,
17
     params: params.profileId,
18
-    payload: groupingSchema.single.append({
19
-        target_id: Joi.number().required(),
20
-        role: Joi.string(),
21
-    }).label('grouping_membership_single')
18
+    payload: groupingSchema.single
19
+        .append({
20
+            target_id: Joi.number().required(),
21
+            role: Joi.string(),
22
+        })
23
+        .label('grouping_membership_single'),
22
 }
24
 }
23
 
25
 
24
 const responseSchemas = {
26
 const responseSchemas = {
25
     response: Joi.object({
27
     response: Joi.object({
26
         memberships: Joi.array().items(),
28
         memberships: Joi.array().items(),
27
-        hasMatch: Joi.boolean()
29
+        hasMatch: Joi.boolean(),
28
     }).label('grouping_membership_list'),
30
     }).label('grouping_membership_list'),
29
-    error: errorSchema.single
31
+    error: errorSchema.single,
30
 }
32
 }
31
 
33
 
32
 module.exports = {
34
 module.exports = {
99
         /** Validate based on validators object */
101
         /** Validate based on validators object */
100
         validate: {
102
         validate: {
101
             ...validators,
103
             ...validators,
102
-            failAction: 'log'
104
+            failAction: 'log',
103
         },
105
         },
104
 
106
 
105
         /** Validate the server response */
107
         /** Validate the server response */
106
         response: {
108
         response: {
107
             status: {
109
             status: {
108
-                200: apiSchema.single.append({
109
-                    data: responseSchemas.response,
110
-                }).label('join_grouping_res'),
111
-                409: apiSchema.single.append({
112
-                    data: responseSchemas.error,
113
-                }).label('error_single_res'),
110
+                200: apiSchema.single
111
+                    .append({
112
+                        data: responseSchemas.response,
113
+                    })
114
+                    .label('join_grouping_res'),
115
+                409: apiSchema.single
116
+                    .append({
117
+                        data: responseSchemas.error,
118
+                    })
119
+                    .label('error_single_res'),
114
             },
120
             },
115
         },
121
         },
116
     },
122
     },

+ 8
- 4
backend/lib/routes/notification/index.js Прегледај датотеку

15
 }
15
 }
16
 
16
 
17
 const validators = {
17
 const validators = {
18
-    params: params.profileId
18
+    params: params.profileId,
19
 }
19
 }
20
 
20
 
21
 module.exports = {
21
 module.exports = {
31
             const input = new PassThrough({ objectMode: true })
31
             const input = new PassThrough({ objectMode: true })
32
             const eventType = 'stonk'
32
             const eventType = 'stonk'
33
 
33
 
34
-            const msg = { profile_id, name: 'BDGRS', price: (500 + Math.floor(Math.random() * 100)).toString(), order: null }
34
+            const msg = {
35
+                profile_id,
36
+                name: 'BDGRS',
37
+                price: (500 + Math.floor(Math.random() * 100)).toString(),
38
+                order: null,
39
+            }
35
 
40
 
36
             // Write to the input stream
41
             // Write to the input stream
37
             setInterval(() => {
42
             setInterval(() => {
48
         /** Validate based on validators object */
53
         /** Validate based on validators object */
49
         validate: {
54
         validate: {
50
             ...validators,
55
             ...validators,
51
-            failAction: 'log'
56
+            failAction: 'log',
52
         },
57
         },
53
-
54
     },
58
     },
55
 }
59
 }

+ 11
- 7
backend/lib/routes/profile/get.js Прегледај датотеку

20
 }
20
 }
21
 
21
 
22
 const validators = {
22
 const validators = {
23
-    params: params.profileId
23
+    params: params.profileId,
24
 }
24
 }
25
 
25
 
26
 module.exports = {
26
 module.exports = {
65
         /** Validate the server response */
65
         /** Validate the server response */
66
         response: {
66
         response: {
67
             status: {
67
             status: {
68
-                200: apiSchema.single.append({
69
-                    data: responseSchemas.profile,
70
-                }).label('profile_single_res'),
71
-                409: apiSchema.single.append({
72
-                    data: responseSchemas.error,
73
-                }).label('error_single_res'),
68
+                200: apiSchema.single
69
+                    .append({
70
+                        data: responseSchemas.profile,
71
+                    })
72
+                    .label('profile_single_res'),
73
+                409: apiSchema.single
74
+                    .append({
75
+                        data: responseSchemas.error,
76
+                    })
77
+                    .label('error_single_res'),
74
             },
78
             },
75
         },
79
         },
76
     },
80
     },

+ 12
- 8
backend/lib/routes/profile/match.js Прегледај датотеку

3
 const Joi = require('joi')
3
 const Joi = require('joi')
4
 const apiSchema = require('../../schemas/api')
4
 const apiSchema = require('../../schemas/api')
5
 const errorSchema = require('../../schemas/errors')
5
 const errorSchema = require('../../schemas/errors')
6
-const surveyResponseSchema = require('../../schemas/responses') 
6
+const surveyResponseSchema = require('../../schemas/responses')
7
 
7
 
8
 const pluginConfig = {
8
 const pluginConfig = {
9
     handlerType: 'match',
9
     handlerType: 'match',
17
 
17
 
18
 const responseSchemas = {
18
 const responseSchemas = {
19
     response: surveyResponseSchema.list,
19
     response: surveyResponseSchema.list,
20
-    error: errorSchema.single
20
+    error: errorSchema.single,
21
 }
21
 }
22
 
22
 
23
 module.exports = {
23
 module.exports = {
66
         /** Validate the server response */
66
         /** Validate the server response */
67
         response: {
67
         response: {
68
             status: {
68
             status: {
69
-                200: apiSchema.single.append({
70
-                    data: responseSchemas.response,
71
-                }).label('response_list_res'),
72
-                409: apiSchema.single.append({
73
-                    data: responseSchemas.error,
74
-                }).label('error_single_res')
69
+                200: apiSchema.single
70
+                    .append({
71
+                        data: responseSchemas.response,
72
+                    })
73
+                    .label('response_list_res'),
74
+                409: apiSchema.single
75
+                    .append({
76
+                        data: responseSchemas.error,
77
+                    })
78
+                    .label('error_single_res'),
75
             },
79
             },
76
         },
80
         },
77
     },
81
     },

+ 11
- 7
backend/lib/routes/profile/respond.js Прегледај датотеку

16
 
16
 
17
 const responseSchemas = {
17
 const responseSchemas = {
18
     response: surveyResponseSchema.list,
18
     response: surveyResponseSchema.list,
19
-    error: errorSchema.single
19
+    error: errorSchema.single,
20
 }
20
 }
21
 
21
 
22
 const validators = {
22
 const validators = {
91
         /** Validate the server response */
91
         /** Validate the server response */
92
         response: {
92
         response: {
93
             status: {
93
             status: {
94
-                201: apiSchema.single.append({
95
-                    data: responseSchemas.response,
96
-                }).label('response_list_res'),
97
-                409: apiSchema.single.append({
98
-                    data: responseSchemas.error,
99
-                }).label('error_single_res')
94
+                201: apiSchema.single
95
+                    .append({
96
+                        data: responseSchemas.response,
97
+                    })
98
+                    .label('response_list_res'),
99
+                409: apiSchema.single
100
+                    .append({
101
+                        data: responseSchemas.error,
102
+                    })
103
+                    .label('error_single_res'),
100
             },
104
             },
101
         },
105
         },
102
     },
106
     },

+ 11
- 7
backend/lib/routes/profile/update.js Прегледај датотеку

16
 
16
 
17
 const responseSchemas = {
17
 const responseSchemas = {
18
     response: surveyResponseSchema.list,
18
     response: surveyResponseSchema.list,
19
-    error: errorSchema.single
19
+    error: errorSchema.single,
20
 }
20
 }
21
 
21
 
22
 const validators = {
22
 const validators = {
86
         /** Validate the server response */
86
         /** Validate the server response */
87
         response: {
87
         response: {
88
             status: {
88
             status: {
89
-                200: apiSchema.single.append({
90
-                    data: responseSchemas.response,
91
-                }).label('response_list_res'),
92
-                409: apiSchema.single.append({
93
-                    data: responseSchemas.error,
94
-                }).label('error_single_res')
89
+                200: apiSchema.single
90
+                    .append({
91
+                        data: responseSchemas.response,
92
+                    })
93
+                    .label('response_list_res'),
94
+                409: apiSchema.single
95
+                    .append({
96
+                        data: responseSchemas.error,
97
+                    })
98
+                    .label('error_single_res'),
95
             },
99
             },
96
         },
100
         },
97
     },
101
     },

+ 5
- 3
backend/lib/routes/survey/questions.js Прегледај датотеку

59
 
59
 
60
         /** Validate the server response */
60
         /** Validate the server response */
61
         response: {
61
         response: {
62
-            schema: apiSchema.single.append({
63
-                data: responseSchemas.response
64
-            }).label('question_list_res'),
62
+            schema: apiSchema.single
63
+                .append({
64
+                    data: responseSchemas.response,
65
+                })
66
+                .label('question_list_res'),
65
             failAction: 'log',
67
             failAction: 'log',
66
         },
68
         },
67
     },
69
     },

+ 6
- 4
backend/lib/routes/survey/responses.js Прегледај датотеку

25
     // payload: true,
25
     // payload: true,
26
 }
26
 }
27
 const responseSchemas = {
27
 const responseSchemas = {
28
-    response: surveyResponseSchema.keys
28
+    response: surveyResponseSchema.keys,
29
 }
29
 }
30
 
30
 
31
 module.exports = {
31
 module.exports = {
60
 
60
 
61
         /** Validate the server response */
61
         /** Validate the server response */
62
         response: {
62
         response: {
63
-            schema: apiSchema.single.append({
64
-                data: responseSchemas.response
65
-            }).label('response_list_res'),
63
+            schema: apiSchema.single
64
+                .append({
65
+                    data: responseSchemas.response,
66
+                })
67
+                .label('response_list_res'),
66
             failAction: 'log',
68
             failAction: 'log',
67
         },
69
         },
68
     },
70
     },

+ 1
- 1
backend/lib/routes/user/create-profile.js Прегледај датотеку

36
         user_id: Joi.number(),
36
         user_id: Joi.number(),
37
         user_name: Joi.string(),
37
         user_name: Joi.string(),
38
     }).label('created_profile'),
38
     }).label('created_profile'),
39
-    error: errorSchema.single
39
+    error: errorSchema.single,
40
 }
40
 }
41
 
41
 
42
 module.exports = {
42
 module.exports = {

+ 1
- 1
backend/lib/routes/user/list-profiles.js Прегледај датотеку

28
 
28
 
29
 const responseSchemas = {
29
 const responseSchemas = {
30
     profilesList: profileSchema.list,
30
     profilesList: profileSchema.list,
31
-    error: errorSchema.single
31
+    error: errorSchema.single,
32
 }
32
 }
33
 
33
 
34
 module.exports = {
34
 module.exports = {

+ 3
- 1
backend/lib/routes/user/login.js Прегледај датотеку

18
         payload: Joi.object({
18
         payload: Joi.object({
19
             user: userSchema.single,
19
             user: userSchema.single,
20
             error: errorSchema.single,
20
             error: errorSchema.single,
21
-        }).append().label('login_payload'),
21
+        })
22
+            .append()
23
+            .label('login_payload'),
22
     },
24
     },
23
     user: userSchema.single,
25
     user: userSchema.single,
24
 }
26
 }

+ 4
- 4
backend/lib/routes/user/signup.js Прегледај датотеку

14
 
14
 
15
 const validators = {
15
 const validators = {
16
     post: {
16
     post: {
17
-        payload: userSchema.userSignup
18
-    }
17
+        payload: userSchema.userSignup,
18
+    },
19
 }
19
 }
20
 
20
 
21
 const responseSchemas = {
21
 const responseSchemas = {
27
         is_admin: Joi.number(),
27
         is_admin: Joi.number(),
28
         is_verified: Joi.number(),
28
         is_verified: Joi.number(),
29
     }).label('created_user'),
29
     }).label('created_user'),
30
-    error: errorSchema.single
30
+    error: errorSchema.single,
31
 }
31
 }
32
 
32
 
33
 module.exports = {
33
 module.exports = {
55
                         is_poster: userType,
55
                         is_poster: userType,
56
                         is_admin: 0,
56
                         is_admin: 0,
57
                         is_verified: 0,
57
                         is_verified: 0,
58
-                    }
58
+                    },
59
                 })
59
                 })
60
                 return h
60
                 return h
61
                     .response({
61
                     .response({

+ 1
- 0
backend/lib/services/matchqueue.js Прегледај датотеку

39
         })
39
         })
40
         return queueByProfileId
40
         return queueByProfileId
41
     }
41
     }
42
+
42
     /**
43
     /**
43
      * Saves Scored Profile Ids to MatchQue IN ORDER
44
      * Saves Scored Profile Ids to MatchQue IN ORDER
44
      * @param {number} profileId
45
      * @param {number} profileId

+ 21
- 12
backend/lib/services/notification.js Прегледај датотеку

17
     const endl = '\r\n'
17
     const endl = '\r\n'
18
     for (const i in event) {
18
     for (const i in event) {
19
         let val = event[i]
19
         let val = event[i]
20
-        if (val instanceof Buffer) { val = val.toString() }
21
-        if (typeof val === 'object') { val = JSON.stringify(val) }
20
+        if (val instanceof Buffer) {
21
+            val = val.toString()
22
+        }
23
+        if (typeof val === 'object') {
24
+            val = JSON.stringify(val)
25
+        }
22
         str += i + ': ' + val + endl
26
         str += i + ': ' + val + endl
23
     }
27
     }
24
     str += endl
28
     str += endl
29
  * Transform extension
33
  * Transform extension
30
  * ?: I don't really get what this is doing
34
  * ?: I don't really get what this is doing
31
  * @param {object} options
35
  * @param {object} options
32
- * @param {object} objectMode 
36
+ * @param {object} objectMode
33
  */
37
  */
34
 class Transformer extends Transform {
38
 class Transformer extends Transform {
35
     constructor(options, objectMode) {
39
     constructor(options, objectMode) {
37
         options = options || {}
41
         options = options || {}
38
         this.counter = 1
42
         this.counter = 1
39
         this.event = options.event || null
43
         this.event = options.event || null
40
-        this.generateId = options.generateId ? options.generateId : () => {
41
-            return this.counter++
42
-        }
44
+        this.generateId = options.generateId
45
+            ? options.generateId
46
+            : () => {
47
+                  return this.counter++
48
+              }
43
     }
49
     }
44
-    _transform (chunk, encoding, callback) {
50
+    _transform(chunk, encoding, callback) {
45
         const event = {
51
         const event = {
46
             id: this.generateId(chunk),
52
             id: this.generateId(chunk),
47
-            data: chunk
53
+            data: chunk,
54
+        }
55
+        if (this.event) {
56
+            event.event = this.event
48
         }
57
         }
49
-        if (this.event) { event.event = this.event }
50
         this.push(stringifyEvent(event))
58
         this.push(stringifyEvent(event))
51
         callback()
59
         callback()
52
     }
60
     }
54
         this.push(stringifyEvent(ENDER))
62
         this.push(stringifyEvent(ENDER))
55
         callback()
63
         callback()
56
     }
64
     }
57
-} 
65
+}
58
 
66
 
59
 /**
67
 /**
60
  * Take an event stream and write content to another stream
68
  * Take an event stream and write content to another stream
95
         //     event.pipe(stream)
103
         //     event.pipe(stream)
96
         // }
104
         // }
97
         console.log('streamOptions :', streamOptions)
105
         console.log('streamOptions :', streamOptions)
98
-        return h.response(active)
106
+        return h
107
+            .response(active)
99
             .header('content-type', 'text/event-stream')
108
             .header('content-type', 'text/event-stream')
100
             .header('content-encoding', 'identity')
109
             .header('content-encoding', 'identity')
101
     }
110
     }
116
     // internals.writeEvent(event, active)
125
     // internals.writeEvent(event, active)
117
 }
126
 }
118
 
127
 
119
-module.exports = { onEvent }
128
+module.exports = { onEvent }

+ 27
- 18
backend/lib/services/profile/index.js Прегледај датотеку

82
             // CHECKTHIS: Added this because we added user.user_name to CompleteProfile
82
             // CHECKTHIS: Added this because we added user.user_name to CompleteProfile
83
             // so without this, we get undefined user_name
83
             // so without this, we get undefined user_name
84
             .withGraphFetched('user')
84
             .withGraphFetched('user')
85
-        
86
-        return profiler.makeCompleteProfilesFromProfile(profilesEntries, type, this.tagLookup)
85
+
86
+        return profiler.makeCompleteProfilesFromProfile(
87
+            profilesEntries,
88
+            type,
89
+            this.tagLookup,
90
+        )
87
     }
91
     }
88
 
92
 
89
     async getProfilesFor(profileIdArray, type, includeResponses = true) {
93
     async getProfilesFor(profileIdArray, type, includeResponses = true) {
106
             profilesEntries,
110
             profilesEntries,
107
             type,
111
             type,
108
             includeResponses,
112
             includeResponses,
109
-            this.tagLookup
113
+            this.tagLookup,
110
         )
114
         )
111
     }
115
     }
112
 
116
 
128
              * Using using the input and converting to index
132
              * Using using the input and converting to index
129
              * of the generated possible prescore array in config
133
              * of the generated possible prescore array in config
130
              * DUPLICATE:See saveResponseForProfile() line 343
134
              * DUPLICATE:See saveResponseForProfile() line 343
131
-             */ 
135
+             */
132
             let convertedResponse = responseToSave
136
             let convertedResponse = responseToSave
133
-            if(scoring._isScorableResponse(responseToSave.response_key_id)) {
137
+            if (scoring._isScorableResponse(responseToSave.response_key_id)) {
134
                 // Convert -3 to 0, 0 to 3, 3 to 6
138
                 // Convert -3 to 0, 0 to 3, 3 to 6
135
                 const offset = (config.scoreVals.length - 1) / 2
139
                 const offset = (config.scoreVals.length - 1) / 2
136
                 const indexFromInput = parseInt(responseToSave.val) + offset
140
                 const indexFromInput = parseInt(responseToSave.val) + offset
137
-                convertedResponse.val = config.scoreVals[indexFromInput].toString()
141
+                convertedResponse.val =
142
+                    config.scoreVals[indexFromInput].toString()
138
             }
143
             }
139
 
144
 
140
             const responseInfo = {
145
             const responseInfo = {
194
         )
199
         )
195
         if (matchingResponses.length > 0) {
200
         if (matchingResponses.length > 0) {
196
             const alreadyAnswered = matchingResponses.map(
201
             const alreadyAnswered = matchingResponses.map(
197
-                matchingRes => matchingRes.response_key_id
202
+                matchingRes => matchingRes.response_key_id,
198
             )
203
             )
199
             await Response.query()
204
             await Response.query()
200
                 .where({ profile_id: profileId })
205
                 .where({ profile_id: profileId })
206
          * Convert indexes to actual score values
211
          * Convert indexes to actual score values
207
          * Using using the input and converting to index
212
          * Using using the input and converting to index
208
          * of the generated possible prescore array in config
213
          * of the generated possible prescore array in config
209
-         */ 
214
+         */
210
         let convertedResponse = responseToSave
215
         let convertedResponse = responseToSave
211
-        if(scoring._isScorableResponse(responseToSave.response_key_id)) {
216
+        if (scoring._isScorableResponse(responseToSave.response_key_id)) {
212
             // Convert -3 to 0, 0 to 3, 3 to 6
217
             // Convert -3 to 0, 0 to 3, 3 to 6
213
             const offset = (config.scoreVals.length - 1) / 2
218
             const offset = (config.scoreVals.length - 1) / 2
214
             const indexFromInput = parseInt(responseToSave.val) + offset
219
             const indexFromInput = parseInt(responseToSave.val) + offset
251
             .findOne('profile_id', profileId)
256
             .findOne('profile_id', profileId)
252
             .withGraphFetched('responses')
257
             .withGraphFetched('responses')
253
             .withGraphFetched('user')
258
             .withGraphFetched('user')
254
-        
259
+
255
         // Move unneeded responses
260
         // Move unneeded responses
256
         const userZip = zipcoder.getZipCodeFromProfile(userProfile)
261
         const userZip = zipcoder.getZipCodeFromProfile(userProfile)
257
 
262
 
263
 
268
 
264
         // TODO: Let Objection optimize this
269
         // TODO: Let Objection optimize this
265
         const isPosterOpposite = userProfile.user.is_poster == 1 ? 0 : 1
270
         const isPosterOpposite = userProfile.user.is_poster == 1 ? 0 : 1
266
-        profileIdsOfOppositeType = profileIdsOfOppositeType.filter(profile => {
267
-            return profile.user.is_poster == isPosterOpposite
268
-        }).filter(profile => {
269
-            // Only include profiles that included zipcode response
270
-            return zipcoder.getZipCodeFromProfile(profile) ? true : false
271
-        })
272
-        
271
+        profileIdsOfOppositeType = profileIdsOfOppositeType
272
+            .filter(profile => {
273
+                return profile.user.is_poster == isPosterOpposite
274
+            })
275
+            .filter(profile => {
276
+                // Only include profiles that included zipcode response
277
+                return zipcoder.getZipCodeFromProfile(profile) ? true : false
278
+            })
279
+
273
         const profilePlusDistance = await Promise.all(
280
         const profilePlusDistance = await Promise.all(
274
             profileIdsOfOppositeType.map(async profile => {
281
             profileIdsOfOppositeType.map(async profile => {
275
                 const targetZip = zipcoder.getZipCodeFromProfile(profile)
282
                 const targetZip = zipcoder.getZipCodeFromProfile(profile)
315
             'zip_code_id',
322
             'zip_code_id',
316
             parseInt(zipCode),
323
             parseInt(zipCode),
317
         )
324
         )
318
-        if (!zipInfo) { console.error('zip:', zipCode) }
325
+        if (!zipInfo) {
326
+            console.error('zip:', zipCode)
327
+        }
319
         return {
328
         return {
320
             latitude: parseFloat(zipInfo.latitude),
329
             latitude: parseFloat(zipInfo.latitude),
321
             longitude: parseFloat(zipInfo.longitude),
330
             longitude: parseFloat(zipInfo.longitude),

+ 34
- 10
backend/lib/services/profile/profiler.js Прегледај датотеку

33
             // [] of all "profile" responses
33
             // [] of all "profile" responses
34
             this.responses = profile.responses
34
             this.responses = profile.responses
35
             // image, language, duration, presence, blurb, urgency, role, pronouns, distance
35
             // image, language, duration, presence, blurb, urgency, role, pronouns, distance
36
-            const prefs = ['zipcode', 'duration', 'presence', 'urgency', 'role', 'pronouns', 'distance']
36
+            const prefs = [
37
+                'zipcode',
38
+                'duration',
39
+                'presence',
40
+                'urgency',
41
+                'role',
42
+                'pronouns',
43
+                'distance',
44
+            ]
37
             const prefsKeys = config.prefKeys
45
             const prefsKeys = config.prefKeys
38
             prefs.forEach((pref, i) => {
46
             prefs.forEach((pref, i) => {
39
                 this.profile_prefs[pref] = this.responses.filter(
47
                 this.profile_prefs[pref] = this.responses.filter(
40
-                    r => r.response_key_id === prefsKeys[i]
48
+                    r => r.response_key_id === prefsKeys[i],
41
                 )[0]
49
                 )[0]
42
             })
50
             })
43
-            this.profile_description = this.responses.filter(r => r.response_key_id === config.blurbKey).map(r => r.val)[0]
44
-            this.profile_media = this.responses.filter(r => r.response_key_id === config.mediaKey).map(r => r.val)
45
-            this.profile_languages = this.responses.filter(r => r.response_key_id === config.langKey).map(r => r.val)
51
+            this.profile_description = this.responses
52
+                .filter(r => r.response_key_id === config.blurbKey)
53
+                .map(r => r.val)[0]
54
+            this.profile_media = this.responses
55
+                .filter(r => r.response_key_id === config.mediaKey)
56
+                .map(r => r.val)
57
+            this.profile_languages = this.responses
58
+                .filter(r => r.response_key_id === config.langKey)
59
+                .map(r => r.val)
46
         }
60
         }
47
     }
61
     }
48
 }
62
 }
49
 
63
 
50
-const makeCompleteProfiles = (profileIdArray, profilesEntries, type, includeResponses, tagLookup) => {
64
+const makeCompleteProfiles = (
65
+    profileIdArray,
66
+    profilesEntries,
67
+    type,
68
+    includeResponses,
69
+    tagLookup,
70
+) => {
51
     const completeProfiles = []
71
     const completeProfiles = []
52
     profileIdArray.forEach(pid => {
72
     profileIdArray.forEach(pid => {
53
         profilesEntries.forEach(entry => {
73
         profilesEntries.forEach(entry => {
54
             if (entry.profile_id == pid) {
74
             if (entry.profile_id == pid) {
55
-                const complete = new CompleteProfile(entry, type, includeResponses)
75
+                const complete = new CompleteProfile(
76
+                    entry,
77
+                    type,
78
+                    includeResponses,
79
+                )
56
                 tagger.setProfileTags(entry, complete, tagLookup)
80
                 tagger.setProfileTags(entry, complete, tagLookup)
57
                 completeProfiles.push(complete)
81
                 completeProfiles.push(complete)
58
             }
82
             }
60
     })
84
     })
61
     return completeProfiles
85
     return completeProfiles
62
 }
86
 }
63
-const makeCompleteProfilesFromProfile = (profilesEntries, type, tagLookup)=> {
87
+const makeCompleteProfilesFromProfile = (profilesEntries, type, tagLookup) => {
64
     profilesEntries.forEach(profile => {
88
     profilesEntries.forEach(profile => {
65
         tagger.setProfileTags(profile, profile, tagLookup)
89
         tagger.setProfileTags(profile, profile, tagLookup)
66
     })
90
     })
74
 module.exports = {
98
 module.exports = {
75
     CompleteProfile,
99
     CompleteProfile,
76
     makeCompleteProfiles,
100
     makeCompleteProfiles,
77
-    makeCompleteProfilesFromProfile
78
-}
101
+    makeCompleteProfilesFromProfile,
102
+}

+ 7
- 7
backend/lib/services/profile/scorer.js Прегледај датотеку

20
 
20
 
21
 const _isScorableResponse = res_key_id => {
21
 const _isScorableResponse = res_key_id => {
22
     let isScorable = false
22
     let isScorable = false
23
-    if(config.resKeys.includes(res_key_id)) {
23
+    if (config.resKeys.includes(res_key_id)) {
24
         isScorable = true
24
         isScorable = true
25
     }
25
     }
26
     return isScorable
26
     return isScorable
32
             error: `complete responses for profile: ${seeker.profile_id} unqeual to profile: ${potentialMatch.profile_id} | ${seeker.responses.length}:${potentialMatch.responses.length}`,
32
             error: `complete responses for profile: ${seeker.profile_id} unqeual to profile: ${potentialMatch.profile_id} | ${seeker.responses.length}:${potentialMatch.responses.length}`,
33
         }
33
         }
34
 
34
 
35
-    const aRes = seeker.responses.filter(
36
-        res =>  _isScorableResponse(res.response_key_id)
35
+    const aRes = seeker.responses.filter(res =>
36
+        _isScorableResponse(res.response_key_id),
37
     )
37
     )
38
-    const bRes = potentialMatch.responses.filter(
39
-        res =>  _isScorableResponse(res.response_key_id)
38
+    const bRes = potentialMatch.responses.filter(res =>
39
+        _isScorableResponse(res.response_key_id),
40
     )
40
     )
41
 
41
 
42
     const composite = []
42
     const composite = []
72
     _isScorableResponse,
72
     _isScorableResponse,
73
     scoreResponses,
73
     scoreResponses,
74
     makeScoreLookup,
74
     makeScoreLookup,
75
-    scoreAll
76
-}
75
+    scoreAll,
76
+}

+ 2
- 2
backend/lib/services/profile/tagger.js Прегледај датотеку

3
 }
3
 }
4
 
4
 
5
 module.exports = {
5
 module.exports = {
6
-    setProfileTags
7
-}
6
+    setProfileTags,
7
+}

+ 3
- 3
backend/lib/services/profile/zipcoder.js Прегледај датотеку

6
 const getZipCodeFromProfile = profile => {
6
 const getZipCodeFromProfile = profile => {
7
     // There should only be one zip code entry per profile
7
     // There should only be one zip code entry per profile
8
     let zipRes = profile.responses.find(
8
     let zipRes = profile.responses.find(
9
-        res => res.response_key_id == config.zipcodeKey
9
+        res => res.response_key_id == config.zipcodeKey,
10
     )
10
     )
11
     return zipRes.val
11
     return zipRes.val
12
 }
12
 }
21
 
21
 
22
 module.exports = {
22
 module.exports = {
23
     getZipCodeFromProfile,
23
     getZipCodeFromProfile,
24
-    filterByDistance
25
-}
24
+    filterByDistance,
25
+}

+ 5
- 2
backend/lib/services/user.js Прегледај датотеку

58
      */
58
      */
59
     async signup({ password, userInfo }, txn) {
59
     async signup({ password, userInfo }, txn) {
60
         const { User } = this.server.models()
60
         const { User } = this.server.models()
61
-        const matchingEmails = await User.query().where('user_email', userInfo.user_email)
61
+        const matchingEmails = await User.query().where(
62
+            'user_email',
63
+            userInfo.user_email,
64
+        )
62
 
65
 
63
-        if(matchingEmails.length > 0) { 
66
+        if (matchingEmails.length > 0) {
64
             throw `User ${userInfo.user_email} already exists: Cannot create a user without a unique email`
67
             throw `User ${userInfo.user_email} already exists: Cannot create a user without a unique email`
65
         }
68
         }
66
         const user = await User.query(txn).insert(userInfo)
69
         const user = await User.query(txn).insert(userInfo)

+ 2
- 2
backend/server/index.js Прегледај датотеку

25
 if (require.main === module) {
25
 if (require.main === module) {
26
     exports.deployment({ start: true })
26
     exports.deployment({ start: true })
27
 
27
 
28
-    process.on('unhandledRejection', (err) => {
28
+    process.on('unhandledRejection', err => {
29
         throw err
29
         throw err
30
     })
30
     })
31
-}
31
+}

frontend/.eslintrc.json → frontend/.eslintrc Прегледај датотеку


frontend/.prettierrc.json → frontend/.prettierrc Прегледај датотеку

10
     "pugFramework": "vue",
10
     "pugFramework": "vue",
11
     "pugSingleFileComponentIndentation": false,
11
     "pugSingleFileComponentIndentation": false,
12
     "pugClassNotation": "literal"
12
     "pugClassNotation": "literal"
13
-}
13
+}

+ 254
- 1848
frontend/package-lock.json
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 4
- 8
frontend/package.json Прегледај датотеку

15
         "pubnub": "^5.0.0",
15
         "pubnub": "^5.0.0",
16
         "vue": "^3.2.31",
16
         "vue": "^3.2.31",
17
         "vue-eslint-parser": "^9.0.2",
17
         "vue-eslint-parser": "^9.0.2",
18
-        "vue-router": "^4.0.14"
18
+        "vue-router": "^4.0.14",
19
+        "wave-ui": "^2.40.2"
19
     },
20
     },
20
     "devDependencies": {
21
     "devDependencies": {
21
         "@prettier/plugin-pug": "^1.19.2",
22
         "@prettier/plugin-pug": "^1.19.2",
22
         "@vitejs/plugin-vue": "^2.2.4",
23
         "@vitejs/plugin-vue": "^2.2.4",
23
         "@vue/compiler-sfc": "^3.2.31",
24
         "@vue/compiler-sfc": "^3.2.31",
24
-        "autoprefixer": "^10.4.2",
25
         "cross-env": "^7.0.3",
25
         "cross-env": "^7.0.3",
26
         "eslint": "^8.11.0",
26
         "eslint": "^8.11.0",
27
         "eslint-config-prettier": "^8.5.0",
27
         "eslint-config-prettier": "^8.5.0",
28
         "eslint-plugin-vue": "^8.5.0",
28
         "eslint-plugin-vue": "^8.5.0",
29
-        "naive-ui": "^2.26.4",
30
-        "postcss": "^8.4.8",
31
-        "postcss-calc": "^8.2.4",
32
-        "postcss-import": "^14.0.2",
33
-        "precss": "^4.0.0",
34
         "pug": "^3.0.2",
29
         "pug": "^3.0.2",
35
         "pug-plain-loader": "^1.1.0",
30
         "pug-plain-loader": "^1.1.0",
36
-        "sugarss": "^4.0.1",
31
+        "sass": "^1.54.4",
32
+        "sass-loader": "^10.3.1",
37
         "vite": "^2.8.6",
33
         "vite": "^2.8.6",
38
         "vite-fs": "^0.0.2",
34
         "vite-fs": "^0.0.2",
39
         "watch": "^1.0.2"
35
         "watch": "^1.0.2"

+ 0
- 9
frontend/postcss.config.js Прегледај датотеку

1
-module.exports = {
2
-    parser: 'sugarss',
3
-    plugins: [
4
-        require('postcss-import'),
5
-        require('postcss-calc'),
6
-        require('precss'),
7
-        require('autoprefixer'),
8
-    ],
9
-}

+ 50
- 61
frontend/src/App.vue Прегледај датотеку

1
 <template lang="pug">
1
 <template lang="pug">
2
-SideBar(
3
-    v-if="showSidebar"
4
-    :pid="getPid"
5
-    @updatePid="setPid"
6
-    @hide="showSidebar = false"
7
-)
8
-RouterView(
9
-    :pid="getPid"
10
-    @updatePid="setPid"
11
-    @show-sidebar="showSidebar = !showSidebar"
12
-)
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
29
+    SideBar(
30
+        v-if="showSidebar"
31
+        :pid="getPid"
32
+        @updatePid="setPid"
33
+        @hide="showSidebar = false"
34
+    )
35
+    RouterView(
36
+        :pid="getPid"
37
+        @updatePid="setPid"
38
+        @show-sidebar="showSidebar = !showSidebar"
39
+    )
13
 </template>
40
 </template>
14
 
41
 
15
 <script>
42
 <script>
16
-import * as sss from '@/sss/import.css'
17
-
43
+import 'wave-ui/dist/wave-ui.css'
18
 import SideBar from './components/SideBar.vue'
44
 import SideBar from './components/SideBar.vue'
19
 
45
 
20
 import { Chatter, currentProfile, StonkAlert } from './services'
46
 import { Chatter, currentProfile, StonkAlert } from './services'
26
 export default {
52
 export default {
27
     components: { SideBar },
53
     components: { SideBar },
28
     data: () => ({
54
     data: () => ({
29
-        showSidebar: false
55
+        showSidebar: false,
56
+        sliderVal: 1,
57
+        openDrawer: false,
30
     }),
58
     }),
31
     computed: {
59
     computed: {
32
-        getPid: () => currentProfile.id.value
60
+        getPid: () => (currentProfile.id.value ? currentProfile.id.value : 999),
33
     },
61
     },
34
     async created() {
62
     async created() {
35
         /** Get questions so we can compare against profile responses */
63
         /** Get questions so we can compare against profile responses */
36
         await surveyFactory.getQuestions()
64
         await surveyFactory.getQuestions()
37
 
65
 
38
-        /** 
66
+        /**
39
          * Development mode turns router guards off so
67
          * Development mode turns router guards off so
40
-         * we hard set the profile id instead of 
68
+         * we hard set the profile id instead of
41
          * using the login form
69
          * using the login form
42
-        */
43
-        if(DEV_MODE) { this.setPid(DEV_PID) }
70
+         */
71
+        if (DEV_MODE) {
72
+            this.setPid(DEV_PID)
73
+        }
44
 
74
 
45
-        if(currentProfile.isLoggedIn) {
75
+        if (currentProfile.isLoggedIn) {
46
             console.warn(`setting up Chatter and Toaster for ${this.getPid}...`)
76
             console.warn(`setting up Chatter and Toaster for ${this.getPid}...`)
47
             this.setupChatter()
77
             this.setupChatter()
48
             this.setupToaster()
78
             this.setupToaster()
72
     },
102
     },
73
 }
103
 }
74
 </script>
104
 </script>
75
-
76
-<style lang="postcss">
77
-@import './sss/theme.sss'
78
-
79
-#app
80
-    display: flex
81
-    flex-direction: row
82
-    text-align: center
83
-    color: $primary
84
-    font-family: $sans
85
-    background-color: $dark
86
-    overflow-x: hidden
87
-    height: 100%
88
-    > main
89
-        position: relative
90
-        height: 100%
91
-        > header
92
-            h2
93
-                font-size: $ms-1
94
-        > article
95
-            height: 100%
96
-            width: 100%
97
-            flex-direction: column
98
-    
99
-    button
100
-        padding: $ms-0
101
-        background-color: $primary
102
-        border: 1px transparent solid
103
-        border-radius: $ms-1
104
-        transition: $transition
105
-        &:hover
106
-            background-color: $secondary
107
-            border: 1px transparent solid
108
-            border-radius: $ms-1
109
-            cursor: pointer
110
-            color: $primary
111
-        &:disabled
112
-            cursor: default
113
-            color: $primary
114
-            background-color: $light
115
-</style>

+ 4
- 17
frontend/src/components/MainNav.vue Прегледај датотеку

1
 <template lang="pug">
1
 <template lang="pug">
2
-nav#main-header.w-full.z-top.f-row.around.p-2
2
+nav#main-header
3
     button(@click="$emit('show-sidebar')") toggle sidebar
3
     button(@click="$emit('show-sidebar')") toggle sidebar
4
-    router-link.header__icon.mobile--only(:to="`/matches`") matches
5
-    router-link.header__icon(to='/') home
6
-    router-link.header__icon.mobile--only(:to="`/survey`") survey
4
+    router-link(:to="`/matches`") matches
5
+    router-link(to='/') home
6
+    router-link(:to="`/survey`") survey
7
 </template>
7
 </template>
8
 
8
 
9
 <script>
9
 <script>
11
     name: 'MainNav',
11
     name: 'MainNav',
12
 }
12
 }
13
 </script>
13
 </script>
14
-
15
-<style lang="postcss">
16
-#main-header
17
-  position: absolute
18
-  bottom: 1vh
19
-  right: 0
20
-
21
-
22
-@media only screen and (min-width: 768px)
23
-  .mobile--only
24
-    /* display: none */
25
-    display: block
26
-</style>

+ 6
- 49
frontend/src/components/Messages.vue Прегледај датотеку

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
-    .f-row.start
11
-        img(:src='profile.avatar')
12
-        .message__right.f-col
13
-            h4.message__name {{ profile.name }}
14
-            p.message__content {{ profile.metadata.rawMetadata || &quot;Hello I&apos;m using tinder!&quot; }}
10
+    img(:src='profile.avatar')
11
+    .message__right
12
+        h4.message__name {{ profile.name }}
13
+        p.message__content {{ profile.metadata.rawMetadata || &quot;Hello I&apos;m using tinder!&quot; }}
15
 </template>
14
 </template>
16
 
15
 
17
 <script>
16
 <script>
19
 
18
 
20
 export default {
19
 export default {
21
     name: 'ProfileMessages',
20
     name: 'ProfileMessages',
22
-    mixins: [ mixins.pidMixin ],
21
+    mixins: [mixins.pidMixin],
23
     props: {
22
     props: {
24
         matches: {
23
         matches: {
25
             type: [Object, Array],
24
             type: [Object, Array],
26
-            default: () => []
25
+            default: () => [],
27
         },
26
         },
28
     },
27
     },
29
 }
28
 }
30
 </script>
29
 </script>
31
-
32
-<style lang="postcss">
33
-
34
-.sidebar
35
-    &--messages
36
-        padding: 20px 10px
37
-        /* overflow-y: scroll */
38
-        text-align: left
39
-        a
40
-            color: black
41
-            text-decoration: none
42
-            &:hover
43
-                background: #f9f9ff
44
-                transition: 0.5s
45
-            &.active
46
-                background: #ececff
47
-                transition: 0.5s
48
-    &__message
49
-        display: flex
50
-        align-items: center
51
-        margin: 20px 0
52
-        img
53
-            object-fit: cover
54
-            width: 70px
55
-            height: 70px
56
-            border-radius: 50%
57
-
58
-.message
59
-    &__title
60
-        color: #fd5068
61
-        text-transform: uppercase
62
-        margin-bottom: 10px
63
-    &__right
64
-        margin-left: 10px
65
-    &__name
66
-        padding-top: 5px
67
-        font-weight: 600
68
-    &__content
69
-        padding-top: 10px
70
-        line-height: 1em
71
-        
72
-</style>

+ 14
- 44
frontend/src/components/ProfileCardList.vue Прегледај датотеку

1
 <template lang="pug">
1
 <template lang="pug">
2
-section.profile-card-list.w-full
2
+section.profile-card-list
3
     .swipe(
3
     .swipe(
4
         v-if="!isGrid"
4
         v-if="!isGrid"
5
         :config="config"
5
         :config="config"
8
         v-for="(profile, i) in loadedProfiles"
8
         v-for="(profile, i) in loadedProfiles"
9
         :style="{ 'z-index': 1000-i }"
9
         :style="{ 'z-index': 1000-i }"
10
     )
10
     )
11
-        .card.b-solid.bg-cover.randomize(
11
+        .card.randomize(
12
             :style="{ 'background-image': `url(${profile.avatar})`, 'top': `${randomize(10)}px`, 'right': `${randomize(20)}px`, 'transform': `rotate(${randomize(7)}deg)` }"
12
             :style="{ 'background-image': `url(${profile.avatar})`, 'top': `${randomize(10)}px`, 'right': `${randomize(20)}px`, 'transform': `rotate(${randomize(7)}deg)` }"
13
         )
13
         )
14
-            .card--content.f-col.between
15
-                p(style="color: magenta;").f-grow profile: {{ profile.pid }}
16
-                .card--content--lower.ph-1.w-full.f-col.between
17
-                    h4.w-full.pv-1 {{ profile.name }}
18
-                    nav.swipe_icons.pv-1.w-full.f-grow.f-row
14
+            .card--content
15
+                p(style="color: magenta;") profile: {{ profile.pid }}
16
+                .card--content--lower
17
+                    h4 {{ profile.name }}
18
+                    nav.swipe_icons
19
                         //- Accept
19
                         //- Accept
20
                         button(@click="accept") Accept
20
                         button(@click="accept") Accept
21
                         button(@click="view(profile.pid)") view
21
                         button(@click="view(profile.pid)") view
26
         v-else
26
         v-else
27
         :key="profile.pid"
27
         :key="profile.pid"
28
         v-for="(profile, i) in loadedProfiles"
28
         v-for="(profile, i) in loadedProfiles"
29
-    ).f-row
30
-            .card.b-solid.bg-cover(
29
+    )
30
+            .card.bg-cover(
31
                 :style="{ 'background-image': `url(${profile.avatar})` }"
31
                 :style="{ 'background-image': `url(${profile.avatar})` }"
32
             )
32
             )
33
-                .card--content.f-col.between
34
-                    p(style="color: magenta;").f-grow profile: {{ profile.pid }}
35
-                    .card--content--lower.ph-1.w-full.f-col.between
36
-                        h4.w-full.pv-1 {{ profile.name }}
37
-                        nav.swipe_icons.pv-1.w-full.f-grow.f-row
33
+                .card--content
34
+                    p(style="color: magenta;") profile: {{ profile.pid }}
35
+                    .card--content--lower
36
+                        h4 {{ profile.name }}
37
+                        nav.swipe_icons
38
                             button(@click="view(profile.pid)") view
38
                             button(@click="view(profile.pid)") view
39
 </template>
39
 </template>
40
 
40
 
118
 // Copy profiles so we don't mutate the original
118
 // Copy profiles so we don't mutate the original
119
 const loadedProfiles = [...props.profiles]
119
 const loadedProfiles = [...props.profiles]
120
 </script>
120
 </script>
121
-
122
-<style lang="postcss">
123
-.profile-card-list
124
-    display: flex
125
-    justify-content: center
126
-
127
-.swipe
128
-    position: absolute
129
-.randomize
130
-    position: relative
131
-
132
-.card
133
-    position: relative
134
-    background-color: #fff
135
-    height: 60vw
136
-    width: 40vw
137
-    max-height: 600px
138
-    max-width: 400px
139
-    background-position: center
140
-    &--content
141
-        width: 100%
142
-        height: 100%
143
-        font-size: 3vw
144
-        &--lower
145
-            background-color: goldenrod
146
-            nav > button
147
-                font-size: 2vw
148
-
149
-
150
-</style>

+ 6
- 24
frontend/src/components/SideBar.vue Прегледај датотеку

1
 <template lang="pug">
1
 <template lang="pug">
2
-aside.sidebar.p-1.f-col.z-top
3
-    .temp-control-box.f-row.start.center
2
+aside.sidebar
3
+    .temp-control-box
4
         input(v-model="switchToPID")
4
         input(v-model="switchToPID")
5
-        button(@click="$emit('updatePid', switchToPID)").t-up.p-0 switch profile
5
+        button(@click="$emit('updatePid', switchToPID)") switch profile
6
     
6
     
7
     Messages(:matches="matches" :pid="pid")
7
     Messages(:matches="matches" :pid="pid")
8
-    
9
-    .spacer.f-grow
10
 </template>
8
 </template>
11
 
9
 
12
 <script>
10
 <script>
14
 import { mixins } from '../utils'
12
 import { mixins } from '../utils'
15
 
13
 
16
 export default {
14
 export default {
17
-    components: { Messages }, 
18
-    mixins: [ mixins.pidMixin ],
15
+    components: { Messages },
16
+    mixins: [mixins.pidMixin],
19
     data: () => ({
17
     data: () => ({
20
         switchToPID: null,
18
         switchToPID: null,
21
         matches: [
19
         matches: [
36
     mounted() {
34
     mounted() {
37
         // Set the form to display the default pid set in Home.vue
35
         // Set the form to display the default pid set in Home.vue
38
         this.switchToPID = this.pid
36
         this.switchToPID = this.pid
39
-    }
37
+    },
40
 }
38
 }
41
 </script>
39
 </script>
42
-
43
-<style lang="postcss">
44
-aside.sidebar
45
-    background-color: yellow
46
-    height: 100vh
47
-    position: fixed
48
-    h3
49
-        padding: 2vh
50
-
51
-.search
52
-    display: flex
53
-    flex-direction: row
54
-    input
55
-        border: 0
56
-
57
-</style>

+ 14
- 9
frontend/src/main.js Прегледај датотеку

1
 import { createApp } from 'vue'
1
 import { createApp } from 'vue'
2
-import router from './router'
2
+import { router } from './router'
3
 import { checkLoginStatus } from './router/guards'
3
 import { checkLoginStatus } from './router/guards'
4
 
4
 
5
+import WaveUI from '../node_modules/wave-ui/src/wave-ui/core'
6
+import components from './wave'
7
+
5
 import App from './App.vue'
8
 import App from './App.vue'
6
 import MainNav from './components/MainNav.vue'
9
 import MainNav from './components/MainNav.vue'
7
 
10
 
12
  */
15
  */
13
 router.beforeEach((to, from, next) => {
16
 router.beforeEach((to, from, next) => {
14
     /**
17
     /**
15
-     * Skip any route guarding with `npm run dev`
16
-     */
17
-    if(DEV) { next() }
18
-
19
-    /**
18
+     * Skip any route guarding with `npm run dev` or
20
      * Use the loginService to deal with login details
19
      * Use the loginService to deal with login details
21
-     * Activate with `npm run nodev`
20
+     * NOTE: Activate with `npm run nodev`
22
      */
21
      */
23
-    else {
22
+    if (DEV) {
23
+        next()
24
+    } else {
24
         checkLoginStatus(to, next)
25
         checkLoginStatus(to, next)
25
     }
26
     }
26
 })
27
 })
27
 
28
 
28
 const run = entry => {
29
 const run = entry => {
29
-    const siimee = createApp(App).use(router)
30
+    const siimee = createApp(App)
31
+    siimee.use(WaveUI, { components })
32
+    new WaveUI(siimee)
33
+
34
+    siimee.use(router)
30
     siimee.component('MainNav', MainNav)
35
     siimee.component('MainNav', MainNav)
31
     siimee.mount(entry)
36
     siimee.mount(entry)
32
 }
37
 }

+ 1
- 1
frontend/src/router/index.js Прегледај датотеку

49
     routes,
49
     routes,
50
 })
50
 })
51
 
51
 
52
-export default router
52
+export { router }

+ 0
- 48
frontend/src/sss/_variables.sss Прегледај датотеку

1
-@import './partials/_ratios.sss'
2
-
3
-/**
4
-  * Misc
5
-  */
6
-$transition: 300ms
7
-
8
-/**
9
-  * Page
10
-  */
11
-$max-width: 80vw
12
-
13
-
14
-/**
15
-  * Fonts
16
-  */
17
-$sans: 'helvetica', 'calibri', 'sans-serif'
18
-$serif: 'georgia', 'serif'
19
-$mono: 'input', 'consolas','monospace'
20
-
21
-
22
-/**
23
-  * Modular Scale
24
-  */
25
-$base: 0.7em
26
-$scale: $golden
27
-
28
-$ms-0: calc($base)
29
-$ms-1: calc($ms-0 * $scale)
30
-$ms-2: calc($ms-1 * $scale)
31
-$ms-3: calc($ms-2 * $scale)
32
-$ms-4: calc($ms-3 * $scale)
33
-$ms-5: calc($ms-4 * $scale)
34
-$ms-6: calc($ms-5 * $scale)
35
-$ms-7: calc($ms-6 * $scale)
36
-$ms-8: calc($ms-7 * $scale)
37
-$ms-9: calc($ms-8 * $scale)
38
-
39
-/**
40
-  * Color Scale
41
-  */
42
-$cbase: 0.3
43
-$cs-0: calc($cbase)
44
-$cs-1: calc($cs-0 * $scale)
45
-$cs-2: calc($cs-1 * $scale)
46
-$cs-3: calc($cs-2 * $scale)
47
-$cs-4: calc($cs-3 * $scale)
48
-$cs-5: calc($cs-4 * $scale)

+ 0
- 18
frontend/src/sss/card.scss Прегледај датотеку

1
-$n: 100;
2
-$cardbase: 2px;
3
-$cardtop: -1px;
4
-$index: 9999;
5
-
6
-@for $i from 0 through $n {
7
-  .swipe:nth-child(#{$i}) {
8
-    position: absolute;
9
-    left: calc($cardbase * $i);
10
-    top: calc($cardtop * $i);
11
-    z-index: calc($index - $i);
12
-  }
13
-}
14
-
15
-
16
-.swipe .card h3 {
17
-    color: blue!important;
18
-}

+ 0
- 4
frontend/src/sss/import.css Прегледај датотеку

1
-@import './partials/_reset.sss'
2
-@import './partials/_ratios.sss'
3
-@import './partials/_helpers.sss'
4
-@import './partials/_typography.sss'

+ 0
- 217
frontend/src/sss/partials/_helpers.sss Прегледај датотеку

1
-@import '../_variables.sss'
2
-@import '../theme.sss'
3
-
4
-.w
5
-    &-full
6
-        width: 100%
7
-    &-half
8
-        width: 50%
9
-    
10
-/* Flex box  */
11
-%flexy
12
-    display: flex
13
-    justify-content: center
14
-    align-items: center
15
-
16
-.f
17
-    &-row, &-col
18
-        @extend %flexy
19
-        &.start
20
-            align-items: flex-start
21
-            justify-content: flex-start
22
-        &.end 
23
-            align-items: flex-end
24
-            justify-content: flex-end
25
-        &.between
26
-            justify-content: space-between
27
-        &.around
28
-            justify-content: space-around
29
-        &.even
30
-            justify-content: space-evenly
31
-        &.stretch
32
-            align-content: stretch
33
-        &.baseline
34
-            align-items: baseline
35
-        &.center
36
-            align-items: flex-start
37
-            justify-content: flex-start
38
-        &.wrap
39
-            flex-wrap: wrap
40
-    &-row
41
-        flex-direction: row
42
-        &.reverse
43
-            flex-direction: row-reverse
44
-    &-col
45
-        flex-direction: column
46
-        &.reverse
47
-            flex-direction: column-reverse
48
-    &-grow
49
-        flex-grow: 1
50
-
51
-/* Borders */
52
-.b
53
-    &-none
54
-        border: none
55
-    &-solid
56
-        border: 1px solid $dark
57
-    &-dot
58
-        border: 1px dotted $dark
59
-    &-solid, &-dot
60
-        &.rounded
61
-            border-radius: $ms-0
62
-        &.invert
63
-            border-color: $light
64
-
65
-/* Backgrounds */
66
-.bg
67
-    &-none
68
-        background-color: none
69
-    &-primary
70
-        background-color: $primary
71
-    &-dark
72
-        background-color: $dark
73
-    &-light
74
-        background-color: $light
75
-    &-cover
76
-        background-size: cover
77
-    &-contain
78
-        background-size: contain
79
-    &-repeat
80
-        background-repeat: repeat
81
-
82
-/* Colors */
83
-.primary
84
-    color: $primary
85
-.dark
86
-    color: $dark
87
-.light
88
-    color: $light
89
-
90
-/* Padding */
91
-.p
92
-    &-none
93
-        padding: none
94
-    &-0
95
-        padding: $ms-0
96
-    &-1
97
-        padding: $ms-1
98
-    &-2
99
-        padding: $ms-2
100
-    &h
101
-        &-0
102
-            padding: 0 $ms-0
103
-        &-1
104
-            padding: 0 $ms-1
105
-        &-2
106
-            padding: 0 $ms-2
107
-    &v
108
-        &-0
109
-            padding: $ms-0 0
110
-        &-1
111
-            padding: $ms-1 0
112
-        &-2
113
-            padding: $ms-2 0
114
-    &t
115
-        &-0
116
-            padding-top: $ms-0
117
-        &-1
118
-            padding-top: $ms-1
119
-        &-2
120
-            padding-top: $ms-2
121
-    &b
122
-        &-0
123
-            padding-bottom: $ms-0
124
-        &-1
125
-            padding-bottom: $ms-1
126
-        &-2
127
-            padding-bottom: $ms-2
128
-    &l
129
-        &-0
130
-            padding-left: $ms-0
131
-        &-1
132
-            padding-left: $ms-1
133
-        &-2
134
-            padding-left: $ms-2
135
-    &r
136
-        &-0
137
-            padding-right: $ms-0
138
-        &-1
139
-            padding-right: $ms-1
140
-        &-2
141
-            padding-right: $ms-2
142
-
143
-/* Margin */
144
-.m
145
-    &-none
146
-        margin: none
147
-    &-0
148
-        margin: $ms-0
149
-    &-1
150
-        margin: $ms-1
151
-    &-2
152
-        margin: $ms-2
153
-    &h
154
-        &-0
155
-            margin: 0 $ms-0
156
-        &-1
157
-            margin: 0 $ms-1
158
-        &-2
159
-            margin: 0 $ms-2
160
-    &v
161
-        &-0
162
-            margin: $ms-0 0
163
-        &-1
164
-            margin: $ms-1 0
165
-        &-2
166
-            margin: $ms-2 0
167
-    &t
168
-        &-0
169
-            margin-top: $ms-0
170
-        &-1
171
-            margin-top: $ms-1
172
-        &-2
173
-            margin-top: $ms-2
174
-    &b
175
-        &-0
176
-            margin-bottom: $ms-0
177
-        &-1
178
-            margin-bottom: $ms-1
179
-        &-2
180
-            margin-bottom: $ms-2
181
-    &l
182
-        &-0
183
-            margin-left: $ms-0
184
-        &-1
185
-            margin-left: $ms-1
186
-        &-2
187
-            margin-left: $ms-2
188
-    &r
189
-        &-0
190
-            margin-right: $ms-0
191
-        &-1
192
-            margin-right: $ms-1
193
-        &-2
194
-            margin-right: $ms-2
195
-
196
-.z
197
-    &-bottom
198
-        position: relative
199
-        z-index: -1
200
-    &-10
201
-        position: relative
202
-        z-index: 10
203
-    &-20
204
-        position: relative
205
-        z-index: 20
206
-    &-30
207
-        position: relative
208
-        z-index: 30
209
-    &-40
210
-        position: relative
211
-        z-index: 40
212
-    &-50
213
-        position: relative
214
-        z-index: 50
215
-    &-top
216
-        position: relative
217
-        z-index: 10001

+ 0
- 13
frontend/src/sss/partials/_ratios.sss Прегледај датотеку

1
-$minor-second: 1.067
2
-$major-second: 1.125
3
-$minor-third: 1.2
4
-$major-third: 1.25
5
-$perfect-fourth: 1.333
6
-$augmented-fourth: 1.414
7
-$perfect-fifth: 1.5
8
-$minor-sixth: 1.6
9
-$golden: 1.618
10
-$major-sixth: 1.667
11
-$minor-seventh: 1.778
12
-$major-seventh: 1.875
13
-$octave: 2

+ 0
- 40
frontend/src/sss/partials/_reset.sss Прегледај датотеку

1
-@import '../_variables.sss'
2
-@import '../theme.sss'
3
-
4
-*
5
-    margin: 0
6
-    padding: 0
7
-    box-sizing: border-box
8
-    &:before, &:after
9
-        background-repeat: no-repeat
10
-        box-sizing: inherit
11
-    $:focus
12
-        outline: none !important
13
-
14
-::before, ::after
15
-    text-decoration: inherit
16
-    vertical-align: inherit
17
-
18
-html
19
-    cursor: default
20
-    font-family: system-ui
21
-    line-height: $ms-0
22
-    tab-size: 4
23
-
24
-body
25
-    margin: 0
26
-    font-size: $ms-1
27
-    font-family: $sans
28
-
29
-nav
30
-    ol, ul
31
-        list-style: none
32
-
33
-// Good for SPAs
34
-html, body
35
-    height: 100%
36
-
37
-button, input, select, textarea
38
-    font-family: inherit
39
-    font-size: inherit
40
-    line-height: inherit

+ 0
- 43
frontend/src/sss/partials/_typography.sss Прегледај датотеку

1
-@import '../_variables.sss'
2
-@import '../theme.sss'
3
-
4
-h1
5
-    font-size: $ms-5
6
-    line-height: $ms-5
7
-h2
8
-    font-size: $ms-3
9
-    line-height: $ms-3
10
-h3
11
-    font-size: $ms-2
12
-    line-height: $ms-2
13
-h4
14
-    font-size: $ms-1
15
-    line-height: $ms-2
16
-p
17
-    font-size: $ms-1
18
-    line-height: $ms-2
19
-
20
-.t
21
-    &-center
22
-        width: 100%
23
-        text-align: center
24
-    &-right
25
-        width: 100%
26
-        text-align: right
27
-    &-left
28
-        width: 100%
29
-        text-align: left
30
-    &-up
31
-        text-transform: uppercase
32
-    &-cap
33
-        text-transform: capitalize
34
-    &-sans
35
-        font-family: $sans
36
-    &-serif
37
-        font-family: $serif
38
-    &-mono
39
-        font-family: $mono
40
-
41
-a
42
-    &:hover
43
-        cursor: pointer

+ 0
- 16
frontend/src/sss/theme.sss Прегледај датотеку

1
-@import './_variables.sss'
2
-
3
-/**
4
- * Colors
5
- */
6
-$hue: 50
7
-$bg: calc($hue * $cs-5)
8
-$bright: 70%
9
-$opacity: 1
10
-
11
-$primary: hsla($hue, 80%, calc($bright * $cs-5), $opacity)
12
-$secondary: hsla($bg, 20%, calc($bright * $cs-0), $opacity)
13
-$hilite: hsla($hue, 80%, calc($bright * $cs-0), $opacity)
14
-
15
-$light: hsla(100, 100%, calc($bright * $cs-0), $opacity)
16
-$dark: hsla(001, 0%, 5%, $opacity)

+ 8
- 20
frontend/src/views/HomeView.vue Прегледај датотеку

1
 <template lang="pug">
1
 <template lang="pug">
2
-main.view--home.f-col.start.w-full
2
+main.view--home
3
     header
3
     header
4
         h2 home - profile: {{ pid }}
4
         h2 home - profile: {{ pid }}
5
-
5
+        
6
     article(v-if="cards.length && !loading")
6
     article(v-if="cards.length && !loading")
7
         ProfileCardList(:profiles="cards" :pid="pid" @reload="getCards")
7
         ProfileCardList(:profiles="cards" :pid="pid" @reload="getCards")
8
 
8
 
20
 
20
 
21
 /** Callback used to format incoming into card */
21
 /** Callback used to format incoming into card */
22
 const convertToCard = profile => {
22
 const convertToCard = profile => {
23
-    if(profile.type !== 'profile') {
23
+    if (profile.type !== 'profile') {
24
         console.error(`Cannot convert ${profile} to Card. Invalid entity.`)
24
         console.error(`Cannot convert ${profile} to Card. Invalid entity.`)
25
     }
25
     }
26
-    if(!profile.isValid()) {
26
+    if (!profile.isValid()) {
27
         console.warn(`Profile ${profile.profile_id} is not a valid profile.`)
27
         console.warn(`Profile ${profile.profile_id} is not a valid profile.`)
28
     }
28
     }
29
     return new Card({
29
     return new Card({
36
 export default {
36
 export default {
37
     name: 'HomeView',
37
     name: 'HomeView',
38
     components: { ProfileCardList },
38
     components: { ProfileCardList },
39
-    mixins: [ mixins.pidMixin, mixins.cardMixin ],
39
+    mixins: [mixins.pidMixin, mixins.cardMixin],
40
     methods: {
40
     methods: {
41
         /** Gets called from cardMixin */
41
         /** Gets called from cardMixin */
42
         async getCards() {
42
         async getCards() {
44
             try {
44
             try {
45
                 const queueList = await fetchQueueByProfileId(this.pid)
45
                 const queueList = await fetchQueueByProfileId(this.pid)
46
                 this.cards = this._reformat(queueList, convertToCard)
46
                 this.cards = this._reformat(queueList, convertToCard)
47
-            } catch (err) { console.error(err) }
47
+            } catch (err) {
48
+                console.error(err)
49
+            }
48
             this.loading = false
50
             this.loading = false
49
         },
51
         },
50
     },
52
     },
51
 }
53
 }
52
 </script>
54
 </script>
53
-
54
-<style lang="postcss">
55
-main
56
-    position: relative
57
-    height: 100%
58
-    > article
59
-        height: 100%
60
-        width: 100%
61
-        flex-direction: column
62
-
63
-    input, button
64
-        position: relative
65
-        z-index: 1000
66
-</style>

+ 5
- 9
frontend/src/views/LoginView.vue Прегледај датотеку

18
 export default {
18
 export default {
19
     data: () => ({
19
     data: () => ({
20
         form: {
20
         form: {
21
-            profileId: null
21
+            profileId: null,
22
         },
22
         },
23
     }),
23
     }),
24
     methods: {
24
     methods: {
25
         async onSubmit() {
25
         async onSubmit() {
26
-            if(!this.form.profileId) console.error('No profile in form')
27
-            
26
+            if (!this.form.profileId) console.error('No profile in form')
27
+
28
             /**
28
             /**
29
              * Default to the HomeView and alter as needed (side-effects!)
29
              * Default to the HomeView and alter as needed (side-effects!)
30
              */
30
              */
31
             const toRoute = { name: 'HomeView' }
31
             const toRoute = { name: 'HomeView' }
32
-            
32
+
33
             /**
33
             /**
34
              * Profile needs a complete survey and
34
              * Profile needs a complete survey and
35
              * alters the url if it's incomplete
35
              * alters the url if it's incomplete
36
              */
36
              */
37
             const alreadyLoggedIn = await currentProfile.isLoggedIn
37
             const alreadyLoggedIn = await currentProfile.isLoggedIn
38
-            if(!alreadyLoggedIn) {
38
+            if (!alreadyLoggedIn) {
39
                 await currentProfile.login(this.form.profileId)
39
                 await currentProfile.login(this.form.profileId)
40
             }
40
             }
41
 
41
 
44
     },
44
     },
45
 }
45
 }
46
 </script>
46
 </script>
47
-
48
-<style lang="postcss">
49
-
50
-</style>

+ 6
- 10
frontend/src/views/MatchesView.vue Прегледај датотеку

20
 
20
 
21
 /** Callback used to format incoming into card */
21
 /** Callback used to format incoming into card */
22
 const convertToCard = grouping => {
22
 const convertToCard = grouping => {
23
-    if(grouping.type !== 'grouping') {
23
+    if (grouping.type !== 'grouping') {
24
         console.error(`Cannot convert ${grouping} to Card. Invalid entity.`)
24
         console.error(`Cannot convert ${grouping} to Card. Invalid entity.`)
25
     }
25
     }
26
-    if(!grouping.profile.isValid()) {
26
+    if (!grouping.profile.isValid()) {
27
         console.warn(`Profile in ${grouping} is not a valid profile.`)
27
         console.warn(`Profile in ${grouping} is not a valid profile.`)
28
     }
28
     }
29
     return new Card({
29
     return new Card({
36
 export default {
36
 export default {
37
     name: 'MatchView',
37
     name: 'MatchView',
38
     components: { ProfileCardList },
38
     components: { ProfileCardList },
39
-    mixins: [ mixins.pidMixin, mixins.cardMixin ],
39
+    mixins: [mixins.pidMixin, mixins.cardMixin],
40
     methods: {
40
     methods: {
41
         /** Gets called from cardMixin */
41
         /** Gets called from cardMixin */
42
         async getCards() {
42
         async getCards() {
44
             try {
44
             try {
45
                 const matchList = await fetchMembershipsByProfileId(this.pid)
45
                 const matchList = await fetchMembershipsByProfileId(this.pid)
46
                 this.cards = this._reformat(matchList, convertToCard)
46
                 this.cards = this._reformat(matchList, convertToCard)
47
-            } catch (err) { console.error(err) }
47
+            } catch (err) {
48
+                console.error(err)
49
+            }
48
             this.loading = false
50
             this.loading = false
49
         },
51
         },
50
     },
52
     },
51
 }
53
 }
52
 </script>
54
 </script>
53
-
54
-<style lang="postcss">
55
-.row
56
-    display: flex
57
-    flex-direction: row
58
-</style>

+ 0
- 2
frontend/src/views/ProfileView.vue Прегледај датотеку

60
     },
60
     },
61
 }
61
 }
62
 </script>
62
 </script>
63
-
64
-<style lang="postcss"></style>

+ 64
- 99
frontend/src/views/SurveyView.vue Прегледај датотеку

61
 import { surveyFactory, randomSurveyResponses } from '@/utils'
61
 import { surveyFactory, randomSurveyResponses } from '@/utils'
62
 import { allSteps, aspectResponses, possible } from '@/utils/lang'
62
 import { allSteps, aspectResponses, possible } from '@/utils/lang'
63
 
63
 
64
-import { currentProfile, createProfileForUserId, fetchProfileByProfileId, scoreSurveyByProfileId, signupUser } from '@/services'
64
+import {
65
+    currentProfile,
66
+    createProfileForUserId,
67
+    fetchProfileByProfileId,
68
+    scoreSurveyByProfileId,
69
+    signupUser,
70
+} from '@/services'
65
 
71
 
66
 import { maxDistanceKey } from '../../../backend/db/data-generator/config.json'
72
 import { maxDistanceKey } from '../../../backend/db/data-generator/config.json'
67
 
73
 
68
 export default {
74
 export default {
69
     props: {
75
     props: {
70
         pid: {
76
         pid: {
71
-            type: Number,
77
+            type: String,
78
+            default: () => '1',
72
         },
79
         },
73
     },
80
     },
74
     data() {
81
     data() {
86
                 honesty: 0,
93
                 honesty: 0,
87
                 respect: 0,
94
                 respect: 0,
88
             },
95
             },
89
-            aspectResponses: Object.values(aspectResponses.usa)
96
+            aspectResponses: Object.values(aspectResponses.usa),
90
         }
97
         }
91
     },
98
     },
92
     computed: {
99
     computed: {
116
             toGen.forEach(async () => {
123
             toGen.forEach(async () => {
117
                 const randRes = randomSurveyResponses(this.bypassCount)
124
                 const randRes = randomSurveyResponses(this.bypassCount)
118
                 randRes.forEach((tr, i) => {
125
                 randRes.forEach((tr, i) => {
119
-                    this.storeResponseLike(i, tr.idOrPrompt, tr.idOrPrompt, tr.val)
126
+                    this.storeResponseLike(
127
+                        i,
128
+                        tr.idOrPrompt,
129
+                        tr.idOrPrompt,
130
+                        tr.val,
131
+                    )
120
                 })
132
                 })
121
                 this.bypassCount++
133
                 this.bypassCount++
122
                 await this.onSave()
134
                 await this.onSave()
128
             // Also update the form model state for now
140
             // Also update the form model state for now
129
             // We probably can refactor this out
141
             // We probably can refactor this out
130
             this.profile[prompt] = val
142
             this.profile[prompt] = val
131
-            
143
+
132
             /**
144
             /**
133
              * If NO response id is present, that means the answer
145
              * If NO response id is present, that means the answer
134
              * is required and associated with a User and NOT a Profile
146
              * is required and associated with a User and NOT a Profile
135
              **/
147
              **/
136
             this.responseLikes[`step-${step}`] = {
148
             this.responseLikes[`step-${step}`] = {
137
                 idOrPrompt: id ? id : prompt,
149
                 idOrPrompt: id ? id : prompt,
138
-                val: val.toString()
150
+                val: val.toString(),
139
             }
151
             }
140
         },
152
         },
141
         _formatIntoResponses(survey) {
153
         _formatIntoResponses(survey) {
147
         },
159
         },
148
         /**
160
         /**
149
          * Survey responses have User information
161
          * Survey responses have User information
150
-         * mixed in with scoring information so we 
162
+         * mixed in with scoring information so we
151
          * need to separate them
163
          * need to separate them
152
          * @param {array} responseLikes answered by the survey
164
          * @param {array} responseLikes answered by the survey
153
          */
165
          */
155
             let survey = []
167
             let survey = []
156
             const user = {}
168
             const user = {}
157
             responseLikes.forEach(resLike => {
169
             responseLikes.forEach(resLike => {
158
-                if(resLike.idOrPrompt && Number.isFinite(parseInt(resLike.idOrPrompt))) {
170
+                if (
171
+                    resLike.idOrPrompt &&
172
+                    Number.isFinite(parseInt(resLike.idOrPrompt))
173
+                ) {
159
                     survey.push(resLike)
174
                     survey.push(resLike)
160
                 } else {
175
                 } else {
161
                     user[resLike.idOrPrompt] = resLike.val
176
                     user[resLike.idOrPrompt] = resLike.val
166
         async _createUserProfileRel(user, survey) {
181
         async _createUserProfileRel(user, survey) {
167
             /** A User is required before creating a profile */
182
             /** A User is required before creating a profile */
168
             const createdUser = await signupUser(user)
183
             const createdUser = await signupUser(user)
169
-            if(!createdUser) return
184
+            if (!createdUser) return
170
 
185
 
171
-            const userProfileRel = await createProfileForUserId(createdUser.user_id, survey)
172
-            if(!userProfileRel) return 
186
+            const userProfileRel = await createProfileForUserId(
187
+                createdUser.user_id,
188
+                survey,
189
+            )
190
+            if (!userProfileRel) return
173
 
191
 
174
             return userProfileRel
192
             return userProfileRel
175
         },
193
         },
176
         async _getProfileWithScore(createdProfileId, maxDistance) {
194
         async _getProfileWithScore(createdProfileId, maxDistance) {
177
             /** A Profile is associated with n:1 user and referenced by profile id */
195
             /** A Profile is associated with n:1 user and referenced by profile id */
178
-            const fetchedProfile = await fetchProfileByProfileId(createdProfileId)
179
-            if(!fetchedProfile) {
180
-                console.error(`Could not fetch Profile ${createdProfileId}. Please check that a User and Profile were created.`)
196
+            const fetchedProfile = await fetchProfileByProfileId(
197
+                createdProfileId,
198
+            )
199
+            if (!fetchedProfile) {
200
+                console.error(
201
+                    `Could not fetch Profile ${createdProfileId}. Please check that a User and Profile were created.`,
202
+                )
181
                 return
203
                 return
182
             }
204
             }
183
 
205
 
184
             /** Use profile answers to compare against other profile answers */
206
             /** Use profile answers to compare against other profile answers */
185
-            const scored = await scoreSurveyByProfileId(createdProfileId, maxDistance)
186
-            if(!scored) {
207
+            const scored = await scoreSurveyByProfileId(
208
+                createdProfileId,
209
+                maxDistance,
210
+            )
211
+            if (!scored) {
187
                 console.error(`Could not score Profile ${createdProfileId}.`)
212
                 console.error(`Could not score Profile ${createdProfileId}.`)
188
                 return
213
                 return
189
             }
214
             }
191
         },
216
         },
192
         async _setLoginForProfile(profile) {
217
         async _setLoginForProfile(profile) {
193
             const currentId = currentProfile.login(profile.profile_id)
218
             const currentId = currentProfile.login(profile.profile_id)
194
-            if(currentId && profile.responses.length) {
219
+            if (currentId && profile.responses.length) {
195
                 // Stores responses without fetching again
220
                 // Stores responses without fetching again
196
                 currentProfile.setResponses(profile.responses)
221
                 currentProfile.setResponses(profile.responses)
197
             }
222
             }
198
-            if(!currentProfile.isComplete) {
199
-                console.error(`Profile ${currentProfile.id} is incomplete. Please make sure all survey questions have been answered.`)
223
+            if (!currentProfile.isComplete) {
224
+                console.error(
225
+                    `Profile ${currentProfile.id} is incomplete. Please make sure all survey questions have been answered.`,
226
+                )
200
                 return
227
                 return
201
             }
228
             }
202
         },
229
         },
203
         async onSave() {
230
         async onSave() {
204
-            const [ user, survey] = this._separateUserInfoFromResponses(Object.values(this.responseLikes))
205
-            const maxDistanceRes = survey.find(res => res.response_key_id == maxDistanceKey)
231
+            const [user, survey] = this._separateUserInfoFromResponses(
232
+                Object.values(this.responseLikes),
233
+            )
234
+            const maxDistanceRes = survey.find(
235
+                res => res.response_key_id == maxDistanceKey,
236
+            )
206
             /**
237
             /**
207
              * Creating a profile only returns the created
238
              * Creating a profile only returns the created
208
              * user id and profile id
239
              * user id and profile id
209
              **/
240
              **/
210
-            const userProfileRel = await this._createUserProfileRel(user, survey)
241
+            const userProfileRel = await this._createUserProfileRel(
242
+                user,
243
+                survey,
244
+            )
211
             const createdProfileId = userProfileRel.profile_id
245
             const createdProfileId = userProfileRel.profile_id
212
 
246
 
213
             /** A Profile is associated with n:1 user and referenced by profile id */
247
             /** A Profile is associated with n:1 user and referenced by profile id */
214
-            const fetchedProfile = await this._getProfileWithScore(createdProfileId, maxDistanceRes.val)
215
-            
216
-            /** 
248
+            const fetchedProfile = await this._getProfileWithScore(
249
+                createdProfileId,
250
+                maxDistanceRes.val,
251
+            )
252
+
253
+            /**
217
              * Login only after there is a user and
254
              * Login only after there is a user and
218
              * that user has a profile and all responses
255
              * that user has a profile and all responses
219
-            */
256
+             */
220
             this._setLoginForProfile(fetchedProfile)
257
             this._setLoginForProfile(fetchedProfile)
221
-            
258
+
222
             this.$router.push({ name: 'HomeView' })
259
             this.$router.push({ name: 'HomeView' })
223
         },
260
         },
224
         back(prompt) {
261
         back(prompt) {
228
     },
265
     },
229
 }
266
 }
230
 </script>
267
 </script>
231
-
232
-<style lang="postcss">
233
-.slide-up
234
-    &-leave, &-enter
235
-        &-active
236
-            transition-delay: 500ms
237
-            transition-property: opacity, background-color, font-size, transform, color
238
-            transition-timing-function: cubic-bezier(1, 0.3, 0.5, 1)
239
-            transition-duration: 300ms
240
-    &-enter-from, &-leave-to
241
-        opacity: 0
242
-
243
-.fade
244
-    animation: fadeIn 1200ms ease-in
245
-
246
-@keyframes fadeIn
247
-    0%
248
-        opacity: 0
249
-    50%
250
-        opacity: 0.5
251
-    100%
252
-        opacity:1
253
-
254
-h1
255
-    color: white
256
-
257
-main
258
-    padding: 5vh
259
-    display: flex
260
-    header
261
-        p
262
-            color: #666
263
-            line-height: 1.3em
264
-        color: #ccc
265
-        font-style: italic
266
-        text-align: left
267
-
268
-article
269
-    height: 100%
270
-    width: 100%
271
-    flex-direction: column
272
-    ul
273
-        height: 100%
274
-        list-style: none
275
-        button
276
-            padding: 1em
277
-        p
278
-            padding: 1em
279
-            color: white
280
-.form
281
-    border: 1px solid #fff
282
-    width: 100%
283
-    header, footer, ul
284
-        padding: 1vh
285
-    ul
286
-        display: flex
287
-        width: 100%
288
-        > li
289
-            flex-direction: column
290
-            border: 0px solid yellow
291
-            width: 100%
292
-            padding: 0
293
-            text-align: left
294
-            label
295
-                margin-right: 1vh
296
-            > h3
297
-                text-transform: capitalize
298
-                padding: 1vh 0
299
-            > div > span
300
-                display: block
301
-                text-align: center
302
-</style>

+ 42
- 0
frontend/src/wave.js Прегледај датотеку

1
+/**
2
+ * We have to destructure the import for tree-shaking to work
3
+ */
4
+import {
5
+    WAlert,
6
+    WApp,
7
+    WBadge,
8
+    WButton,
9
+    WCard,
10
+    WCheckbox,
11
+    WDrawer,
12
+    WFlex,
13
+    WIcon,
14
+    WImage,
15
+    WInput,
16
+    WMenu,
17
+    WProgress,
18
+    WOverlay,
19
+    WSlider,
20
+    WSpinner,
21
+    WSteps,
22
+} from '../node_modules/wave-ui/src/wave-ui/components'
23
+
24
+export default {
25
+    WAlert,
26
+    WApp,
27
+    WBadge,
28
+    WButton,
29
+    WCard,
30
+    WCheckbox,
31
+    WDrawer,
32
+    WFlex,
33
+    WIcon,
34
+    WImage,
35
+    WInput,
36
+    WMenu,
37
+    WProgress,
38
+    WOverlay,
39
+    WSlider,
40
+    WSpinner,
41
+    WSteps,
42
+}

+ 10
- 2
frontend/vite.config.js Прегледај датотеку

1
 import { defineConfig } from 'vite'
1
 import { defineConfig } from 'vite'
2
 import vue from '@vitejs/plugin-vue'
2
 import vue from '@vitejs/plugin-vue'
3
-import ViteFS from 'vite-fs'
3
+
4
 // https://vitejs.dev/config/
4
 // https://vitejs.dev/config/
5
 export default defineConfig({
5
 export default defineConfig({
6
-    plugins: [vue(), ViteFS()],
6
+    css: {
7
+        preprocessorOptions: {
8
+            scss: {
9
+                additionalData:
10
+                    '$use-layout-classes: false;@import "/src/../node_modules/wave-ui/src/wave-ui/scss/_variables.scss";',
11
+            },
12
+        },
13
+    },
14
+    plugins: [vue()],
7
     resolve: {
15
     resolve: {
8
         alias: {
16
         alias: {
9
             '@': require('path').resolve(__dirname, 'src'),
17
             '@': require('path').resolve(__dirname, 'src'),

Loading…
Откажи
Сачувај