1515// with Greenlight; if not, see <http://www.gnu.org/licenses/>.
1616
1717import {
18- VideoCameraIcon , TrashIcon , PencilSquareIcon , ClipboardDocumentIcon , EllipsisVerticalIcon ,
18+ VideoCameraIcon , TrashIcon , PencilSquareIcon , ClipboardDocumentIcon ,
1919} from '@heroicons/react/24/outline' ;
2020import React , { useState } from 'react' ;
2121import PropTypes from 'prop-types' ;
2222import {
2323 Button , Stack , Dropdown ,
2424} from 'react-bootstrap' ;
2525import { useTranslation } from 'react-i18next' ;
26+ import OverlayTrigger from 'react-bootstrap/OverlayTrigger' ;
2627import { useAuth } from '../../contexts/auth/AuthProvider' ;
2728import Spinner from '../shared_components/utilities/Spinner' ;
2829import UpdateRecordingForm from './forms/UpdateRecordingForm' ;
2930import DeleteRecordingForm from './forms/DeleteRecordingForm' ;
3031import Modal from '../shared_components/modals/Modal' ;
3132import { localizeDateTimeString } from '../../helpers/DateTimeHelper' ;
3233import useRedirectRecordingUrl from '../../hooks/mutations/recordings/useRedirectRecordingUrl' ;
33- import useCopyRecordingUrl from '../../hooks/mutations/recordings/useCopyRecordingUrl' ;
3434import SimpleSelect from '../shared_components/utilities/SimpleSelect' ;
35+ import CopyRecordingPopover from './CopyRecordingPopover' ;
3536
3637// TODO: Amir - Refactor this.
3738export default function RecordingRow ( {
@@ -43,10 +44,10 @@ export default function RecordingRow({
4344 const [ isEditing , setIsEditing ] = useState ( false ) ;
4445 const [ isUpdating , setIsUpdating ] = useState ( false ) ;
4546 const [ display , setDisplay ] = useState ( 'invisible' ) ;
47+ const [ showCopyPopover , setShowCopyPopover ] = useState ( false ) ;
4648
4749 const currentUser = useAuth ( ) ;
4850 const redirectRecordingUrl = useRedirectRecordingUrl ( ) ;
49- const copyRecordingUrl = useCopyRecordingUrl ( ) ;
5051 const allowedVisibilities = JSON . parse ( currentUser . permissions ?. AccessToVisibilities ) ;
5152
5253 const localizedTime = localizeDateTimeString ( recording ?. recorded_at , currentUser ?. language ) ;
@@ -170,50 +171,36 @@ export default function RecordingRow({
170171 ) ) }
171172 </ td >
172173 < td className = "border-start-0" >
173- { adminTable
174- ? (
175- < Dropdown className = "float-end cursor-pointer" >
176- < Dropdown . Toggle className = "hi-s" as = { EllipsisVerticalIcon } />
177- < Dropdown . Menu >
178- < Dropdown . Item onClick = { ( ) => copyRecordingUrl . mutate ( { record_id : recording . record_id } ) } >
179- < ClipboardDocumentIcon className = "hi-s me-2" />
180- { t ( 'recording.copy_recording_urls' ) }
181- </ Dropdown . Item >
182- < Modal
183- modalButton = { < Dropdown . Item > < TrashIcon className = "hi-s me-2" /> { t ( 'delete' ) } </ Dropdown . Item > }
184- body = { (
185- < DeleteRecordingForm
186- mutation = { useDeleteAPI }
187- recordId = { recording . record_id }
188- />
189- ) }
174+ < Stack direction = "horizontal" className = "float-end recordings-icons" >
175+ { recording ?. visibility !== 'Unpublished' && (
176+ < OverlayTrigger
177+ trigger = "click"
178+ show = { showCopyPopover }
179+ onToggle = { ( show ) => setShowCopyPopover ( show ) }
180+ rootClose
181+ overlay = { (
182+ < CopyRecordingPopover
183+ recording = { recording }
184+ formats = { formats }
185+ onCopied = { ( ) => setShowCopyPopover ( false ) }
190186 />
191- </ Dropdown . Menu >
192- </ Dropdown >
193- )
194- : (
195- < Stack direction = "horizontal" className = "float-end recordings-icons" >
196- { recording ?. visibility !== 'Unpublished' && (
197- < Button
198- variant = "icon"
199- className = "mt-1 me-3"
200- title = { t ( 'recording.copy_recording_urls' ) }
201- onClick = { ( ) => copyRecordingUrl . mutate ( { record_id : recording . record_id } ) }
202- >
203- < ClipboardDocumentIcon className = "hi-s text-muted" />
204- </ Button >
205187 ) }
206- < Modal
207- modalButton = { < Dropdown . Item className = "btn btn-icon" > < TrashIcon className = "hi-s me-2" title = { t ( 'delete' ) } /> </ Dropdown . Item > }
208- body = { (
209- < DeleteRecordingForm
210- mutation = { useDeleteAPI }
211- recordId = { recording . record_id }
212- />
213- ) }
214- />
215- </ Stack >
188+ >
189+ < Button variant = "icon" className = "mt-1 me-3" title = { t ( 'recording.copy_recording_urls' ) } >
190+ < ClipboardDocumentIcon className = "hi-s text-muted" />
191+ </ Button >
192+ </ OverlayTrigger >
216193 ) }
194+ < Modal
195+ modalButton = { < Dropdown . Item className = "btn btn-icon" > < TrashIcon className = "hi-s me-2" title = { t ( 'delete' ) } /> </ Dropdown . Item > }
196+ body = { (
197+ < DeleteRecordingForm
198+ mutation = { useDeleteAPI }
199+ recordId = { recording . record_id }
200+ />
201+ ) }
202+ />
203+ </ Stack >
217204 </ td >
218205 </ tr >
219206 ) ;
0 commit comments