Skip to content

Commit 4cfd8df

Browse files
author
Marco Ambrosini
committed
Create tooltip objects and add actions
Signed-off-by: Marco Ambrosini <marcoambrsoini@pm.me>
1 parent 337cdc8 commit 4cfd8df

File tree

2 files changed

+101
-29
lines changed

2 files changed

+101
-29
lines changed

src/components/CallView/shared/LocalMediaControls.vue

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,33 @@
8282
</div>
8383
<div class="network-connection-state">
8484
<Popover
85+
v-if="hasQualityWarning"
8586
:boundaries-element="boundaryElement"
86-
trigger="manual"
87+
trigger="hover"
8788
:open="showQualityWarningTooltip">
8889
<NetworkStrength2Alert
8990
slot="trigger"
9091
fill-color="#e9322d"
9192
title=""
92-
:size="24" />
93-
<template>
94-
<span>{{ qualityWarningTooltip }}</span>
95-
</template>
93+
:size="24"
94+
@mouseover="mouseover = true"
95+
@mouseleave="mouseover = false" />
96+
<div class="hint">
97+
<span>{{ qualityWarningTooltip.message }}</span>
98+
<div class="hint__actions">
99+
<button
100+
v-if="!mouseover && !isQualityWarningTooltipDismissed"
101+
@click="isQualityWarningTooltipDismissed = true">
102+
{{ t('spreed', 'Dismiss') }}
103+
</button>
104+
<button
105+
v-if="hasQualitywarningTooltipAction"
106+
class="primary"
107+
@click="lowerUploadRate">
108+
{{ qualityWarningTooltip.actionLabel }}
109+
</button>
110+
</div>
111+
</div>
96112
</Popover>
97113
</div>
98114
</div>
@@ -137,8 +153,8 @@ export default {
137153
default: '',
138154
},
139155
qualityWarningTooltip: {
140-
type: String,
141-
default: '',
156+
type: Object,
157+
required: true,
142158
},
143159
},
144160
@@ -149,6 +165,8 @@ export default {
149165
screenSharingMenuOpen: false,
150166
splitScreenSharingMenu: false,
151167
boundaryElement: document.querySelector('.main-view'),
168+
isQualityWarningTooltipDismissed: false,
169+
mouseover: false,
152170
}
153171
},
154172
@@ -278,8 +296,20 @@ export default {
278296
return (this.model.attributes.localScreen || this.splitScreenSharingMenu) ? t('spreed', 'Screensharing options') : t('spreed', 'Enable screensharing')
279297
},
280298
299+
hasQualityWarning() {
300+
return this.qualityWarningTooltip.message !== ''
301+
},
302+
303+
hasQualityWarningTooltip() {
304+
return this.hasQualityWarning && !this.isQualityWarningTooltipDismissed
305+
},
306+
307+
hasQualitywarningTooltipAction() {
308+
return this.qualityWarningTooltip.action !== ''
309+
},
310+
281311
showQualityWarningTooltip() {
282-
return this.qualityWarningTooltip !== ''
312+
return this.hasQualityWarningTooltip && !this.isQualityWarningTooltipDismissed
283313
},
284314
285315
},
@@ -418,6 +448,18 @@ export default {
418448
}
419449
})
420450
},
451+
lowerUploadRate() {
452+
if (this.qualityWarningTooltip.action === '') {
453+
return
454+
}
455+
if (this.qualityWarningTooltip.action === 'disableScreenShare') {
456+
this.model.disableScreen() // check the method
457+
this.isQualityWarningTooltipDismissed = true
458+
} else if (this.qualityWarningTooltip.action === 'disableVideo') {
459+
this.model.disableVideo()
460+
this.isQualityWarningTooltipDismissed = true
461+
}
462+
},
421463
},
422464
}
423465
</script>
@@ -525,4 +567,14 @@ export default {
525567
width: 32px;
526568
height: 32px;
527569
}
570+
571+
.hint {
572+
padding: 4px;
573+
text-align: left;
574+
&__actions{
575+
display: flex;
576+
justify-content: space-between;
577+
padding-top:4px;
578+
}
579+
}
528580
</style>

