diff --git a/src/components/views/All.jsx b/src/components/views/All.jsx index 7e4feaa9..1bd1698f 100755 --- a/src/components/views/All.jsx +++ b/src/components/views/All.jsx @@ -720,7 +720,7 @@ const All = () => { commentMediaInfo?.url.slice(0, 30) + "(...)" : commentMediaInfo?.url } ({commentMediaInfo?.type === "iframe" ? "video" : commentMediaInfo?.type}) - {isThreadThumbnailClicked[index] ? ( + {isThreadThumbnailClicked[index] && commentMediaInfo.type !== "image" ? ( -[ { replyMediaInfo?.url.slice(0, 30) + "(...)" : replyMediaInfo?.url } ({replyMediaInfo?.type}) - {replyMediaInfo?.type === "video" || "iframe" ? ( + {replyMediaInfo?.type === "video" || replyMediaInfo?.type === "iframe" ? ( isReplyThumbnailClicked[index] ? ( -[ @@ -1844,7 +1844,7 @@ const All = () => { style={{cursor: "pointer"}} onError={(e) => e.target.src = fallbackImgUrl} /> )} - {commentMediaInfo?.type === "video" || "iframe" ? ( + {commentMediaInfo?.type === "video" || commentMediaInfo?.type === "iframe" ? ( isMobileThreadThumbnailClicked[index] ? (
{ onError={(e) => e.target.src = fallbackImgUrl} /> )} - {commentMediaInfo?.type === "video" || "iframe" ? ( + {commentMediaInfo?.type === "video" || commentMediaInfo?.type === "iframe" ? ( isMobileThreadThumbnailClicked[index] ? (
{ return ( -
{setIsHoveringOnThread(thread.cid)}} +
{handleMouseOnLeaveThread()}}> {isHoveringOnThread === thread.cid ? -
handleMouseOnLeaveThread()} - style={{ - opacity: isCalculationDone && isEnoughSpaceOnRight !== null ? 1 : 0, - visibility: isCalculationDone && isEnoughSpaceOnRight !== null ? 'visible' : 'hidden', - left: isCalculationDone && isEnoughSpaceOnRight !== null && isEnoughSpaceOnRight - ? isMediaShowed - ? `calc(50% + ${imageRect.width}px / 2 + 5px)` - : `calc(50% + ${textRect.width}px / 2 + 5px)` - : 'auto', - right: isCalculationDone && isEnoughSpaceOnRight !== null && !isEnoughSpaceOnRight - ? isMediaShowed - ? `calc(50% + ${imageRect.width}px / 2 + 5px)` - : `calc(50% + ${textRect.width}px / 2 + 5px)` - : 'auto', - }} - className="thread_popup"> -

- - {thread.title ? `${thread.title} ` : "Posted "} - - by - - {thread.author.displayName ?` ${thread.author.displayName} ` : " Anonymous "} - - {thread.timestamp ? getFormattedTime(thread.timestamp) : null}

-
- {thread.replyCount > 0 ? -

- Last reply by Anonymous - {getFormattedTime(thread.lastReplyTimestamp)}

- : null}
-
: null } +
handleMouseOnLeaveThread()} + style={{ + opacity: isCalculationDone && isEnoughSpaceOnRight !== null ? 1 : 0, + visibility: isCalculationDone && isEnoughSpaceOnRight !== null ? 'visible' : 'hidden', + left: isCalculationDone && isEnoughSpaceOnRight !== null && isEnoughSpaceOnRight + ? isMediaShowed + ? `calc(50% + ${imageRect.width}px / 2 + 5px)` + : `calc(50% + ${textRect.width}px / 2 + 5px)` + : 'auto', + right: isCalculationDone && isEnoughSpaceOnRight !== null && !isEnoughSpaceOnRight + ? isMediaShowed + ? `calc(50% + ${imageRect.width}px / 2 + 5px)` + : `calc(50% + ${textRect.width}px / 2 + 5px)` + : 'auto', + }} + className="thread_popup"> +

+ + {thread.title ? `${thread.title} ` : "Posted "} + + by + + {thread.author.displayName ?` ${thread.author.displayName} ` : " Anonymous "} + + {thread.timestamp ? getFormattedTime(thread.timestamp) : null} +

+
+ {thread.replyCount > 0 ? +

+ Last reply by Anonymous + {getFormattedTime(thread.lastReplyTimestamp)} +

+ : null} +
+
+ : null } {commentMediaInfo?.url ? ( setSelectedThread(thread.cid)}> + onClick={() => setSelectedThread(thread.cid)} onMouseOver={() => {setIsHoveringOnThread(thread.cid)}}> {commentMediaInfo?.type === "webpage" ? ( thread.thumbnailUrl ? ( @@ -398,6 +400,13 @@ const CatalogPost = ({post}) => { ) : null ) : null} + {commentMediaInfo?.type === "iframe" && (thread.thumbnailUrl || commentMediaInfo.thumbnail) ? ( + + {commentMediaInfo.type} { e.target.src = fallbackImgUrl }} /> + + ) : null} {commentMediaInfo?.type === "image" ? ( { ) : null}
- {(commentMediaInfo && ( - commentMediaInfo.type === 'image' || - commentMediaInfo.type === 'video' || - (commentMediaInfo.type === 'webpage' && - commentMediaInfo.thumbnail))) ? ( + {isMediaShowed ? ( { tooltipPlace="top" /> )}
- handleMouseOnLeaveThread()} style={{ all: "unset"}}>
R: {thread.replyCount} @@ -594,7 +599,7 @@ const CatalogPost = ({post}) => { onClick={() => setSelectedThread(thread.cid)}>
(threadRefs.current[thread.cid] = el)}> - + {setIsHoveringOnThread(thread.cid)}}> {thread.title ? `${thread.title}` : null} {thread.content ? `: ${thread.content}` : null} diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx index 62aa4625..758721f0 100755 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -1416,7 +1416,7 @@ const Board = () => { commentMediaInfo?.url.slice(0, 30) + "(...)" : commentMediaInfo?.url } ({commentMediaInfo?.type === "iframe" ? "video" : commentMediaInfo?.type}) - {isThreadThumbnailClicked[index] ? ( + {isThreadThumbnailClicked[index] && commentMediaInfo.type !== "image" ? ( -[ { replyMediaInfo?.url.slice(0, 30) + "(...)" : replyMediaInfo?.url } ({replyMediaInfo?.type}) - {replyMediaInfo?.type === "video" || "iframe" ? ( - isReplyThumbnailClicked[index] ? ( + {replyMediaInfo?.type === "video" || replyMediaInfo?.type === "iframe" ? ( + isReplyThumbnailClicked[index] && commentMediaInfo.type !== "image" ? ( -[ { style={{cursor: "pointer"}} onError={(e) => e.target.src = fallbackImgUrl} /> )} - {commentMediaInfo?.type === "video" || "iframe" ? ( + {commentMediaInfo?.type === "video" || commentMediaInfo?.type === "iframe" ? ( isMobileThreadThumbnailClicked[index] ? (
{ onError={(e) => e.target.src = fallbackImgUrl} /> )} - {commentMediaInfo?.type === "video" || "iframe" ? ( + {commentMediaInfo?.type === "video" || commentMediaInfo?.type === "iframe" ? ( isMobileThreadThumbnailClicked[index] ? (
{ onError={(e) => e.target.src = fallbackImgUrl} /> )} - {replyMediaInfo?.type === "video" || "iframe" ? ( + {replyMediaInfo?.type === "video" || replyMediaInfo?.type === "iframe" ? ( isMobileReplyThumbnailClicked[index] ? (
{ } else { return (
{handleMouseOnLeaveThread()}} onMouseOver={() => setIsHoveringOnThread(thread.cid)}> - {isHoveringOnThread === thread.cid ? -
handleMouseOnLeaveThread()} - style={{ - opacity: isCalculationDone && isEnoughSpaceOnRight !== null ? 1 : 0, - visibility: isCalculationDone && isEnoughSpaceOnRight !== null ? 'visible' : 'hidden', - left: isCalculationDone && isEnoughSpaceOnRight !== null && isEnoughSpaceOnRight - ? isMediaShowed - ? `calc(50% + ${imageRect.width}px / 2 + 5px)` - : `calc(50% + ${textRect.width}px / 2 + 5px)` - : 'auto', - right: isCalculationDone && isEnoughSpaceOnRight !== null && !isEnoughSpaceOnRight - ? isMediaShowed - ? `calc(50% + ${imageRect.width}px / 2 + 5px)` - : `calc(50% + ${textRect.width}px / 2 + 5px)` - : 'auto', - }} - className="thread_popup"> -

- - {thread.title ? `${thread.title} ` : "Posted "} - - by - - {thread.author.displayName ?` ${thread.author.displayName} ` : " Anonymous "} - - {thread.timestamp ? getFormattedTime(thread.timestamp) : null}

-
- {thread.replyCount > 0 ? -

- Last reply by Anonymous - {getFormattedTime(thread.lastReplyTimestamp)}

- : null}
-
: null } + onMouseLeave={()=>{handleMouseOnLeaveThread()}}> + {isHoveringOnThread === thread.cid ? +
handleMouseOnLeaveThread()} + style={{ + opacity: isCalculationDone && isEnoughSpaceOnRight !== null ? 1 : 0, + visibility: isCalculationDone && isEnoughSpaceOnRight !== null ? 'visible' : 'hidden', + left: isCalculationDone && isEnoughSpaceOnRight !== null && isEnoughSpaceOnRight + ? isMediaShowed + ? `calc(50% + ${imageRect.width}px / 2 + 5px)` + : `calc(50% + ${textRect.width}px / 2 + 5px)` + : 'auto', + right: isCalculationDone && isEnoughSpaceOnRight !== null && !isEnoughSpaceOnRight + ? isMediaShowed + ? `calc(50% + ${imageRect.width}px / 2 + 5px)` + : `calc(50% + ${textRect.width}px / 2 + 5px)` + : 'auto', + }} + className="thread_popup"> +

+ + {thread.title ? `${thread.title} ` : "Posted "} + + by + + {thread.author.displayName ?` ${thread.author.displayName} ` : " Anonymous "} + + {thread.timestamp ? getFormattedTime(thread.timestamp) : null}

+
+ {thread.replyCount > 0 ? +

+ Last reply by Anonymous + {getFormattedTime(thread.lastReplyTimestamp)}

+ : null} +
+
+ : null } {commentMediaInfo?.url ? ( setSelectedThread(thread.cid)}> + onClick={() => setSelectedThread(thread.cid)} onMouseOver={() => setIsHoveringOnThread(thread.cid)}> {commentMediaInfo?.type === "webpage" ? ( thread.thumbnailUrl ? ( @@ -648,6 +650,13 @@ const CatalogPost = ({post}) => { ) : null ) : null} + {commentMediaInfo?.type === "iframe" && (thread.thumbnailUrl || commentMediaInfo.thumbnail) ? ( + + {commentMediaInfo.type} { e.target.src = fallbackImgUrl }} /> + + ) : null} {commentMediaInfo?.type === "image" ? ( { ) : null} ) : null} - {(commentMediaInfo && ( - commentMediaInfo.type === 'image' || - commentMediaInfo.type === 'video' || - (commentMediaInfo.type === 'webpage' && - commentMediaInfo.thumbnail))) ? ( + {isMediaShowed ? (
{thread.pinned ? ( { ) : null}
) : null} - handleMouseOnLeaveThread()} style={{ all: "unset"}}>
R: {thread.replyCount} @@ -702,11 +707,7 @@ const CatalogPost = ({post}) => { L: {linkCount} ) : null} - {(commentMediaInfo && ( - commentMediaInfo.type === 'image' || - commentMediaInfo.type === 'video' || - (commentMediaInfo.type === 'webpage' && - commentMediaInfo.thumbnail))) ? null : ( + {isMediaShowed ? null : (
{thread.pinned ? ( @@ -795,10 +796,7 @@ const CatalogPost = ({post}) => { ) : null} )} - {(commentMediaInfo && ( - commentMediaInfo.type === 'image' || - (commentMediaInfo.type === 'webpage' && - commentMediaInfo.thumbnail))) ? ( + {isMediaShowed ? (
  • {setIsImageSearchOpen(true)}} onMouseLeave={() => {setIsImageSearchOpen(false)}}> @@ -863,7 +861,7 @@ const CatalogPost = ({post}) => {
    (threadRefs.current[thread.cid] = el)}> - + setIsHoveringOnThread(thread.cid)}> {thread.title ? `${thread.title}` : null} {thread.content ? `: ${thread.content}` : null} diff --git a/src/components/views/Pending.jsx b/src/components/views/Pending.jsx index 9125fcca..62943f91 100755 --- a/src/components/views/Pending.jsx +++ b/src/components/views/Pending.jsx @@ -496,7 +496,7 @@ const Pending = () => { style={{cursor: "pointer"}} onError={(e) => e.target.src = fallbackImgUrl} /> )} - {commentMediaInfo?.type === "video" || "iframe" ? ( + {commentMediaInfo?.type === "video" || commentMediaInfo?.type === "iframe" ? ( isMobileThumbnailClicked[index] ? (
    { onError={(e) => e.target.src = fallbackImgUrl} /> )} - {commentMediaInfo?.type === "video" || "iframe" ? ( + {commentMediaInfo?.type === "video" || commentMediaInfo?.type === "iframe" ? ( isMobileThumbnailClicked[index] ? (
    { commentMediaInfo?.url.slice(0, 30) + "(...)" : commentMediaInfo?.url } ({commentMediaInfo?.type === "iframe" ? "video" : commentMediaInfo?.type}) - {isThreadThumbnailClicked[index] ? ( + {isThreadThumbnailClicked[index] && commentMediaInfo.type !== "image" ? ( -[ { replyMediaInfo?.url.slice(0, 30) + "(...)" : replyMediaInfo?.url } ({replyMediaInfo?.type}) - {replyMediaInfo?.type === "video" || "iframe" ? ( + {replyMediaInfo?.type === "video" || replyMediaInfo?.type === "iframe" ? ( isReplyThumbnailClicked[index] ? ( -[ @@ -1855,7 +1855,7 @@ const Subscriptions = () => { style={{cursor: "pointer"}} onError={(e) => e.target.src = fallbackImgUrl} /> )} - {commentMediaInfo?.type === "video" || "iframe" ? ( + {commentMediaInfo?.type === "video" || commentMediaInfo?.type === "iframe" ? ( isMobileThreadThumbnailClicked[index] ? (
    { onError={(e) => e.target.src = fallbackImgUrl} /> )} - {commentMediaInfo?.type === "video" || "iframe" ? ( + {commentMediaInfo?.type === "video" || commentMediaInfo?.type === "iframe" ? ( isMobileThreadThumbnailClicked[index] ? (
    { return (
    {setIsHoveringOnThread(thread.cid)}} onMouseLeave={() => {handleMouseOnLeaveThread()}}> {isHoveringOnThread === thread.cid ? -
    handleMouseOnLeaveThread()} - style={{ - opacity: isCalculationDone && isEnoughSpaceOnRight !== null ? 1 : 0, - visibility: isCalculationDone && isEnoughSpaceOnRight !== null ? 'visible' : 'hidden', - left: isCalculationDone && isEnoughSpaceOnRight !== null && isEnoughSpaceOnRight - ? isMediaShowed - ? `calc(50% + ${imageRect.width}px / 2 + 5px)` - : `calc(50% + ${textRect.width}px / 2 + 5px)` - : 'auto', - right: isCalculationDone && isEnoughSpaceOnRight !== null && !isEnoughSpaceOnRight - ? isMediaShowed - ? `calc(50% + ${imageRect.width}px / 2 + 5px)` - : `calc(50% + ${textRect.width}px / 2 + 5px)` - : 'auto', - }} - className="thread_popup"> -

    - - {thread.title ? `${thread.title} ` : "Posted "} - - by - - {thread.author.displayName ?` ${thread.author.displayName} ` : " Anonymous "} - - {thread.timestamp ? getFormattedTime(thread.timestamp) : null}

    -
    - {thread.replyCount > 0 ? -

    - Last reply by Anonymous - {getFormattedTime(thread.lastReplyTimestamp)}

    - : null}
    -
    : null } +
    handleMouseOnLeaveThread()} + style={{ + opacity: isCalculationDone && isEnoughSpaceOnRight !== null ? 1 : 0, + visibility: isCalculationDone && isEnoughSpaceOnRight !== null ? 'visible' : 'hidden', + left: isCalculationDone && isEnoughSpaceOnRight !== null && isEnoughSpaceOnRight + ? isMediaShowed + ? `calc(50% + ${imageRect.width}px / 2 + 5px)` + : `calc(50% + ${textRect.width}px / 2 + 5px)` + : 'auto', + right: isCalculationDone && isEnoughSpaceOnRight !== null && !isEnoughSpaceOnRight + ? isMediaShowed + ? `calc(50% + ${imageRect.width}px / 2 + 5px)` + : `calc(50% + ${textRect.width}px / 2 + 5px)` + : 'auto', + }} + className="thread_popup"> +

    + + {thread.title ? `${thread.title} ` : "Posted "} + + by + + {thread.author.displayName ?` ${thread.author.displayName} ` : " Anonymous "} + + {thread.timestamp ? getFormattedTime(thread.timestamp) : null} +

    +
    + {thread.replyCount > 0 ? +

    + Last reply by Anonymous + {getFormattedTime(thread.lastReplyTimestamp)} +

    + : null} +
    +
    + : null } {commentMediaInfo?.url ? ( setSelectedThread(thread.cid)}> + onClick={() => setSelectedThread(thread.cid)} onMouseOver={() => {setIsHoveringOnThread(thread.cid)}}> {commentMediaInfo?.type === "webpage" ? ( thread.thumbnailUrl ? ( @@ -398,6 +401,13 @@ const CatalogPost = ({post}) => { ) : null ) : null} + {commentMediaInfo?.type === "iframe" && (thread.thumbnailUrl || commentMediaInfo.thumbnail) ? ( + + {commentMediaInfo.type} { e.target.src = fallbackImgUrl }} /> + + ) : null} {commentMediaInfo?.type === "image" ? ( { ) : null}
    - {(commentMediaInfo && ( - commentMediaInfo.type === 'image' || - commentMediaInfo.type === 'video' || - (commentMediaInfo.type === 'webpage' && - commentMediaInfo.thumbnail))) ? ( + {isMediaShowed ? ( { tooltipPlace="top" /> )}
    - handleMouseOnLeaveThread()} style={{ all: "unset"}}>
    R: {thread.replyCount} @@ -594,7 +600,7 @@ const CatalogPost = ({post}) => { onClick={() => setSelectedThread(thread.cid)}>
    (threadRefs.current[thread.cid] = el)}> - + {setIsHoveringOnThread(thread.cid)}}> {thread.title ? `${thread.title}` : null} {thread.content ? `: ${thread.content}` : null} diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx index f8ef95f6..719dd8c9 100755 --- a/src/components/views/Thread.jsx +++ b/src/components/views/Thread.jsx @@ -1534,7 +1534,7 @@ const Thread = () => { replyMediaInfo?.url.slice(0, 30) + "(...)" : replyMediaInfo?.url } ({replyMediaInfo?.type}) - {replyMediaInfo?.type === "video" || "iframe" ? ( + {replyMediaInfo?.type === "video" || replyMediaInfo?.type === "iframe" ? ( isReplyThumbnailClicked[index] ? ( -[ @@ -1819,7 +1819,7 @@ const Thread = () => { style={{cursor: "pointer"}} onError={(e) => e.target.src = fallbackImgUrl} /> )} - {commentMediaInfo?.type === "video" || "iframe" ? ( + {commentMediaInfo?.type === "video" || commentMediaInfo?.type === "iframe" ? ( isMobileThreadThumbnailClicked[index] ? (
    { onError={(e) => e.target.src = fallbackImgUrl} /> )} - {commentMediaInfo?.type === "video" || "iframe" ? ( + {commentMediaInfo?.type === "video" || commentMediaInfo?.type === "iframe" ? ( isMobileThreadThumbnailClicked[index] ? (
    { if (['youtube.com', 'www.youtube.com', 'youtu.be'].includes(host)) { const videoId = host === 'youtu.be' ? url.pathname.slice(1) : url.searchParams.get('v'); embedUrl = `https://www.youtube-nocookie.com/embed/${videoId}`; + const thumbnailUrl = `https://img.youtube.com/vi/${videoId}/sddefault.jpg`; + return { + url: comment.link, + embedUrl, + type: 'iframe', + thumbnail: comment.thumbnailUrl || thumbnailUrl, + }; } else if (host.includes('odysee.com')) { const pathComponents = url.pathname.split('/'); const channelAndId = pathComponents[1];