Skip to content

Commit

Permalink
fix(ADA-1383): [Strategic Blue / University of Sheffield] - HD label …
Browse files Browse the repository at this point in the history
…on V7 player Settings button
  • Loading branch information
Tzipi-kaltura committed Jul 29, 2024
1 parent 10e95db commit 0b0bb36
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/components/settings/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ const mapStateToProps = state => ({
});
const COMPONENT_NAME = 'Settings';

const translates = () => ({
buttonLabel: <Text id="controls.settings">Settings</Text>,
qualityHdLabel: <Text id="settings.qualityHdLabel">Quality is HD</Text>,
quality4kLabel: <Text id="settings.quality4kLabel">Quality is 4k</Text>,
quality8kLabel: <Text id="settings.quality8kLabel">Quality is 8k</Text>
});

/**
* Settings component
*
Expand All @@ -57,9 +64,7 @@ const COMPONENT_NAME = 'Settings';
* @extends {Component}
*/
@connect(mapStateToProps, bindActions({...actions, ...overlayIconActions}))
@withText({
buttonLabel: 'controls.settings'
})
@withText(translates)
@withPlayer
@withEventManager
@withKeyboardEvent(COMPONENT_NAME)
Expand Down Expand Up @@ -277,6 +282,19 @@ class Settings extends Component<any, any> {
return activeVideoTrackHeight ? getLabelBadgeType(activeVideoTrackHeight) : null;
}

getQualityLabel(buttonBadgeType): string {
switch (buttonBadgeType) {
case 'qualityHd':
return this.props.qualityHdLabel;
case 'quality4k':
return this.props.quality4kLabel;
case 'quality8k':
return this.props.quality8kLabel;
default:
return '';
}
}

/**
* render component
*
Expand All @@ -297,21 +315,23 @@ class Settings extends Component<any, any> {

const targetId: HTMLDivElement | Document = (document.getElementById(this.props.player.config.targetId) as HTMLDivElement) || document;
const portalSelector = `.overlay-portal`;
const buttonAriaLabel = props.buttonLabel + ' ' + this.getQualityLabel(buttonBadgeType);
return (
<ButtonControl name={COMPONENT_NAME} ref={c => (c ? (this._controlSettingsElement = c) : undefined)}>
<Tooltip label={props.buttonLabel}>
<Button
ref={this.setButtonRef}
tabIndex="0"
aria-label={props.buttonLabel}
aria-label={buttonAriaLabel}
aria-haspopup="true"
className={[
style.controlButton,
style.buttonBadge,
BadgeType[buttonBadgeType + 'Active'],
this.state.smartContainerOpen ? style.active : ''
].join(' ')}
onClick={this.onControlButtonClick}>
onClick={this.onControlButtonClick}
>
<Icon type={IconType.Settings} />
</Button>
</Tooltip>
Expand Down
3 changes: 3 additions & 0 deletions translations/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"speed": "Speed",
"speedNormal": "Normal",
"qualityAuto": "Auto",
"qualityHdLabel": "Quality is HD",
"quality4kLabel": "Quality is 4k",
"quality8kLabel": "Quality is 8k",
"advancedAudioDescription": "Advanced Audio Description"
},
"captions": {
Expand Down

0 comments on commit 0b0bb36

Please sign in to comment.