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

View File

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

View File

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

View File

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

View File

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