import Item from './item' import ItemJob from './item-job' import Reply from './reply' import Comment from './comment' import Text, { SearchText } from './text' import ZoomableImage from './image' import Comments from './comments' import styles from '@/styles/item.module.css' import itemStyles from './item.module.css' import { useMe } from './me' import Button from 'react-bootstrap/Button' import { TwitterTweetEmbed } from 'react-twitter-embed' import YouTube from 'react-youtube' import useDarkMode from './dark-mode' import { useEffect, useState } from 'react' import Poll from './poll' import { commentsViewed } from '@/lib/new-comments' import Related from './related' import PastBounties from './past-bounties' import Check from '@/svgs/check-double-line.svg' import Share from './share' import Toc from './table-of-contents' import Link from 'next/link' import { RootProvider } from './root' import { IMGPROXY_URL_REGEXP, parseEmbedUrl } from '@/lib/url' import { numWithUnits } from '@/lib/format' import { useQuoteReply } from './use-quote-reply' import { UNKNOWN_LINK_REL } from '@/lib/constants' function BioItem ({ item, handleClick }) { const me = useMe() if (!item.text) { return null } return ( <> {me?.name === item.user.name &&
} ) } function TweetSkeleton () { return (
) } function ItemEmbed ({ item }) { const [darkMode] = useDarkMode() const [overflowing, setOverflowing] = useState(false) const [show, setShow] = useState(false) // This Twitter embed could use similar logic to the video embeds below const twitter = item.url?.match(/^https?:\/\/(?:twitter|x)\.com\/(?:#!\/)?\w+\/status(?:es)?\/(?\d+)/) if (twitter?.groups?.id) { return (
} onLoad={() => setOverflowing(true)} /> {overflowing && !show && }
) } const { provider, id, meta } = parseEmbedUrl(item.url) if (provider === 'youtube') { return (
) } if (provider === 'rumble') { return (