mirror of
https://github.com/suitenumerique/meet.git
synced 2026-09-04 14:45:40 +00:00
♻️(refactor) move pip feature into dedicated module
group pip components and hooks under features/pip for isolation
This commit is contained in:
+9
-9
@@ -1,13 +1,13 @@
|
|||||||
import { styled } from '@/styled-system/jsx'
|
import { styled } from '@/styled-system/jsx'
|
||||||
import { AudioDevicesControl } from './controls/Device/AudioDevicesControl'
|
import { AudioDevicesControl } from '@/features/rooms/livekit/components/controls/Device/AudioDevicesControl'
|
||||||
import { VideoDeviceControl } from './controls/Device/VideoDeviceControl'
|
import { VideoDeviceControl } from '@/features/rooms/livekit/components/controls/Device/VideoDeviceControl'
|
||||||
import { ScreenShareToggle } from './controls/ScreenShareToggle'
|
import { ScreenShareToggle } from '@/features/rooms/livekit/components/controls/ScreenShareToggle'
|
||||||
import { LeaveButton } from './controls/LeaveButton'
|
import { LeaveButton } from '@/features/rooms/livekit/components/controls/LeaveButton'
|
||||||
import { ReactionsToggle } from './controls/ReactionsToggle'
|
import { ReactionsToggle } from '@/features/rooms/livekit/components/controls/ReactionsToggle'
|
||||||
import { SubtitlesToggle } from './controls/SubtitlesToggle'
|
import { SubtitlesToggle } from '@/features/rooms/livekit/components/controls/SubtitlesToggle'
|
||||||
import { HandToggle } from './controls/HandToggle'
|
import { HandToggle } from '@/features/rooms/livekit/components/controls/HandToggle'
|
||||||
import { OptionsButton } from './controls/Options/OptionsButton'
|
import { OptionsButton } from '@/features/rooms/livekit/components/controls/Options/OptionsButton'
|
||||||
import { StartMediaButton } from './controls/StartMediaButton'
|
import { StartMediaButton } from '@/features/rooms/livekit/components/controls/StartMediaButton'
|
||||||
import { PipLateralMenu } from './controls/PipLateralMenu'
|
import { PipLateralMenu } from './controls/PipLateralMenu'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+3
-3
@@ -6,9 +6,9 @@ import {
|
|||||||
} from '@livekit/components-core'
|
} from '@livekit/components-core'
|
||||||
import { useTracks } from '@livekit/components-react'
|
import { useTracks } from '@livekit/components-react'
|
||||||
import { Track } from 'livekit-client'
|
import { Track } from 'livekit-client'
|
||||||
import { ParticipantTile } from './ParticipantTile'
|
import { ParticipantTile } from '@/features/rooms/livekit/components/ParticipantTile'
|
||||||
import { GridLayout } from './layout/GridLayout'
|
import { GridLayout } from '@/features/rooms/livekit/components/layout/GridLayout'
|
||||||
import { SidePanel } from './SidePanel'
|
import { SidePanel } from '@/features/rooms/livekit/components/SidePanel'
|
||||||
import { PipControlBar } from './PipControlBar'
|
import { PipControlBar } from './PipControlBar'
|
||||||
|
|
||||||
const pickTrackForPip = (
|
const pickTrackForPip = (
|
||||||
+5
-5
@@ -6,11 +6,11 @@ import { RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react'
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { StyledPopover } from '@/primitives/Popover'
|
import { StyledPopover } from '@/primitives/Popover'
|
||||||
import { useOverlayBoundaryElement } from '@/primitives/useOverlayPortalContainer'
|
import { useOverlayBoundaryElement } from '@/primitives/useOverlayPortalContainer'
|
||||||
import { ChatToggle } from './ChatToggle'
|
import { ChatToggle } from '@/features/rooms/livekit/components/controls/ChatToggle'
|
||||||
import { ParticipantsToggle } from './Participants/ParticipantsToggle'
|
import { ParticipantsToggle } from '@/features/rooms/livekit/components/controls/Participants/ParticipantsToggle'
|
||||||
import { ToolsToggle } from './ToolsToggle'
|
import { ToolsToggle } from '@/features/rooms/livekit/components/controls/ToolsToggle'
|
||||||
import { InfoToggle } from './InfoToggle'
|
import { InfoToggle } from '@/features/rooms/livekit/components/controls/InfoToggle'
|
||||||
import { AdminToggle } from '../AdminToggle'
|
import { AdminToggle } from '@/features/rooms/livekit/components/AdminToggle'
|
||||||
|
|
||||||
const NavigationControls = ({ onPress }: { onPress?: () => void }) => (
|
const NavigationControls = ({ onPress }: { onPress?: () => void }) => (
|
||||||
<>
|
<>
|
||||||
+1
-1
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react'
|
|||||||
import { RiMoreFill } from '@remixicon/react'
|
import { RiMoreFill } from '@remixicon/react'
|
||||||
import { Box, Button } from '@/primitives'
|
import { Box, Button } from '@/primitives'
|
||||||
import { css } from '@/styled-system/css'
|
import { css } from '@/styled-system/css'
|
||||||
import { OptionsMenuItems } from './OptionsMenuItems'
|
import { OptionsMenuItems } from '@/features/rooms/livekit/components/controls/Options/OptionsMenuItems'
|
||||||
|
|
||||||
type PipOptionsMenuProps = {
|
type PipOptionsMenuProps = {
|
||||||
wrapperRef: React.RefObject<HTMLDivElement>
|
wrapperRef: React.RefObject<HTMLDivElement>
|
||||||
+2
-21
@@ -3,8 +3,8 @@ import { RiMoreFill } from '@remixicon/react'
|
|||||||
import { Button, Menu } from '@/primitives'
|
import { Button, Menu } from '@/primitives'
|
||||||
import { OptionsMenuItems } from './OptionsMenuItems'
|
import { OptionsMenuItems } from './OptionsMenuItems'
|
||||||
import { useOverlayPortalContainer } from '@/primitives/useOverlayPortalContainer'
|
import { useOverlayPortalContainer } from '@/primitives/useOverlayPortalContainer'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useRef, useState } from 'react'
|
||||||
import { PipOptionsMenu } from './PipOptionsMenu'
|
import { PipOptionsMenu } from '@/features/pip/components/controls/PipOptionsMenu'
|
||||||
|
|
||||||
export const OptionsButton = () => {
|
export const OptionsButton = () => {
|
||||||
const { t } = useTranslation('rooms')
|
const { t } = useTranslation('rooms')
|
||||||
@@ -13,25 +13,6 @@ export const OptionsButton = () => {
|
|||||||
const [isOpen, setIsOpen] = useState(false)
|
const [isOpen, setIsOpen] = useState(false)
|
||||||
const wrapperRef = useRef<HTMLDivElement>(null)
|
const wrapperRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!isOpen || !isInPiP) return
|
|
||||||
const doc = wrapperRef.current?.ownerDocument ?? document
|
|
||||||
|
|
||||||
const handlePointerDown = (event: PointerEvent) => {
|
|
||||||
const target = event.target as Node | null
|
|
||||||
const wrapper = wrapperRef.current
|
|
||||||
if (!wrapper || !target) return
|
|
||||||
if (!wrapper.contains(target)) {
|
|
||||||
setIsOpen(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
doc.addEventListener('pointerdown', handlePointerDown, true)
|
|
||||||
return () => {
|
|
||||||
doc.removeEventListener('pointerdown', handlePointerDown, true)
|
|
||||||
}
|
|
||||||
}, [isInPiP, isOpen])
|
|
||||||
|
|
||||||
if (isInPiP) {
|
if (isInPiP) {
|
||||||
return (
|
return (
|
||||||
<PipOptionsMenu
|
<PipOptionsMenu
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import { MenuItem } from 'react-aria-components'
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { RiPictureInPicture2Line } from '@remixicon/react'
|
import { RiPictureInPicture2Line } from '@remixicon/react'
|
||||||
import { menuRecipe } from '@/primitives/menuRecipe'
|
import { menuRecipe } from '@/primitives/menuRecipe'
|
||||||
import { useRoomPiP } from '../../../hooks/useRoomPiP'
|
import { useRoomPiP } from '@/features/pip/hooks/useRoomPiP'
|
||||||
|
|
||||||
export const PictureInPictureMenuItem = () => {
|
export const PictureInPictureMenuItem = () => {
|
||||||
const { t } = useTranslation('rooms', { keyPrefix: 'options.items' })
|
const { t } = useTranslation('rooms', { keyPrefix: 'options.items' })
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import { SettingsDialogExtendedKey } from '@/features/settings/type'
|
|||||||
import { useVideoResolutionSubscription } from '../hooks/useVideoResolutionSubscription'
|
import { useVideoResolutionSubscription } from '../hooks/useVideoResolutionSubscription'
|
||||||
import { SettingsDialogProvider } from '@/features/settings/components/SettingsDialogProvider'
|
import { SettingsDialogProvider } from '@/features/settings/components/SettingsDialogProvider'
|
||||||
import { IsIdleDisconnectModal } from '../components/IsIdleDisconnectModal'
|
import { IsIdleDisconnectModal } from '../components/IsIdleDisconnectModal'
|
||||||
import { RoomPiP } from '../components/RoomPiP'
|
import { RoomPiP } from '@/features/pip/components/RoomPiP'
|
||||||
import { getParticipantName } from '@/features/rooms/utils/getParticipantName'
|
import { getParticipantName } from '@/features/rooms/utils/getParticipantName'
|
||||||
import { useScreenReaderAnnounce } from '@/hooks/useScreenReaderAnnounce'
|
import { useScreenReaderAnnounce } from '@/hooks/useScreenReaderAnnounce'
|
||||||
import { ReactionPortals } from '@/features/reactions/components/ReactionPortals'
|
import { ReactionPortals } from '@/features/reactions/components/ReactionPortals'
|
||||||
|
|||||||
Reference in New Issue
Block a user