import React, { ReactNode } from 'react' import { Annotation, canEditAnnotation } from './annotations' import { AnnotationAuthorshipLine, AnnotationItemRow, AnnotationNote, AnnotationsListContainer } from './annotation-list-items' import { useRoutelessModalsContext } from '../navigation/routeless-modals-context' import { useUserContext } from '../user-context' import { PencilIcon } from '../components/icons' const ScrollableArea = (props: { children: ReactNode }) => (
{props.children}
) export const InteractiveAnnotationsList = ({ annotations, isTouchDevice, closeTooltip }: { annotations: Annotation[] isTouchDevice: boolean closeTooltip: () => void }) => { const { setModal } = useRoutelessModalsContext() const user = useUserContext() const openEdit = (annotation: Annotation) => { closeTooltip() setModal({ type: 'update-annotation', annotation }) } return ( {annotations.map((annotation) => { const editable = canEditAnnotation({ type: annotation.type, user }) const content = ( <> {editable && !isTouchDevice && ( )} ) return ( {editable && isTouchDevice ? ( ) : (
{content}
)}
) })}
) }