diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx
index b7fdbf80..5965aa5c 100755
--- a/src/components/views/Board.jsx
+++ b/src/components/views/Board.jsx
@@ -2017,6 +2017,16 @@ const Board = () => {
replyMediaInfo?.url.slice(0, 30) + "(...)" :
replyMediaInfo?.url
} ({replyMediaInfo?.type})
+ {replyMediaInfo?.type === "video" || "iframe" ? (
+ isReplyThumbnailClicked[index] ? (
+
+ -[
+ {handleThumbnailClick(index, 'reply')}}>Close
+ ]
+ ) : null)
+ : null}
{replyMediaInfo?.type === "webpage" ? (
@@ -2043,12 +2053,29 @@ const Board = () => {
) : null}
{replyMediaInfo?.type === "video" ? (
+
-
+
) : null}
{replyMediaInfo?.type === "audio" ? (
diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx
index ec11aca0..a3988d30 100755
--- a/src/components/views/Thread.jsx
+++ b/src/components/views/Thread.jsx
@@ -113,8 +113,9 @@ const Thread = () => {
const [postOnHoverHeight, setPostOnHoverHeight] = useState(0);
const [executeAnonMode, setExecuteAnonMode] = useState(false);
const [cidTracker, setCidTracker] = useState({});
- const [isThumbnailClicked, setIsThumbnailClicked] = useState({});
- const [isMobileThumbnailClicked, setIsMobileThumbnailClicked] = useState({});
+ const [isThreadThumbnailClicked, setIsThreadThumbnailClicked] = useState({});
+ const [isReplyThumbnailClicked, setIsReplyThumbnailClicked] = useState({});
+ const [isMobileThreadThumbnailClicked, setIsMobileThreadThumbnailClicked] = useState({});
const [isCreateBoardOpen, setIsCreateBoardOpen] = useState(false);
@@ -131,17 +132,28 @@ const Thread = () => {
const fallbackImgUrl = "assets/filedeleted-res.gif";
- const handleThumbnailClick = (index, isMobile=false) => {
- if (isMobile) {
- setIsMobileThumbnailClicked(prevState => ({
- ...prevState,
- [index]: !prevState[index],
- }));
- } else {
- setIsThumbnailClicked(prevState => ({
- ...prevState,
- [index]: !prevState[index],
- }));
+ const handleThumbnailClick = (index, type) => {
+ switch(type) {
+ case 'thread':
+ setIsThreadThumbnailClicked(prevState => ({
+ ...prevState,
+ [index]: !prevState[index],
+ }));
+ break;
+ case 'reply':
+ setIsReplyThumbnailClicked(prevState => ({
+ ...prevState,
+ [index]: !prevState[index],
+ }));
+ break;
+ case 'mobileThread':
+ setIsMobileThreadThumbnailClicked(prevState => ({
+ ...prevState,
+ [index]: !prevState[index],
+ }));
+ break;
+ default:
+ break;
}
};
@@ -844,21 +856,21 @@ const Thread = () => {
commentMediaInfo?.url.slice(0, 30) + "(...)" :
commentMediaInfo?.url
} ({commentMediaInfo?.type === "iframe" ? "video" : commentMediaInfo?.type})
- {isThumbnailClicked[index] ? (
+ {isThreadThumbnailClicked[index] ? (
-[
{handleThumbnailClick(index)}}>Close
+ onClick={() => {handleThumbnailClick(index, 'thread')}}>Close
]
) : null}
{commentMediaInfo?.type === 'iframe' && (
+ className={`img-container ${isThreadThumbnailClicked[index] ? 'expanded-container' : ''}`}>
- {(isThumbnailClicked[index] || !commentMediaInfo.thumbnail) && commentMediaInfo.embedUrl ? (
+ {(isThreadThumbnailClicked[index] || !commentMediaInfo.thumbnail) && commentMediaInfo.embedUrl ? (
) : null}
{commentMediaInfo?.type === "video" ? (
-
+
- {isThumbnailClicked[index] ? (
+ {isThreadThumbnailClicked[index] ? (
{
key={`fti-${index}`}
src={commentMediaInfo.url}
alt="thumbnail"
- onClick={() => {handleThumbnailClick(index)}}
+ onClick={() => {handleThumbnailClick(index, 'thread')}}
style={{cursor: "pointer"}}
onError={(e) => e.target.src = fallbackImgUrl}
/>
@@ -1193,6 +1205,15 @@ const Thread = () => {
if (storedSigners[selectedThread]) {
signerAddress = storedSigners[selectedThread].address;
}
+ let replyDisplayWidth, replyDisplayHeight;
+ if (reply.linkWidth && reply.linkHeight) {
+ const scale = Math.min(1, 125 / Math.max(reply.linkWidth, reply.linkHeight));
+ replyDisplayWidth = `${reply.linkWidth * scale}px`;
+ replyDisplayHeight = `${reply.linkHeight * scale}px`;
+ } else {
+ replyDisplayWidth = '125px';
+ replyDisplayHeight = '125px';
+ }
return (
{'>>'}
@@ -1424,57 +1445,86 @@ const Thread = () => {
{replyMediaInfo?.url ? (
-
-
- {replyMediaInfo?.type === "webpage" ? (
-
-
- {reply.thumbnailUrl ? (
-
e.target.src = fallbackImgUrl} />
- ) : null}
-
-
- ) : null}
- {replyMediaInfo?.type === "image" ? (
-
-
+
+
+ {replyMediaInfo?.type === "webpage" ? (
+
+
+ {reply.thumbnailUrl ? (
{handleImageClick(e); handleThumbnailClick(index, 'reply')}}
style={{cursor: "pointer"}}
onError={(e) => e.target.src = fallbackImgUrl} />
-
+ ) : null}
+
- ) : null}
- {replyMediaInfo?.type === "video" ? (
-
-
+
+
{handleImageClick(e); handleThumbnailClick(index, 'reply')}}
+ style={{cursor: "pointer"}}
onError={(e) => e.target.src = fallbackImgUrl} />
- ) : null}
- {replyMediaInfo?.type === "audio" ? (
-
-
- ) : null}
+
+ ) : null}
+ {replyMediaInfo?.type === "video" ? (
+
+
+ {isReplyThumbnailClicked[index] ? (
+ e.target.src = fallbackImgUrl}
+ />
+ ) : (
+ {handleThumbnailClick(index, 'reply')}}
+ style={{cursor: "pointer"}}
+ onError={(e) => e.target.src = fallbackImgUrl}
+ />
+ )}
+
- ) : null}
+ ) : null}
+ {replyMediaInfo?.type === "audio" ? (
+
+
+ ) : null}
+
+ ) : null}
{}} key={`r-pm-${index}`} className="quotelink"
ref={el => {
@@ -1666,7 +1716,7 @@ const Thread = () => {
{commentMediaInfo?.type === 'iframe' && (
- {(isMobileThumbnailClicked[index] || !commentMediaInfo.thumbnail) && commentMediaInfo.embedUrl ? (
+ {(isMobileThreadThumbnailClicked[index] || !commentMediaInfo.thumbnail) && commentMediaInfo.embedUrl ? (
) : commentMediaInfo.type === "video" ? (
- {isMobileThumbnailClicked[index] ? (
+ {isMobileThreadThumbnailClicked[index] ? (
{
key={`fti-${index}`}
src={commentMediaInfo.url}
alt="thumbnail"
- onClick={() => {handleThumbnailClick(index, true)}}
+ onClick={() => {handleThumbnailClick(index, 'mobileThread')}}
style={{cursor: "pointer"}}
id="video-thumbnail-mobile"
onError={(e) => e.target.src = fallbackImgUrl}
/>
)}
{commentMediaInfo?.type === "video" || "iframe" ? (
- isMobileThumbnailClicked[index] ? (
+ isMobileThreadThumbnailClicked[index] ? (
{handleThumbnailClick(index, true)}}
+ onClick={() => {handleThumbnailClick(index, 'mobileThread')}}
>Close
) : (