added fullmode

This commit is contained in:
srgooglo 2022-09-07 11:15:25 +02:00
parent adbb5fca95
commit 7b655a9a65
2 changed files with 18 additions and 2 deletions

View File

@ -277,7 +277,8 @@ export const PostCard = React.memo(({
expansibleActions = window.app.settings.get("postCard_expansible_actions"),
autoCarrousel = window.app.settings.get("postCard_carrusel_auto"),
data = {},
events = {}
events = {},
fullmode
}) => {
const [loading, setLoading] = React.useState(true)
const [likes, setLikes] = React.useState(data.likes ?? [])
@ -307,6 +308,15 @@ export const PostCard = React.memo(({
setComments(data.comments)
}
const onDoubleClick = () => {
if (typeof events.onDoubleClick !== "function") {
console.warn("onDoubleClick event is not a function")
return
}
return events.onDoubleClick(data)
}
React.useEffect(() => {
// first listen to post changes
window.app.api.namespaces["main"].listenEvent(`post.dataUpdate.${data._id}`, onDataUpdate)
@ -341,8 +351,10 @@ export const PostCard = React.memo(({
className={classnames(
"postCard",
{ ["liked"]: hasLiked },
{ ["noHide"]: !expansibleActions }
{ ["noHide"]: !expansibleActions },
{ ["fullmode"]: fullmode },
)}
onDoubleClick={onDoubleClick}
>
<div className="wrapper">
<PostHeader

View File

@ -31,6 +31,10 @@
}
}
&.fullmode {
max-width: none;
}
.wrapper {
display: inline-flex;
flex-direction: column;