瀏覽代碼

:nut_and_bolt: started frontend NotificationFactory in notification.js utils #TODO import wave into notification.js

tags/0.0.1^2
K Rob 3 年之前
父節點
當前提交
9e42849bc4
共有 5 個檔案被更改,包括 13581 行新增155 行删除
  1. 8276
    10
      backend/package-lock.json
  2. 5275
    119
      frontend/package-lock.json
  3. 3
    3
      frontend/src/services/chat.service.js
  4. 24
    21
      frontend/src/utils/index.js
  5. 3
    2
      frontend/src/views/HomeView.vue

+ 8276
- 10
backend/package-lock.json
文件差異過大導致無法顯示
查看文件


+ 5275
- 119
frontend/package-lock.json
文件差異過大導致無法顯示
查看文件


+ 3
- 3
frontend/src/services/chat.service.js 查看文件

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

+ 24
- 21
frontend/src/utils/index.js 查看文件

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

+ 3
- 2
frontend/src/views/HomeView.vue 查看文件

@@ -4,7 +4,7 @@ main.view--home(
4 4
 )
5 5
     header
6 6
         SummaryBar
7
-        TagList(:icon="{ family: 'mdi', shape: 'heart' }")
7
+        TagList(:icon='{ family: "mdi", shape: "heart" }')
8 8
         AspectBar
9 9
         PairingButton
10 10
         h2 Match Queue
@@ -88,9 +88,10 @@ export default {
88 88
             this.loading = false
89 89
         },
90 90
         // this can be placed in utils/notification.js
91
+
91 92
         notify(payload) {
92 93
             this.$waveui.notify({
93
-                message: payload.timetoken,
94
+                message: payload,
94 95
                 timeout: 6000,
95 96
                 bgColor: 'white',
96 97
                 color: 'success',

Loading…
取消
儲存