Skip to content

Commit 851ca16

Browse files
committed
✨(feat) connect PiP to room and options menu
wire room-level PiP state to the options menu
1 parent df584c7 commit 851ca16

17 files changed

Lines changed: 83 additions & 101 deletions

src/frontend/src/features/rooms/livekit/components/DocumentPiPPortal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,3 @@ export const DocumentPiPPortal = ({
153153

154154
return portal
155155
}
156-

src/frontend/src/features/rooms/livekit/components/PipControlBar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,3 @@ const PipControlsRight = styled('div', {
7171
right: '1.35rem',
7272
},
7373
})
74-

src/frontend/src/features/rooms/livekit/components/PipView.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,3 @@ const PipGridWrapper = styled('div', {
107107
height: '100%',
108108
},
109109
})
110-

src/frontend/src/features/rooms/livekit/components/RoomPiP.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ export const RoomPiP = () => {
1515
</DocumentPiPPortal>
1616
)
1717
}
18-

src/frontend/src/features/rooms/livekit/components/controls/Options/OptionsButton.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import { PipOptionsMenu } from './PipOptionsMenu'
99
export const OptionsButton = () => {
1010
const { t } = useTranslation('rooms')
1111
const portalContainer = useOverlayPortalContainer()
12-
const isInPiP =
13-
portalContainer && portalContainer.ownerDocument !== document
12+
const isInPiP = portalContainer && portalContainer.ownerDocument !== document
1413
const [isOpen, setIsOpen] = useState(false)
1514
const wrapperRef = useRef<HTMLDivElement>(null)
1615

@@ -33,8 +32,6 @@ export const OptionsButton = () => {
3332
}
3433
}, [isInPiP, isOpen])
3534

36-
37-
3835
if (isInPiP) {
3936
return (
4037
<PipOptionsMenu

src/frontend/src/features/rooms/livekit/components/controls/Options/PictureInPictureMenuItem.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ export const PictureInPictureMenuItem = () => {
2121
</MenuItem>
2222
)
2323
}
24-

src/frontend/src/features/rooms/livekit/components/controls/Options/PipOptionsMenu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ export const PipOptionsMenu = ({
3030
const target = event.target as HTMLElement | null
3131
const wrapper = wrapperRef.current
3232
if (!wrapper || !target) return
33-
33+
3434
// Don't close if clicking the trigger button
3535
if (wrapper.querySelector('button')?.contains(target)) return
36-
36+
3737
// Close if clicking a menu item (action will have fired)
3838
if (target.closest('[role="menuitem"]')) {
3939
// Use requestAnimationFrame to ensure action completes first, without visible delay
@@ -83,4 +83,4 @@ export const PipOptionsMenu = ({
8383
)}
8484
</div>
8585
)
86-
}
86+
}

src/frontend/src/features/rooms/livekit/components/controls/PipLateralMenu.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,3 @@ export const PipLateralMenu = () => {
6464
</DialogTrigger>
6565
)
6666
}
67-

src/frontend/src/features/rooms/livekit/hooks/RoomPiPProvider.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ export const RoomPiPProvider = ({
1919

2020
const open = useCallback(() => setIsOpen(true), [])
2121
const close = useCallback(() => setIsOpen(false), [])
22-
const toggle = useCallback(
23-
() => setIsOpen((current) => !current),
24-
[]
25-
)
22+
const toggle = useCallback(() => setIsOpen((current) => !current), [])
2623

2724
const value = useMemo(
2825
() => ({
@@ -36,9 +33,6 @@ export const RoomPiPProvider = ({
3633
)
3734

3835
return (
39-
<RoomPiPContext.Provider value={value}>
40-
{children}
41-
</RoomPiPContext.Provider>
36+
<RoomPiPContext.Provider value={value}>{children}</RoomPiPContext.Provider>
4237
)
4338
}
44-

src/frontend/src/features/rooms/livekit/hooks/roomPiPContext.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ export type RoomPiPContextValue = {
99
}
1010

1111
export const RoomPiPContext = createContext<RoomPiPContextValue | null>(null)
12-

0 commit comments

Comments
 (0)