Procházet zdrojové kódy

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

tags/0.0.1^2
K Rob před 3 roky
rodič
revize
9e42849bc4

+ 8276
- 10
backend/package-lock.json
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 5275
- 119
frontend/package-lock.json
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 3
- 3
frontend/src/services/chat.service.js Zobrazit soubor

21
 const setupPubnub = async uuid => {
21
 const setupPubnub = async uuid => {
22
     const publishKey = import.meta.env.VITE_PUBNUB_PUBLISH_KEY
22
     const publishKey = import.meta.env.VITE_PUBNUB_PUBLISH_KEY
23
     const subscribeKey = import.meta.env.VITE_PUBNUB_SUBSCRIBE_KEY
23
     const subscribeKey = import.meta.env.VITE_PUBNUB_SUBSCRIBE_KEY
24
+
24
     if (!uuid) return console.error('no pubnub uuid set')
25
     if (!uuid) return console.error('no pubnub uuid set')
25
 
26
 
26
     const pubnubClient = await new PubNub({
27
     const pubnubClient = await new PubNub({
80
         this.uuid = `${uuid}`
81
         this.uuid = `${uuid}`
81
         this.provider = await setupPubnub(this.uuid)
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
         await this._setupAllChannels(groupings)
86
         await this._setupAllChannels(groupings)
86
         this._listenFor({ listeners: this.listeners })
87
         this._listenFor({ listeners: this.listeners })
87
         this.subscribe({ channels: this.subscriptions })
88
         this.subscribe({ channels: this.subscriptions })
96
      * @return {object} timestamp
97
      * @return {object} timestamp
97
      */
98
      */
98
     async publish(channel, message) {
99
     async publish(channel, message) {
99
-        // console.log('publishing message to channel:', channel)
100
         return providerMethods.publish({
100
         return providerMethods.publish({
101
             channel,
101
             channel,
102
             message: new ChatMessage(message),
102
             message: new ChatMessage(message),

+ 24
- 21
frontend/src/utils/index.js Zobrazit soubor

2
 
2
 
3
 import { Connector } from './db'
3
 import { Connector } from './db'
4
 import { SurveyFactory } from './survey'
4
 import { SurveyFactory } from './survey'
5
+import { NotificationFactory } from './notification'
5
 import { possible } from './lang'
6
 import { possible } from './lang'
6
 import { pidMixin, cardMixin } from './mixins'
7
 import { pidMixin, cardMixin } from './mixins'
7
 
8
 
21
 }
22
 }
22
 
23
 
23
 const surveyFactory = new SurveyFactory(possible['usa'])
24
 const surveyFactory = new SurveyFactory(possible['usa'])
25
+const notificationFactory = new NotificationFactory
24
 
26
 
25
 const mixins = { pidMixin, cardMixin }
27
 const mixins = { pidMixin, cardMixin }
26
 
28
 
74
 
76
 
75
 const randomSurveyResponses = count => {
77
 const randomSurveyResponses = count => {
76
     const surveyResponses = [
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
     return surveyResponses
100
     return surveyResponses
99
 }
101
 }
100
 
102
 
101
-export { 
103
+export {
102
     api,
104
     api,
103
     validatorMapping,
105
     validatorMapping,
104
     surveyFactory,
106
     surveyFactory,
107
+    notificationFactory,
105
     makeKebob,
108
     makeKebob,
106
     mixins,
109
     mixins,
107
     randomSurveyResponses,
110
     randomSurveyResponses,

+ 3
- 2
frontend/src/views/HomeView.vue Zobrazit soubor

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

Načítá se…
Zrušit
Uložit