import Link from 'next/link' import { useRouter } from 'next/router' import { useEffect, useState } from 'react' import Badge from 'react-bootstrap/Badge' import Dropdown from 'react-bootstrap/Dropdown' import Countdown from './countdown' import { abbrNum } from '../lib/format' import { newComments } from '../lib/new-comments' import { timeSince } from '../lib/time' import CowboyHat from './cowboy-hat' import { DeleteDropdownItem } from './delete' import styles from './item.module.css' import { useMe } from './me' import MoreIcon from '../svgs/more-fill.svg' import DontLikeThisDropdownItem from './dont-link-this' import BookmarkDropdownItem from './bookmark' import SubscribeDropdownItem from './subscribe' import { CopyLinkDropdownItem } from './share' export default function ItemInfo ({ item, pendingSats, full, commentsText, className, embellishUser, extraInfo, onEdit, editText }) { const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000 const me = useMe() const router = useRouter() const [canEdit, setCanEdit] = useState(item.mine && (Date.now() < editThreshold)) const [hasNewComments, setHasNewComments] = useState(false) const [meTotalSats, setMeTotalSats] = useState(0) useEffect(() => { if (!full) { setHasNewComments(newComments(item)) } }, [item]) useEffect(() => { if (item) setMeTotalSats(item.meSats + item.meAnonSats + pendingSats) }, [item?.meSats, item?.meAnonSats, pendingSats]) return (