// Desktop / tablet right-side media pane. Renders the same // `MediaViewerBody` the mobile bottom-up horseshoe shows, but as a // flex sibling next to the chat column instead of a slide-up rail. // // Mounted in `Room.tsx` only on non-mobile screens; mobile uses // `MobileMediaViewerHorseshoe` instead. import React, { useRef } from 'react'; import { useAtomValue } from 'jotai'; import { useTranslation } from 'react-i18next'; import FocusTrap from 'focus-trap-react'; import { mediaViewerAtom } from '../../state/mediaViewer'; import { useCloseMediaViewer } from '../../state/hooks/mediaViewer'; import { stopPropagation } from '../../utils/keyboard'; import { MediaViewerBody } from './MediaViewerBody'; import * as css from './RoomViewMediaSidePanel.css'; export function RoomViewMediaSidePanel() { const { t } = useTranslation(); const entry = useAtomValue(mediaViewerAtom); const close = useCloseMediaViewer(); const open = !!entry; const entryRef = useRef(entry); entryRef.current = entry; if (!open || !entry) return null; return ( true, escapeDeactivates: stopPropagation, onDeactivate: () => { if (entryRef.current) close(); }, checkCanFocusTrap: () => Promise.resolve(), }} active={open} >
); }