import * as React from 'react' import { Popup as LeafletPopup } from 'react-leaflet' import { Item } from '../../../types' import { ItemFormPopupProps } from './ItemFormPopup' import { HeaderView } from './ItemPopupComponents/HeaderView' import { TextView } from './ItemPopupComponents/TextView' import { timeAgo } from '../../../Utils/TimeAgo' import { useState } from 'react' export interface ItemViewPopupProps { item: Item, children?: React.ReactNode; setItemFormPopup?: React.Dispatch> } export const ItemViewPopup = React.forwardRef((props: ItemViewPopupProps, ref: any) => { const [infoExpanded, setInfoExpanded] = useState(false); return (
{props.children ? React.Children.toArray(props.children).map((child) => React.isValidElement<{ item: Item, test: string }>(child) ? React.cloneElement(child, { item: props.item }) : "" ) : }
{ infoExpanded ?

setInfoExpanded(false)}>{`posted ${props.item && props.item.user_created && props.item.user_created.first_name ? `by ${props.item.user_created.first_name}` : ""} ${timeAgo(props.item.date_created!)}`}

:

setInfoExpanded(true)}>ⓘ

}
{ //** */ }
) })