✨(frontend) add noise reduction toggle setting with beta label
Implement settings option to enable/disable noise suppression with clear beta indicator. Label will be removed after production battle-testing. Note: Settings styling needs polish, will address in future commits.
This commit is contained in:
committed by
aleb_the_flash
parent
e71bc093bd
commit
fb92e5b79f
@@ -22,6 +22,9 @@ export function usePersistentUserChoices() {
|
|||||||
saveUsername: (username: string) => {
|
saveUsername: (username: string) => {
|
||||||
userChoicesStore.username = username
|
userChoicesStore.username = username
|
||||||
},
|
},
|
||||||
|
saveNoiseReductionEnabled: (enabled: boolean) => {
|
||||||
|
userChoicesStore.noiseReductionEnabled = enabled
|
||||||
|
},
|
||||||
saveProcessorSerialized: (
|
saveProcessorSerialized: (
|
||||||
processorSerialized: ProcessorSerialized | undefined
|
processorSerialized: ProcessorSerialized | undefined
|
||||||
) => {
|
) => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { DialogProps, Field, H } from '@/primitives'
|
import { DialogProps, Field, H, Switch } from '@/primitives'
|
||||||
|
|
||||||
import { TabPanel, TabPanelProps } from '@/primitives/Tabs'
|
import { TabPanel, TabPanelProps } from '@/primitives/Tabs'
|
||||||
import {
|
import {
|
||||||
@@ -13,16 +13,44 @@ import { HStack } from '@/styled-system/jsx'
|
|||||||
import { ActiveSpeaker } from '@/features/rooms/components/ActiveSpeaker'
|
import { ActiveSpeaker } from '@/features/rooms/components/ActiveSpeaker'
|
||||||
import { usePersistentUserChoices } from '@/features/rooms/livekit/hooks/usePersistentUserChoices'
|
import { usePersistentUserChoices } from '@/features/rooms/livekit/hooks/usePersistentUserChoices'
|
||||||
import { ReactNode } from 'react'
|
import { ReactNode } from 'react'
|
||||||
|
import { css } from '@/styled-system/css'
|
||||||
|
|
||||||
type RowWrapperProps = {
|
type RowWrapperProps = {
|
||||||
heading: string
|
heading: string
|
||||||
children: ReactNode[]
|
children: ReactNode[]
|
||||||
|
beta?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const RowWrapper = ({ heading, children }: RowWrapperProps) => {
|
const BetaBadge = () => (
|
||||||
|
<span
|
||||||
|
className={css({
|
||||||
|
content: '"Beta"',
|
||||||
|
display: 'block',
|
||||||
|
letterSpacing: '-0.02rem',
|
||||||
|
padding: '0 0.25rem',
|
||||||
|
backgroundColor: '#E8EDFF',
|
||||||
|
color: '#0063CB',
|
||||||
|
fontSize: '12px',
|
||||||
|
fontWeight: 500,
|
||||||
|
margin: '0 0 0.9375rem 0.3125rem',
|
||||||
|
lineHeight: '1rem',
|
||||||
|
borderRadius: '4px',
|
||||||
|
width: 'fit-content',
|
||||||
|
height: 'fit-content',
|
||||||
|
marginTop: { base: '10px', sm: '5px' },
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
Beta
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
|
||||||
|
const RowWrapper = ({ heading, children, beta }: RowWrapperProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<H lvl={2}>{heading}</H>
|
<HStack>
|
||||||
|
<H lvl={2}>{heading}</H>
|
||||||
|
{beta && <BetaBadge />}
|
||||||
|
</HStack>
|
||||||
<HStack
|
<HStack
|
||||||
gap={0}
|
gap={0}
|
||||||
style={{
|
style={{
|
||||||
@@ -61,7 +89,11 @@ export const AudioTab = ({ id }: AudioTabProps) => {
|
|||||||
const { t } = useTranslation('settings')
|
const { t } = useTranslation('settings')
|
||||||
const { localParticipant } = useRoomContext()
|
const { localParticipant } = useRoomContext()
|
||||||
|
|
||||||
const { saveAudioInputDeviceId } = usePersistentUserChoices()
|
const {
|
||||||
|
userChoices: { noiseReductionEnabled },
|
||||||
|
saveAudioInputDeviceId,
|
||||||
|
saveNoiseReductionEnabled,
|
||||||
|
} = usePersistentUserChoices()
|
||||||
|
|
||||||
const isSpeaking = useIsSpeaking(localParticipant)
|
const isSpeaking = useIsSpeaking(localParticipant)
|
||||||
|
|
||||||
@@ -158,6 +190,20 @@ export const AudioTab = ({ id }: AudioTabProps) => {
|
|||||||
<SoundTester />
|
<SoundTester />
|
||||||
</RowWrapper>
|
</RowWrapper>
|
||||||
)}
|
)}
|
||||||
|
<RowWrapper heading={t('audio.noiseReduction.heading')} beta>
|
||||||
|
<Switch
|
||||||
|
aria-label={t(
|
||||||
|
`audio.noiseReduction.ariaLabel.${noiseReductionEnabled ? 'disable' : 'enable'}`
|
||||||
|
)}
|
||||||
|
isSelected={noiseReductionEnabled}
|
||||||
|
onChange={(v) => {
|
||||||
|
saveNoiseReductionEnabled(v)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t('audio.noiseReduction.label')}
|
||||||
|
</Switch>
|
||||||
|
<div />
|
||||||
|
</RowWrapper>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,14 @@
|
|||||||
"label": "Wählen Sie Ihre Audioeingabe",
|
"label": "Wählen Sie Ihre Audioeingabe",
|
||||||
"disabled": "Mikrofon deaktiviert"
|
"disabled": "Mikrofon deaktiviert"
|
||||||
},
|
},
|
||||||
|
"noiseReduction": {
|
||||||
|
"label": "Rauschunterdrückung",
|
||||||
|
"heading": "Rauschunterdrückung",
|
||||||
|
"ariaLabel": {
|
||||||
|
"enable": "Rauschunterdrückung aktivieren",
|
||||||
|
"disable": "Rauschunterdrückung deaktivieren"
|
||||||
|
}
|
||||||
|
},
|
||||||
"speakers": {
|
"speakers": {
|
||||||
"heading": "Lautsprecher",
|
"heading": "Lautsprecher",
|
||||||
"label": "Wählen Sie Ihre Audioausgabe",
|
"label": "Wählen Sie Ihre Audioausgabe",
|
||||||
|
|||||||
@@ -12,6 +12,14 @@
|
|||||||
"label": "Select your audio input",
|
"label": "Select your audio input",
|
||||||
"disabled": "Microphone disabled"
|
"disabled": "Microphone disabled"
|
||||||
},
|
},
|
||||||
|
"noiseReduction": {
|
||||||
|
"label": "Noise reduction",
|
||||||
|
"heading": "Noise reduction",
|
||||||
|
"ariaLabel": {
|
||||||
|
"enable": "Enable noise reduction",
|
||||||
|
"disable": "Disable noise reduction"
|
||||||
|
}
|
||||||
|
},
|
||||||
"speakers": {
|
"speakers": {
|
||||||
"heading": "Speakers",
|
"heading": "Speakers",
|
||||||
"label": "Select your audio output",
|
"label": "Select your audio output",
|
||||||
|
|||||||
@@ -12,6 +12,14 @@
|
|||||||
"label": "Sélectionner votre entrée audio",
|
"label": "Sélectionner votre entrée audio",
|
||||||
"disabled": "Micro désactivé"
|
"disabled": "Micro désactivé"
|
||||||
},
|
},
|
||||||
|
"noiseReduction": {
|
||||||
|
"label": "Réduction de bruit",
|
||||||
|
"heading": "Réduction de bruit",
|
||||||
|
"ariaLabel": {
|
||||||
|
"enable": "Activer la réduction du bruit",
|
||||||
|
"disable": "Désactiver la réduction du bruit"
|
||||||
|
}
|
||||||
|
},
|
||||||
"speakers": {
|
"speakers": {
|
||||||
"heading": "Haut-parleurs",
|
"heading": "Haut-parleurs",
|
||||||
"label": "Sélectionner votre sortie audio",
|
"label": "Sélectionner votre sortie audio",
|
||||||
|
|||||||
@@ -12,6 +12,14 @@
|
|||||||
"label": "Selecteer uw audioinvoer",
|
"label": "Selecteer uw audioinvoer",
|
||||||
"disabled": "Microfoon uitgeschakeld"
|
"disabled": "Microfoon uitgeschakeld"
|
||||||
},
|
},
|
||||||
|
"noiseReduction": {
|
||||||
|
"label": "Ruisonderdrukking",
|
||||||
|
"heading": "Ruisonderdrukking",
|
||||||
|
"ariaLabel": {
|
||||||
|
"enable": "Ruisonderdrukking inschakelen",
|
||||||
|
"disable": "Ruisonderdrukking uitschakelen"
|
||||||
|
}
|
||||||
|
},
|
||||||
"speakers": {
|
"speakers": {
|
||||||
"heading": "Luidsprekers",
|
"heading": "Luidsprekers",
|
||||||
"label": "Selecteer uw audio-uitvoer",
|
"label": "Selecteer uw audio-uitvoer",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
|
|
||||||
export type LocalUserChoices = LocalUserChoicesLK & {
|
export type LocalUserChoices = LocalUserChoicesLK & {
|
||||||
processorSerialized?: ProcessorSerialized
|
processorSerialized?: ProcessorSerialized
|
||||||
|
noiseReductionEnabled?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserChoicesState(): LocalUserChoices {
|
function getUserChoicesState(): LocalUserChoices {
|
||||||
|
|||||||
Reference in New Issue
Block a user