src/components/CallView/shared/LocalVideo.vue

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,23 @@ export default {
170170
171171
senderConnectionQualityIsBad() {
172172
return true
173-
return this.senderConnectionQualityAudioIsBad
174-
|| this.senderConnectionQualityVideoIsBad
175-
|| this.senderConnectionQualityScreenIsBad
173+
// return this.senderConnectionQualityAudioIsBad
174+
// || this.senderConnectionQualityVideoIsBad
175+
// || this.senderConnectionQualityScreenIsBad
176176
},
177177
178178
senderConnectionQualityAudioIsBad() {
179179
return true
180-
return callAnalyzer
181-
&& (callAnalyzer.attributes.senderConnectionQualityAudio === CONNECTION_QUALITY.VERY_BAD
182-
|| callAnalyzer.attributes.senderConnectionQualityAudio === CONNECTION_QUALITY.NO_TRANSMITTED_DATA)
180+
// return callAnalyzer
181+
// && (callAnalyzer.attributes.senderConnectionQualityAudio === CONNECTION_QUALITY.VERY_BAD
182+
// || callAnalyzer.attributes.senderConnectionQualityAudio === CONNECTION_QUALITY.NO_TRANSMITTED_DATA)
183183
},
184184
185185
senderConnectionQualityVideoIsBad() {
186186
return true
187-
return callAnalyzer
188-
&& (callAnalyzer.attributes.senderConnectionQualityVideo === CONNECTION_QUALITY.VERY_BAD
189-
|| callAnalyzer.attributes.senderConnectionQualityVideo === CONNECTION_QUALITY.NO_TRANSMITTED_DATA)
187+
// return callAnalyzer
188+
// && (callAnalyzer.attributes.senderConnectionQualityVideo === CONNECTION_QUALITY.VERY_BAD
189+
// || callAnalyzer.attributes.senderConnectionQualityVideo === CONNECTION_QUALITY.NO_TRANSMITTED_DATA)
190190
},
191191
192192
senderConnectionQualityScreenIsBad() {
@@ -227,7 +227,11 @@ export default {
227227
228228
qualityWarningTooltip() {
229229
if (!this.showQualityWarning) {
230-
return ''
230+
return {
231+
message: '',
232+
actionLabel: '',
233+
action: '',
234+
}
231235
}
232236
233237
return this.qualityWarningScreenTooltip
@@ -240,41 +244,57 @@ export default {
240244
return ''
241245
}
242246
243-
return t('spreed', 'Your internet connection or computer are busy and other participants might be unable to understand you.')
247+
return {
248+
message: t('spreed', 'Your internet connection or computer are busy and other participants might be unable to understand you.'),
249+
actionLabel: '',
250+
action: '',
251+
}
244252
},
245253
246254
qualityWarningVideoTooltip() {
247255
if (!this.showQualityWarning || !this.localMediaModel.attributes.videoEnabled) {
248256
return ''
249257
}
250258
251-
let message = ''
259+
const tooltip = {}
252260
if (this.localMediaModel.attributes.audioEnabled && this.localMediaModel.attributes.localScreen) {
253-
message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to understand and see you. To improve the situation try to disable your video while doing a screenshare.')
261+
tooltip.message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to understand and see you. To improve the situation try to disable your video while doing a screenshare.')
262+
tooltip.actionLabel = t('spreed', 'Disable Video')
263+
tooltip.action = 'disableVideo'
254264
} else if (this.localMediaModel.attributes.audioEnabled) {
255-
message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to understand and see you. To improve the situation try to disable your video.')
265+
tooltip.message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to understand and see you. To improve the situation try to disable your video.')
266+
tooltip.actionLabel = t('spreed', 'Disable Video')
267+
tooltip.action = 'disableVideo'
256268
} else if (this.localMediaModel.attributes.localScreen) {
257-
message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to see you. To improve the situation try to disable your video while doing a screenshare.')
269+
tooltip.message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to see you. To improve the situation try to disable your video while doing a screenshare.')
270+
tooltip.actionLabel = t('spreed', 'Disable Video')
271+
tooltip.action = 'disableVideo'
258272
} else {
259-
message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to see you.')
273+
tooltip.message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to see you.')
274+
tooltip.actionLabel = t('spreed', '')
275+
tooltip.action = ''
260276
}
261277
262-
return message
278+
return tooltip
263279
},
264280
265281
qualityWarningScreenTooltip() {
266282
if (!this.showQualityWarning || !this.localMediaModel.attributes.localScreen || this.localMediaModel.attributes.videoEnabled) {
267283
return ''
268284
}
269285
270-
let message = ''
286+
const tooltip = {}
271287
if (this.localMediaModel.attributes.audioEnabled) {
272-
message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to understand and see your screen. To improve the situation try to disable your screenshare.')
288+
tooltip.message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to understand and see your screen. To improve the situation try to disable your screenshare.')
289+
tooltip.actionLabel = t('spreed', 'Disable screenshare')
290+
tooltip.action = 'disableScreenShare'
273291
} else {
274-
message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to see your screen.')
292+
tooltip.message = t('spreed', 'Your internet connection or computer are busy and other participants might be unable to see your screen.')
293+
tooltip.actionLabel = t('spreed', '')
294+
tooltip.action = ''
275295
}
276296
277-
return message
297+
return tooltip
278298
},
279299
},
280300

0 commit comments

Comments
 (0)