mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-23 00:27:09 +00:00
fixup! wip handle device in use
This commit is contained in:
+12
-6
@@ -5,16 +5,18 @@ import { css } from '@/styled-system/css'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
type PermissionNeededButtonProps = {
|
||||
tooltip?: string
|
||||
onPress?: () => void
|
||||
tooltip?: string | null
|
||||
onPress?: (() => void) | null
|
||||
ariaLabel?: string
|
||||
}
|
||||
|
||||
export const PermissionNeededButton = ({
|
||||
tooltip,
|
||||
onPress,
|
||||
ariaLabel,
|
||||
}: PermissionNeededButtonProps) => {
|
||||
const { t } = useTranslation('rooms', { keyPrefix: 'permissionsButton' })
|
||||
const label = tooltip ?? t('tooltip')
|
||||
const label = tooltip === undefined ? t('tooltip') : tooltip
|
||||
return (
|
||||
<div
|
||||
className={css({
|
||||
@@ -26,9 +28,13 @@ export const PermissionNeededButton = ({
|
||||
})}
|
||||
>
|
||||
<Button
|
||||
aria-label={tooltip ? label : t('ariaLabel')}
|
||||
tooltip={label}
|
||||
onPress={onPress ?? (() => openPermissionsDialog())}
|
||||
aria-label={ariaLabel ?? label ?? t('ariaLabel')}
|
||||
tooltip={label ?? undefined}
|
||||
onPress={
|
||||
onPress === undefined
|
||||
? () => openPermissionsDialog()
|
||||
: (onPress ?? undefined)
|
||||
}
|
||||
variant="permission"
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -206,11 +206,12 @@ export const ToggleDevice = <T extends ToggleSource>({
|
||||
)}
|
||||
{deviceInUse && (
|
||||
<PermissionNeededButton
|
||||
tooltip={explainDeviceInUse ? t(`deviceInUse.${kind}`) : undefined}
|
||||
tooltip={explainDeviceInUse ? t(`deviceInUse.${kind}`) : null}
|
||||
ariaLabel={t(`deviceInUse.${kind}`)}
|
||||
onPress={
|
||||
explainDeviceInUse
|
||||
? () => setAlertError(MediaDeviceFailure.DeviceInUse)
|
||||
: undefined
|
||||
: null
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -78,7 +78,7 @@ export const useWatchMediaDeviceErrors = (): MediaDeviceAlert & {
|
||||
const permissionKind = PERMISSION_BY_DEVICE_KIND[kind]
|
||||
switch (failure) {
|
||||
case MediaDeviceFailure.DeviceInUse:
|
||||
noteDeviceInUse(permissionKind)
|
||||
if (permissionKind) noteDeviceInUse(permissionKind)
|
||||
setAlert({ error: failure, kind })
|
||||
break
|
||||
case MediaDeviceFailure.NotFound:
|
||||
|
||||
Reference in New Issue
Block a user