From 10c8d380b76569829c3d2d74ebdd0e93754d576e Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Tue, 3 Apr 2018 10:07:57 -0700 Subject: [PATCH] fix(video-quality): different tooltips for different definitions --- lang/main.json | 3 +++ .../components/VideoQualityLabel.web.js | 22 +++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lang/main.json b/lang/main.json index 2dc5b26f0..9db599239 100644 --- a/lang/main.json +++ b/lang/main.json @@ -451,11 +451,13 @@ "videoStatus": { "callQuality": "Call Quality", "hd": "HD", + "hdTooltip": "Viewing high definition video", "highDefinition": "High definition", "labelTooltipAudioOnly": "Audio-only mode enabled", "labelTooiltipNoVideo": "No video", "labelTooltipVideo": "Current video quality", "ld": "LD", + "ldTooltip": "Viewing low definition video", "lowDefinition": "Low definition", "onlyAudioAvailable": "Only audio is available", "onlyAudioSupported": "We only support audio in this browser.", @@ -463,6 +465,7 @@ "p2pVideoQualityDescription": "In peer to peer mode, received call quality can only be toggled between high and audio only. Other settings will not be honored until peer to peer is exited.", "recHighDefinitionOnly": "Will prefer high definition.", "sd": "SD", + "sdTooltip": "Viewing standard definition video", "standardDefinition": "Standard definition", "qualityButtonTip": "Change received video quality" }, diff --git a/react/features/video-quality/components/VideoQualityLabel.web.js b/react/features/video-quality/components/VideoQualityLabel.web.js index 4c0d7c662..fc303944a 100644 --- a/react/features/video-quality/components/VideoQualityLabel.web.js +++ b/react/features/video-quality/components/VideoQualityLabel.web.js @@ -153,8 +153,11 @@ export class VideoQualityLabel extends Component { labelContent = ; tooltipKey = 'videoStatus.labelTooiltipNoVideo'; } else { - labelContent = this._mapResolutionToTranslation(_resolution); - tooltipKey = 'videoStatus.labelTooltipVideo'; + const translationKeys + = this._mapResolutionToTranslationsKeys(_resolution); + + labelContent = t(translationKeys.labelKey); + tooltipKey = translationKeys.tooltipKey; } @@ -174,16 +177,16 @@ export class VideoQualityLabel extends Component { } /** - * Matches the passed in resolution with a translation key for describing + * Matches the passed in resolution with a translation keys for describing * the resolution. The passed in resolution will be matched with a known * resolution that it is at least greater than or equal to. * * @param {number} resolution - The video height to match with a * translation. * @private - * @returns {string} + * @returns {Object} */ - _mapResolutionToTranslation(resolution) { + _mapResolutionToTranslationsKeys(resolution) { // Set the default matching resolution of the lowest just in case a // match is not found. let highestMatchingResolution = RESOLUTIONS[0]; @@ -198,8 +201,13 @@ export class VideoQualityLabel extends Component { } } - return this.props.t( - RESOLUTION_TO_TRANSLATION_KEY[highestMatchingResolution]); + const labelKey + = RESOLUTION_TO_TRANSLATION_KEY[highestMatchingResolution]; + + return { + labelKey, + tooltipKey: `${labelKey}Tooltip` + }; } }