import { ModalRoot, ModalOverlay, ModalContent, } from '../../elements/ModalPrimitives' import { Box, HStack, VStack, Separator, SpanBox } from '../../elements/LayoutPrimitives' import { Button } from '../../elements/Button' import { StyledText } from '../../elements/StyledText' import { CrossIcon } from '../../elements/images/CrossIcon' import { CommentIcon } from '../../elements/images/CommentIcon' import { TrashIcon } from '../../elements/images/TrashIcon' import { theme } from '../../tokens/stitches.config' import type { Highlight } from '../../../lib/networking/fragments/highlightFragment' import { HighlightView } from '../../patterns/HighlightView' import { useCallback, useState } from 'react' import { StyledTextArea } from '../../elements/StyledTextArea' import { ConfirmationModal } from '../../patterns/ConfirmationModal' import { Pen, Trash } from 'phosphor-react' type HighlightsModalProps = { highlights: Highlight[] scrollToHighlight?: (arg: string) => void; deleteHighlightAction?: (highlightId: string) => void onOpenChange: (open: boolean) => void } export function HighlightsModal(props: HighlightsModalProps): JSX.Element { return ( { event.preventDefault() props.onOpenChange(false) }} css={{ overflow: 'auto', p: '0' }} > All your highlights and notes {props.highlights.map((highlight) => ( { if (props.deleteHighlightAction) { props.deleteHighlightAction(highlight.id) } }} /> ))} {props.highlights.length === 0 && ( You have not added any highlights or notes to this document )} ) } type ModalHighlightViewProps = { highlight: Highlight showDelete: boolean scrollToHighlight?: (arg: string) => void; deleteHighlightAction: () => void } function ModalHighlightView(props: ModalHighlightViewProps): JSX.Element { const [isEditing, setIsEditing] = useState(false) const [showDeleteConfirmation, setShowDeleteConfirmation] = useState(false) const [noteContent, setNoteContent] = useState( props.highlight.annotation ?? '' ) const handleNoteContentChange = useCallback( (event: React.ChangeEvent): void => { setNoteContent(event.target.value) }, [setNoteContent] ) const ButtonStack = (): JSX.Element => ( {/* */} {props.showDelete && ( )} ) const TextEditArea = (): JSX.Element => ( ) return ( <> {props.highlight.annotation && !isEditing ? ( {props.highlight.annotation} ) : null} {isEditing ? : } {showDeleteConfirmation ? ( { setShowDeleteConfirmation(false) props.deleteHighlightAction() }} onOpenChange={() => setShowDeleteConfirmation(false)} icon={ } /> ) : null} ) }