| 1 |
/** |
| 2 |
* WordPress dependencies |
| 3 |
*/ |
| 4 |
import { compose } from '@wordpress/compose'; |
| 5 |
import { withSelect } from '@wordpress/data'; |
| 6 |
|
| 7 |
export function SelectVoiceCheck( { hasSelectVoiceAction, children } ) { |
| 8 |
if ( ! hasSelectVoiceAction ) { |
| 9 |
return null; |
| 10 |
} |
| 11 |
|
| 12 |
return children; |
| 13 |
} |
| 14 |
|
| 15 |
export default compose( [ |
| 16 |
withSelect( ( select ) => { |
| 17 |
const { getSettings } = select( 'beyondwords/settings' ); |
| 18 |
|
| 19 |
const { languages } = getSettings(); |
| 20 |
|
| 21 |
return { |
| 22 |
hasSelectVoiceAction: languages?.length, |
| 23 |
}; |
| 24 |
} ), |
| 25 |
] )( SelectVoiceCheck ); |
| 26 |
|