From 106c865b8228bb636fa2d7fb6bb8e1bed70ed761 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Fri, 7 Jul 2023 17:48:24 +0200 Subject: [PATCH] add embeds: youtube, odysee, bitchute, streamable --- src/components/modals/ReplyModal.jsx | 6 +- src/components/styled/views/Board.styled.jsx | 12 +- src/components/styled/views/Thread.styled.jsx | 10 +- src/components/views/All.jsx | 289 ++++++++++++----- src/components/views/Board.jsx | 153 ++++++++- src/components/views/Pending.jsx | 293 ++++++++++++++---- src/components/views/Subscriptions.jsx | 290 ++++++++++++----- src/components/views/Thread.jsx | 263 ++++++++++++---- src/utils/getCommentMediaInfo.js | 96 ++++-- 9 files changed, 1076 insertions(+), 336 deletions(-) diff --git a/src/components/modals/ReplyModal.jsx b/src/components/modals/ReplyModal.jsx index 7a72c837..96fb2235 100755 --- a/src/components/modals/ReplyModal.jsx +++ b/src/components/modals/ReplyModal.jsx @@ -229,8 +229,10 @@ const ReplyModal = ({ isOpen, closeModal }) => { }, [selectedParentCid, anonymousMode, account]); useEffect(() => { - updateSigner(); - }, [updateSigner]); + if (anonymousMode) { + updateSigner(); + } + }, [updateSigner, anonymousMode]); useEffect(() => { diff --git a/src/components/styled/views/Board.styled.jsx b/src/components/styled/views/Board.styled.jsx index 81c3b8c4..c2cb1312 100644 --- a/src/components/styled/views/Board.styled.jsx +++ b/src/components/styled/views/Board.styled.jsx @@ -2016,6 +2016,16 @@ export const BoardForm = styled.div` } video { + width: 100%; + height: auto; + } + + iframe { + width: 100%; + height: auto; + } + + #video-thumbnail-mobile { width: 100px; } @@ -3804,7 +3814,7 @@ export const BoardForm = styled.div` color: #707070; font-weight: 700; background-color: rgb(27,28,30); - border: 1px solid #282A2E; + border: 1px solid #2D2F33; background-image: url(assets/buttonfade-dark.png); background-repeat: repeat-x; text-decoration: none; diff --git a/src/components/styled/views/Thread.styled.jsx b/src/components/styled/views/Thread.styled.jsx index 6c1f8cc2..09b9c343 100644 --- a/src/components/styled/views/Thread.styled.jsx +++ b/src/components/styled/views/Thread.styled.jsx @@ -1193,7 +1193,13 @@ export const BoardForm = styled.div` } video { - width: 100px; + width: 100%; + height: auto; + } + + iframe { + width: 100%; + height: auto; } img { @@ -2932,7 +2938,7 @@ export const BoardForm = styled.div` color: #707070; font-weight: 700; background-color: rgb(27,28,30); - border: 1px solid #282A2E; + border: 1px solid #2D2F33; background-image: url(assets/buttonfade-dark.png); background-repeat: repeat-x; text-decoration: none; diff --git a/src/components/views/All.jsx b/src/components/views/All.jsx index a4a4a254..27f960b3 100755 --- a/src/components/views/All.jsx +++ b/src/components/views/All.jsx @@ -102,6 +102,8 @@ const All = () => { const [moderatorPermissions, setModeratorPermissions] = useState({}); const [executeAnonMode, setExecuteAnonMode] = useState(false); const [cidTracker, setCidTracker] = useState({}); + const [isThumbnailClicked, setIsThumbnailClicked] = useState({}); + const [isMobileThumbnailClicked, setIsMobileThumbnailClicked] = useState({}); const setSelectedThreadCid = (cid) => { selectedThreadCidRef.current = cid; @@ -117,6 +119,20 @@ const All = () => { const stateString = useFeedStateString(subplebbits); + const handleThumbnailClick = (index, isMobile=false) => { + if (isMobile) { + setIsMobileThumbnailClicked(prevState => ({ + ...prevState, + [index]: !prevState[index], + })); + } else { + setIsThumbnailClicked(prevState => ({ + ...prevState, + [index]: !prevState[index], + })); + } + }; + useEffect(() => { let permissions = {}; @@ -618,56 +634,110 @@ const All = () => {
{commentMediaInfo?.url ? ( -
-
- Link:  - { - commentMediaInfo?.url.length > 30 ? - commentMediaInfo?.url.slice(0, 30) + "(...)" : - commentMediaInfo?.url - } ({commentMediaInfo?.type}) -
- {commentMediaInfo?.type === "webpage" ? ( -
- - {thread.thumbnailUrl ? ( +
+
+ Link:  + { + commentMediaInfo?.url.length > 30 ? + commentMediaInfo?.url.slice(0, 30) + "(...)" : + commentMediaInfo?.url + } ({commentMediaInfo?.type === "iframe" ? "video" : commentMediaInfo?.type}) + {isThumbnailClicked[index] ? ( + + -[ + {handleThumbnailClick(index)}}>Close + ] + + ) : null} +
+ {commentMediaInfo?.type === 'iframe' && ( +
+ + {(isThumbnailClicked[index] || !commentMediaInfo.thumbnail) && commentMediaInfo.embedUrl ? ( +