import Link from 'next/link' import styles from './item.module.css' import UpVote from './upvote' import { useRef } from 'react' import { AD_USER_ID, NOFOLLOW_LIMIT } from '../lib/constants' import Pin from '../svgs/pushpin-fill.svg' import reactStringReplace from 'react-string-replace' import PollIcon from '../svgs/bar-chart-horizontal-fill.svg' import BountyIcon from '../svgs/bounty-bag.svg' import ActionTooltip from './action-tooltip' import ImageIcon from '../svgs/image-fill.svg' import { numWithUnits } from '../lib/format' import ItemInfo from './item-info' import Prism from '../svgs/prism.svg' import { commentsViewedAt } from '../lib/new-comments' import { useRouter } from 'next/router' import { Badge } from 'react-bootstrap' import AdIcon from '../svgs/advertisement-fill.svg' import { DownZap } from './dont-link-this' export function SearchTitle ({ title }) { return reactStringReplace(title, /\*\*\*([^*]+)\*\*\*/g, (match, i) => { return {match} }) } export default function Item ({ item, rank, belowTitle, right, full, children, siblingComments, onQuoteReply, pinnable }) { const titleRef = useRef() const router = useRouter() const image = item.url && item.url.startsWith(process.env.NEXT_PUBLIC_IMGPROXY_URL) const nofollow = item.sats + item.boost < NOFOLLOW_LIMIT && !item.position ? 'nofollow' : '' return ( <> {rank ? (