diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index fbb1f7f36..8be52a49b 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -6959,8 +6959,10 @@ button.module-image__border-overlay:focus { z-index: $z-index-above-base; @include keyboard-mode { - &:focus { - outline: 2px solid $color-ultramarine; + &:focus, + &:active, + &:hover { + background-color: $color-ultramarine; } } } @@ -6980,41 +6982,6 @@ button.module-image__border-overlay:focus { .module-calling-device-selection__select { margin-bottom: 20px; position: relative; - - select { - @include font-body-1; - background: $color-gray-75; - color: $color-gray-02; - -webkit-appearance: none; - border-radius: 4px; - border: 1px solid $color-gray-45; - cursor: pointer; - height: 40px; - outline: 0; - padding: 10px; - padding-inline-end: 32px; - text-overflow: ellipsis; - width: 100%; - } - - &::after { - border: 2px solid $color-gray-75; - - border-radius: 2px; - border-inline-end: 0; - border-top: 0; - content: ' '; - display: block; - height: 10px; - pointer-events: none; - position: absolute; - inset-inline-end: 15px; - top: 16px; - transform-origin: center; - transform: rotate(-45deg); - width: 10px; - z-index: $z-index-above-base; - } } // Module: GroupV1 Disabled Actions diff --git a/ts/components/CallingDeviceSelection.tsx b/ts/components/CallingDeviceSelection.tsx index ab92c3251..9746afbaa 100644 --- a/ts/components/CallingDeviceSelection.tsx +++ b/ts/components/CallingDeviceSelection.tsx @@ -4,7 +4,9 @@ import * as React from 'react'; import type { AudioDevice } from '@signalapp/ringrtc'; +import type { Option } from './Select'; import { Modal } from './Modal'; +import { Select } from './Select'; import type { LocalizerType } from '../types/Util'; import type { ChangeIODevicePayloadType, @@ -30,66 +32,44 @@ function localizeDefault(i18n: LocalizerType, deviceLabel: string): string { function renderAudioOptions( devices: Array, - i18n: LocalizerType, - selectedDevice: AudioDevice | undefined -): JSX.Element { + i18n: LocalizerType +): Array - ); + return [ + { + text: i18n('icu:callingDeviceSelection__select--no-device'), + value: '', + }, + ]; } - return ( - <> - {devices.map((device: AudioDevice) => { - const isSelected = - selectedDevice && selectedDevice.index === device.index; - return ( - - ); - })} - - ); + return devices.map(device => { + return { + text: localizeDefault(i18n, device.name), + value: device.index, + }; + }); } function renderVideoOptions( devices: Array, - i18n: LocalizerType, - selectedCamera: string | undefined -): JSX.Element { + i18n: LocalizerType +): Array - ); + return [ + { + text: i18n('icu:callingDeviceSelection__select--no-device'), + value: '', + }, + ]; } - return ( - <> - {devices.map((device: MediaDeviceInfo) => { - const isSelected = selectedCamera === device.deviceId; - - return ( - - ); - })} - - ); + return devices.map((device: MediaDeviceInfo) => { + return { + text: localizeDefault(i18n, device.label), + value: device.deviceId, + }; + }); } function createAudioChangeHandler( @@ -97,10 +77,10 @@ function createAudioChangeHandler( changeIODevice: (payload: ChangeIODevicePayloadType) => void, type: CallingDeviceType.SPEAKER | CallingDeviceType.MICROPHONE ) { - return (ev: React.FormEvent): void => { + return (value: string): void => { changeIODevice({ type, - selectedDevice: devices[Number(ev.currentTarget.value)], + selectedDevice: devices[Number(value)], }); }; } @@ -108,10 +88,10 @@ function createAudioChangeHandler( function createCameraChangeHandler( changeIODevice: (payload: ChangeIODevicePayloadType) => void ) { - return (ev: React.FormEvent): void => { + return (value: string): void => { changeIODevice({ type: CallingDeviceType.CAMERA, - selectedDevice: String(ev.currentTarget.value), + selectedDevice: value, }); }; } @@ -159,14 +139,14 @@ export function CallingDeviceSelection({ {i18n('icu:callingDeviceSelection__label--video')}
- + />