💄(frontend) organize blurring options

Add visual container and a heading to indicate buttons are
blurring options.
This commit is contained in:
lebaudantoine
2024-09-19 19:17:04 +02:00
committed by aleb_the_flash
parent 607a5fc99d
commit 021e52d9eb
4 changed files with 53 additions and 31 deletions

View File

@@ -1,7 +1,7 @@
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { useLocalParticipant } from '@livekit/components-react' import { useLocalParticipant } from '@livekit/components-react'
import { LocalVideoTrack } from 'livekit-client' import { LocalVideoTrack } from 'livekit-client'
import { Text, P, ToggleButton } from '@/primitives' import { Text, P, ToggleButton, Div, H } from '@/primitives'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { HStack, VStack } from '@/styled-system/jsx' import { HStack, VStack } from '@/styled-system/jsx'
import { import {
@@ -92,8 +92,8 @@ export const Effects = () => {
muted muted
style={{ style={{
transform: 'rotateY(180deg)', transform: 'rotateY(180deg)',
minHeight: '173px', minHeight: '175px',
borderRadius: '4px', borderRadius: '8px',
}} }}
/> />
) : ( ) : (
@@ -119,34 +119,53 @@ export const Effects = () => {
</P> </P>
</div> </div>
)} )}
{ProcessorWrapper.isSupported ? ( <Div
<HStack> alignItems={'left'}
<ToggleButton width={'100%'}
size={'sm'} style={{
legacyStyle border: '1px solid #dadce0',
aria-label={tooltipLabel(BlurRadius.LIGHT)} borderRadius: '8px',
tooltip={tooltipLabel(BlurRadius.LIGHT)} margin: '0 .625rem',
isDisabled={processorPending} padding: '0.5rem 1rem',
onPress={async () => await toggleBlur(BlurRadius.LIGHT)} }}
isSelected={isSelected(BlurRadius.LIGHT)} >
> <H
{t('blur.light')} lvl={3}
</ToggleButton> style={{
<ToggleButton marginBottom: '0.4rem',
size={'sm'} }}
legacyStyle >
aria-label={tooltipLabel(BlurRadius.NORMAL)} {t('heading')}
tooltip={tooltipLabel(BlurRadius.NORMAL)} </H>
isDisabled={processorPending} {ProcessorWrapper.isSupported ? (
onPress={async () => await toggleBlur(BlurRadius.NORMAL)} <HStack>
isSelected={isSelected(BlurRadius.NORMAL)} <ToggleButton
> size={'sm'}
{t('blur.normal')} legacyStyle
</ToggleButton> aria-label={tooltipLabel(BlurRadius.LIGHT)}
</HStack> tooltip={tooltipLabel(BlurRadius.LIGHT)}
) : ( isDisabled={processorPending}
<Text variant="sm">{t('notAvailable')}</Text> onPress={async () => await toggleBlur(BlurRadius.LIGHT)}
)} isSelected={isSelected(BlurRadius.LIGHT)}
>
{t('blur.light')}
</ToggleButton>
<ToggleButton
size={'sm'}
legacyStyle
aria-label={tooltipLabel(BlurRadius.NORMAL)}
tooltip={tooltipLabel(BlurRadius.NORMAL)}
isDisabled={processorPending}
onPress={async () => await toggleBlur(BlurRadius.NORMAL)}
isSelected={isSelected(BlurRadius.NORMAL)}
>
{t('blur.normal')}
</ToggleButton>
</HStack>
) : (
<Text variant="sm">{t('notAvailable')}</Text>
)}
</Div>
</VStack> </VStack>
) )
} }

View File

@@ -76,6 +76,7 @@
"effects": { "effects": {
"activateCamera": "", "activateCamera": "",
"notAvailable": "", "notAvailable": "",
"heading": "",
"blur": { "blur": {
"light": "", "light": "",
"normal": "", "normal": "",

View File

@@ -74,6 +74,7 @@
"effects": { "effects": {
"activateCamera": "Your camera is disabled. Choose an option to enable it.", "activateCamera": "Your camera is disabled. Choose an option to enable it.",
"notAvailable": "The blur effect will be available soon on your browser. We're working on it! In the meantime, you can use Google Chrome :(", "notAvailable": "The blur effect will be available soon on your browser. We're working on it! In the meantime, you can use Google Chrome :(",
"heading": "Blur",
"blur": { "blur": {
"light": "Light blur", "light": "Light blur",
"normal": "Blur", "normal": "Blur",

View File

@@ -74,6 +74,7 @@
"effects": { "effects": {
"activateCamera": "Votre camera est désactivée. Choisissez une option pour l'activer.", "activateCamera": "Votre camera est désactivée. Choisissez une option pour l'activer.",
"notAvailable": "L'effet de flou sera bientôt disponible sur votre navigateur. Nous y travaillons ! En attendant, vous pouvez utiliser Google Chrome :(", "notAvailable": "L'effet de flou sera bientôt disponible sur votre navigateur. Nous y travaillons ! En attendant, vous pouvez utiliser Google Chrome :(",
"heading": "Flou",
"blur": { "blur": {
"light": "Léger flou", "light": "Léger flou",
"normal": "Flou", "normal": "Flou",