📱(front) improve control bar responsive

We want the bottom bar to stay at the center of the screen.

Co-authored-by: Nathan Vasse <nathan.vasse@gmail.com>
This commit is contained in:
lebaudantoine
2024-11-28 11:08:14 +01:00
committed by aleb_the_flash
parent fde10e7556
commit ebbdebf444
7 changed files with 70 additions and 22 deletions

View File

@@ -30,7 +30,7 @@ function App() {
<Route component={NotFoundScreen} />
</Switch>
</Layout>
<ReactQueryDevtools initialIsOpen={false} />
<ReactQueryDevtools initialIsOpen={false} buttonPosition="top-left" />
</I18nProvider>
</Suspense>
</QueryClientProvider>

View File

@@ -0,0 +1,37 @@
import { ToggleButton } from '@/primitives'
import { RiQuestionLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { Crisp } from 'crisp-sdk-web'
import { useEffect, useState } from 'react'
export const SupportToggle = () => {
const { t } = useTranslation('rooms', { keyPrefix: 'controls' })
const [isOpened, setIsOpened] = useState($crisp.is('chat:opened'))
useEffect(() => {
Crisp.chat.onChatOpened(() => {
setIsOpened(true)
})
Crisp.chat.onChatClosed(() => {
setIsOpened(false)
})
return () => {
Crisp.chat.offChatOpened()
Crisp.chat.offChatClosed()
}
}, [])
return (
<ToggleButton
square
variant="primaryTextDark"
tooltip={t('support')}
aria-label={t('support')}
isSelected={isOpened}
onPress={() => (isOpened ? Crisp.chat.close() : Crisp.chat.open())}
data-attr="controls-support"
>
<RiQuestionLine />
</ToggleButton>
)
}

View File

@@ -14,6 +14,7 @@ import { SelectToggleDevice } from '../components/controls/SelectToggleDevice'
import { LeaveButton } from '../components/controls/LeaveButton'
import { ScreenShareToggle } from '../components/controls/ScreenShareToggle'
import { css } from '@/styled-system/css'
import { SupportToggle } from '@/features/rooms/livekit/components/controls/SupportToggle.tsx'
/** @public */
export type ControlBarControls = {
@@ -83,28 +84,32 @@ export function ControlBar({
return (
<div
className={css({
alignItems: 'center',
justifyContent: 'space-between',
padding: '.75rem',
maxHeight: 'var(--lk-control-bar-height)',
height: '80px',
width: '100vw',
display: 'flex',
position: 'absolute',
padding: '1.125rem',
bottom: 0,
left: 0,
right: 0,
display: 'flex',
})}
>
<div
className={css({
display: 'flex',
gap: '.5rem',
justifyContent: 'flex-start',
flex: '1 1 33%',
alignItems: 'center',
lg: {
position: 'absolute',
left: '50%',
transform: 'translateX(-50%)',
},
gap: '0.5rem',
marginLeft: '0.5rem',
})}
></div>
<div
className={css({
flex: '1 1 33%',
alignItems: 'center',
justifyContent: 'center',
display: 'flex',
gap: '0.65rem',
})}
>
<SelectToggleDevice
@@ -142,17 +147,16 @@ export function ControlBar({
<div
className={css({
display: 'flex',
gap: '.5rem',
justifyContent: 'flex-end',
flex: '1 1 33%',
alignItems: 'center',
marginRight: '6.25rem',
lg: {
position: 'absolute',
right: 0,
},
gap: '0.5rem',
paddingRight: '0.25rem',
})}
>
<ChatToggle />
<ParticipantsToggle />
<SupportToggle />
</div>
</div>
)

View File

@@ -70,7 +70,8 @@
"participants": {
"open": "",
"closed": ""
}
},
"support": ""
},
"options": {
"buttonLabel": "",

View File

@@ -69,7 +69,8 @@
"participants": {
"open": "Hide everyone",
"closed": "See everyone"
}
},
"support": "Support"
},
"options": {
"buttonLabel": "More Options",

View File

@@ -69,7 +69,8 @@
"participants": {
"open": "Masquer les participants",
"closed": "Afficher les participants"
}
},
"support": "Support"
},
"options": {
"buttonLabel": "Plus d'options",

View File

@@ -25,3 +25,7 @@ body,
transition: none !important;
}
}
body:has(.lk-video-conference) #crisp-chatbox > div > a {
display: none !important;
}