Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

♻️(frontend) add prop to disable reaction toolbar centering adjustment

lebaudantoinefaa86b829374
diff --git a/src/frontend/src/features/reactions/components/toolbar/ReactionButtonsContainer.tsx b/src/frontend/src/features/reactions/components/toolbar/ReactionButtonsContainer.tsx
index 19737d76..6a14bad3 100644
--- a/src/frontend/src/features/reactions/components/toolbar/ReactionButtonsContainer.tsx
+++ b/src/frontend/src/features/reactions/components/toolbar/ReactionButtonsContainer.tsx
@@ -64,8 +64,10 @@ const SCROLL_AMOUNT = 120 // roughly 3 buttons
export const ReactionButtonsContainer = ({
children,
+ adjustedCentering,
}: {
children: React.ReactNode
+ adjustedCentering?: boolean
}) => {
const { isOpen } = useReactionsToolbar()
const isMobile = useIsMobile()
@@ -93,7 +95,7 @@ export const ReactionButtonsContainer = ({
}, [])
useEffect(() => {
- if (isMobile) return
+ if (isMobile || !adjustedCentering) return
const region = document.getElementById(CONTROL_BAR_REGION_ID)
if (!region) return
const check = () => {
@@ -109,7 +111,7 @@ export const ReactionButtonsContainer = ({
ro.disconnect()
window.removeEventListener('resize', check)
}
- }, [isMobile])
+ }, [isMobile, adjustedCentering])
useLayoutEffect(() => {
if (!shouldBeCenteredWithToggleButton || isMobile) {
@@ -179,7 +181,7 @@ export const ReactionButtonsContainer = ({
aria-hidden={!isOpen}
isVisible={isVisible}
style={
- shouldBeCenteredWithToggleButton && !isMobile
+ shouldBeCenteredWithToggleButton && !isMobile && adjustedCentering
? { marginRight: `${rightOffset}px` }
: { margin: '0 15px' }
}
diff --git a/src/frontend/src/features/reactions/components/toolbar/ReactionsToolbar.tsx b/src/frontend/src/features/reactions/components/toolbar/ReactionsToolbar.tsx
index 8b09b0c0..18845d70 100644
--- a/src/frontend/src/features/reactions/components/toolbar/ReactionsToolbar.tsx
+++ b/src/frontend/src/features/reactions/components/toolbar/ReactionsToolbar.tsx
@@ -17,7 +17,11 @@ const Container = styled('div', {
},
})
-export const ReactionsToolbar = () => {
+export const ReactionsToolbar = ({
+ adjustedCentering,
+}: {
+ adjustedCentering?: boolean
+}) => {
const { isOpen } = useReactionsToolbar()
const shouldMount = useDelayUnmount(isOpen, 300)
@@ -25,7 +29,7 @@ export const ReactionsToolbar = () => {
return (
<Container>
- <ReactionButtonsContainer>
+ <ReactionButtonsContainer adjustedCentering={adjustedCentering}>
{Object.values(Emoji).map((emoji) => (
<ReactionButton key={emoji} emoji={emoji} />
))}