mirror of
https://github.com/suitenumerique/meet.git
synced 2026-09-04 14:45:40 +00:00
✨(refactor) stabilize pip layout and controls
avoid layout jumps and prepare for more buttons
This commit is contained in:
@@ -11,6 +11,13 @@ import { VideoDeviceControl } from './controls/Device/VideoDeviceControl'
|
|||||||
import { ScreenShareToggle } from './controls/ScreenShareToggle'
|
import { ScreenShareToggle } from './controls/ScreenShareToggle'
|
||||||
import { LeaveButton } from './controls/LeaveButton'
|
import { LeaveButton } from './controls/LeaveButton'
|
||||||
import { ParticipantTile } from './ParticipantTile'
|
import { ParticipantTile } from './ParticipantTile'
|
||||||
|
import { GridLayout } from './layout/GridLayout'
|
||||||
|
import { ReactionsToggle } from './controls/ReactionsToggle'
|
||||||
|
import { SubtitlesToggle } from './controls/SubtitlesToggle'
|
||||||
|
import { HandToggle } from './controls/HandToggle'
|
||||||
|
import { OptionsButton } from './controls/Options/OptionsButton'
|
||||||
|
import { StartMediaButton } from './controls/StartMediaButton'
|
||||||
|
import { SidePanel } from './SidePanel'
|
||||||
|
|
||||||
const pickTrackForPip = (
|
const pickTrackForPip = (
|
||||||
tracks: TrackReferenceOrPlaceholder[]
|
tracks: TrackReferenceOrPlaceholder[]
|
||||||
@@ -35,19 +42,28 @@ export const PipView = () => {
|
|||||||
|
|
||||||
const trackRef = pickTrackForPip(tracks)
|
const trackRef = pickTrackForPip(tracks)
|
||||||
const browserSupportsScreenSharing = supportsScreenSharing()
|
const browserSupportsScreenSharing = supportsScreenSharing()
|
||||||
|
const hasMultipleTiles = tracks.length > 1
|
||||||
|
|
||||||
if (!trackRef) return null
|
if (!trackRef && !hasMultipleTiles) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PipContainer>
|
<PipContainer>
|
||||||
{/* Keep stage height stable to avoid layout shifting on track changes. */}
|
{/* Keep stage height stable to avoid layout shifting on track changes. */}
|
||||||
<PipStage>
|
<PipStage>
|
||||||
<ParticipantTile trackRef={trackRef} disableMetadata />
|
{hasMultipleTiles ? (
|
||||||
|
<GridLayout tracks={tracks} style={{ height: '100%' }}>
|
||||||
|
<ParticipantTile disableMetadata />
|
||||||
|
</GridLayout>
|
||||||
|
) : (
|
||||||
|
<ParticipantTile trackRef={trackRef} disableMetadata />
|
||||||
|
)}
|
||||||
</PipStage>
|
</PipStage>
|
||||||
{/* Compact control bar for PiP; extend here when adding more actions. */}
|
{/* Compact control bar for PiP; extend here when adding more actions. */}
|
||||||
<PipControlsBar
|
<PipControlsBar
|
||||||
showScreenShare={browserSupportsScreenSharing}
|
showScreenShare={browserSupportsScreenSharing}
|
||||||
/>
|
/>
|
||||||
|
{/* Side panel (effects, settings, etc.) opens within PiP window. */}
|
||||||
|
<SidePanel />
|
||||||
</PipContainer>
|
</PipContainer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -69,6 +85,10 @@ const PipContainer = styled('div', {
|
|||||||
height: '100%',
|
height: '100%',
|
||||||
objectFit: 'cover',
|
objectFit: 'cover',
|
||||||
},
|
},
|
||||||
|
'& .lk-grid-layout': {
|
||||||
|
height: '100%',
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -83,12 +103,13 @@ const PipControls = styled('div', {
|
|||||||
base: {
|
base: {
|
||||||
flex: '0 0 auto',
|
flex: '0 0 auto',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
flexWrap: 'wrap',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
gap: '0.5rem',
|
gap: '0.4rem',
|
||||||
padding: '0.5rem',
|
padding: '0.5rem 0.75rem',
|
||||||
backgroundColor: 'primaryDark.100',
|
backgroundColor: 'var(--lk-controlbar-bg)',
|
||||||
borderTop: '1px solid',
|
borderTop: '1px solid',
|
||||||
borderColor: 'primaryDark.200',
|
borderColor: 'var(--lk-control-border-color)',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -100,8 +121,13 @@ const PipControlsBar = ({
|
|||||||
<PipControls>
|
<PipControls>
|
||||||
<AudioDevicesControl hideMenu />
|
<AudioDevicesControl hideMenu />
|
||||||
<VideoDeviceControl hideMenu />
|
<VideoDeviceControl hideMenu />
|
||||||
|
<ReactionsToggle />
|
||||||
{showScreenShare && <ScreenShareToggle />}
|
{showScreenShare && <ScreenShareToggle />}
|
||||||
|
<SubtitlesToggle />
|
||||||
|
<HandToggle />
|
||||||
|
<OptionsButton />
|
||||||
<LeaveButton />
|
<LeaveButton />
|
||||||
|
<StartMediaButton />
|
||||||
</PipControls>
|
</PipControls>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user