From 072bda5d4eabea896559f8f24c5097ff3113c0aa Mon Sep 17 00:00:00 2001 From: "Yasmin Seidel (JasminDreasond)" Date: Mon, 15 Jul 2024 21:11:10 -0300 Subject: [PATCH] Embed - tiny code migrated to react / Share button in the room settings added. --- info/dev/preparing-changelog.md | 1 + src/app/molecules/dialog/Dialog.jsx | 4 +- src/app/molecules/message/Embed.jsx | 46 ++++---- .../molecules/room-profile/RoomProfile.jsx | 101 +++++++++++------- 4 files changed, 92 insertions(+), 60 deletions(-) diff --git a/info/dev/preparing-changelog.md b/info/dev/preparing-changelog.md index 5d13016cb..a770a9212 100644 --- a/info/dev/preparing-changelog.md +++ b/info/dev/preparing-changelog.md @@ -5,3 +5,4 @@ - Force Dev Mode option added into the `.env` file. - New room viewer script to mobile. - Mobile css content place fixed. +- Share button in the room settings added. diff --git a/src/app/molecules/dialog/Dialog.jsx b/src/app/molecules/dialog/Dialog.jsx index 95c67bed0..4571aca77 100644 --- a/src/app/molecules/dialog/Dialog.jsx +++ b/src/app/molecules/dialog/Dialog.jsx @@ -13,7 +13,7 @@ function Dialog({ onAfterOpen = null, onAfterClose = null, onRequestClose = null, - children, + children = null, bodyClass = '', }) { useEffect(() => { @@ -57,7 +57,7 @@ Dialog.propTypes = { onAfterOpen: PropTypes.func, onAfterClose: PropTypes.func, onRequestClose: PropTypes.func, - children: PropTypes.node.isRequired, + children: PropTypes.node, }; export default Dialog; diff --git a/src/app/molecules/message/Embed.jsx b/src/app/molecules/message/Embed.jsx index b21414b4e..5dafca75f 100644 --- a/src/app/molecules/message/Embed.jsx +++ b/src/app/molecules/message/Embed.jsx @@ -23,6 +23,7 @@ function Embed({ embed = {}, roomId = null, threadId = null }) { // URL Ref const tinyUrl = useRef(null); const itemEmbed = useRef(null); + const [useVideo, setUseVideo] = useState(false); const [embedHeight, setEmbedHeight] = useState(null); const imgType = @@ -196,26 +197,33 @@ function Embed({ embed = {}, roomId = null, threadId = null }) { ) : null} {isVideo && typeof imgUrl === 'string' && imgUrl.length > 0 ? ( -
{ - $(e.target).replaceWith( - jReact( -
- -
, - ), - ); - }} - > + !useVideo ? (
-
+ className="mt-2 ratio ratio-16x9 embed-video" + style={{ + backgroundImage: `url('${imgUrl !== defaultVideoAvatar ? mx.mxcUrlToHttp(imgUrl, 2000, 2000) : defaultVideoAvatar}')`, + }} + onClick={() => { + setUseVideo(true); + }} + > +
+
+ ) : ( +
+