import React, { Fragment } from "react"; import { Link } from "react-router-dom"; import { useAccount, useComment } from "@plebbit/plebbit-react-hooks"; import getDate from "../utils/getDate"; import getCommentMediaInfo from "../utils/getCommentMediaInfo"; import findShortParentCid from "../utils/findShortParentCid"; import Post from "./Post"; import EditLabel from "./EditLabel"; import useStateString from "../hooks/useStateString"; import { BoardForm, Container } from "./styled/views/Board.styled"; import useGeneralStore from "../hooks/stores/useGeneralStore"; const PostOnHover = ({ cid, feed }) => { const selectedStyle = useGeneralStore(state => state.selectedStyle); const account = useAccount(); const reply = useComment({commentCid: cid}); const replyMediaInfo = getCommentMediaInfo(reply); const fallbackImgUrl = "assets/filedeleted-res.gif"; const selectedFeed = feed; const thread = useComment({commentCid: reply.parentCid}); const shortParentCid = findShortParentCid(reply.parentCid, selectedFeed); const stateString = useStateString(reply); return (
{reply.state === 'succeeded' ? (
{reply.author?.displayName ? reply.author?.displayName.length > 20 ? {reply.author?.displayName.slice(0, 20) + " (...)"} : {reply.author?.displayName} : Anonymous}   (u/ {reply.author?.shortAddress ? ( {reply.author?.shortAddress} ) : ( {account?.author?.shortAddress} ) } )   {getDate(reply.timestamp)}   c/ {}} id="reply-button" title="Reply to this post">{reply.shortCid}  
{replyMediaInfo?.url ? (
{replyMediaInfo?.type === "webpage" ? (
{reply.thumbnailUrl ? ( {replyMediaInfo.type} e.target.src = fallbackImgUrl} /> ) : null}
) : null} {replyMediaInfo?.type === "image" ? (
{replyMediaInfo.type} e.target.src = fallbackImgUrl} />
) : null} {replyMediaInfo?.type === "video" ? ( ) : null} {replyMediaInfo?.type === "audio" ? ( ) : null}
) : null} {reply.content ? ( reply.content?.length > 500 ?
{shortParentCid ? ( {}} className="quotelink"> {`c/${shortParentCid}`}{shortParentCid === thread.shortCid ? " (OP)" : null} ) : null} (...)

Comment too long. Click the link to view.
:
{shortParentCid ? ( {}} className="quotelink"> {`c/${shortParentCid}`}{shortParentCid === thread.shortCid ? " (OP)" : null} ) : null}
) : null}
) : (
{stateString}
)}
{reply.state === 'succeeded' ? (
{reply.author?.displayName ? reply.author?.displayName.length > 20 ? {reply.author?.displayName.slice(0, 20) + " (...)"} : {reply.author?.displayName} : Anonymous}   (u/ {reply.author?.shortAddress ? ( {reply.author?.shortAddress} ) : ( {account?.author?.shortAddress} ) } ) 
{getDate(reply.timestamp)}  c/ {}} id="reply-button" >{reply.shortCid}
{reply.link ? (
{replyMediaInfo?.url ? ( replyMediaInfo.type === "webpage" ? (
{reply.thumbnailUrl ? ( thumbnail e.target.src = fallbackImgUrl} /> ) : null}
{replyMediaInfo.type}
) : replyMediaInfo.type === "image" ? (
{replyMediaInfo.type} e.target.src = fallbackImgUrl} />
{replyMediaInfo.type}
) : replyMediaInfo.type === "video" ? ( ) : replyMediaInfo.type === "audio" ? ( ) : null ) : null}
) : null} {reply.content ? ( reply.content?.length > 500 ?
{shortParentCid ? ( {}} className="quotelink"> {`c/${shortParentCid}`}{shortParentCid === thread.shortCid ? " (OP)" : null} ) : null} (...)

Comment too long. Click the link to view.
:
{shortParentCid ? ( {}} className="quotelink" > {`c/${shortParentCid}`}{shortParentCid === thread.shortCid ? " (OP)" : null} ) : null}
) : null}
) : (
{stateString}
)}
); } export default PostOnHover;