import Link from 'next/link' import { useRouter } from 'next/router' import { useEffect, useState } from 'react' import { Badge, Dropdown } from 'react-bootstrap' 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, 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) useEffect(() => { if (!full) { setHasNewComments(newComments(item)) } }, [item]) return (