Skip to content

Commit

Permalink
feat(FEC-8395): dont render options with one option (language and set…
Browse files Browse the repository at this point in the history
…tings) + remove the isLive - playbackrate (move to core)
  • Loading branch information
itay.kinnrot committed Jul 11, 2018
1 parent 6bb2a35 commit 2338a4b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/components/language/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class LanguageControl extends BaseComponent {
* @returns {React$Element} - component
* @memberof LanguageControl
*/
renderAll(audioOptions: Array<Object>, textOptions: Array<Object>): React$Element<any> {
renderAll(audioOptions: Array<Object>, textOptions: Array<Object>): React$Element<any> | void {
if (audioOptions.length <=1 && textOptions.length <= 1) return undefined;
return (
<div
ref={c => this._controlLanguageElement = c}
Expand Down
4 changes: 1 addition & 3 deletions src/components/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class SettingsControl extends BaseComponent {
});
}

if (props.isLive && qualityOptions.length === 0) return undefined;
if (qualityOptions.length <= 1 && speedOptions.length <= 1) return undefined;
return (
<div
ref={c => this._controlSettingsElement = c}
Expand All @@ -222,14 +222,12 @@ class SettingsControl extends BaseComponent {
{!this.state.smartContainerOpen ? '' :
<SmartContainer title='Settings' onClose={() => this.onControlButtonClick()}>
{
qualityOptions.length <= 1 ? '' :
<Localizer>
<SmartContainerItem icon='quality' label={<Text id='settings.quality'/>} options={qualityOptions}
onSelect={(o) => this.onQualityChange(o)}/>
</Localizer>
}
{
props.isLive ? '' :
<Localizer>
<SmartContainerItem icon='speed' label={<Text id='settings.speed'/>} options={speedOptions}
onSelect={(o) => this.onSpeedChange(o)}/>
Expand Down
5 changes: 4 additions & 1 deletion src/components/smart-container/smart-container-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ class SmartContainerItem extends Component {
* @returns {React$Element} - component element
* @memberof SmartContainer
*/
render(props: any): React$Element<any> {
render(props: any): React$Element<any> | void{
if (props.options && props.options.length <= 1) {
return undefined;
}
return (
<div className={[style.smartContainerItem, style.selectMenuItem].join(' ')}>
<label htmlFor={IconType.Quality}>
Expand Down
3 changes: 2 additions & 1 deletion src/components/smart-container/smart-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class SmartContainer extends Component {
* @returns {React$Element} - component element
* @memberof SmartContainer
*/
render(props: any): React$Element<any> {
render(props: any): React$Element<any> | void {
if (props.children.length == 0) return undefined;
return props.isMobile ? (
<Portal into="#overlay-portal">
<Overlay open onClose={() => props.onClose()}>
Expand Down

0 comments on commit 2338a4b

Please sign in to comment.