mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 12:04:16 +00:00
update CommentsCard
component
This commit is contained in:
parent
ccbf0cbf65
commit
897a98bec1
@ -104,12 +104,12 @@ export default (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const listenEvents = () => {
|
const listenEvents = () => {
|
||||||
window.app.api.namespaces["main"].listenEvent(`post.new.comment.${props.post_id}`, (comment) => {
|
window.app.cores.api.namespaces["main"].listenEvent(`post.new.comment.${props.post_id}`, (comment) => {
|
||||||
setComments((comments) => {
|
setComments((comments) => {
|
||||||
return [comment, ...comments]
|
return [comment, ...comments]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
window.app.api.namespaces["main"].listenEvent(`post.delete.comment.${props.post_id}`, (comment_id) => {
|
window.app.cores.api.namespaces["main"].listenEvent(`post.delete.comment.${props.post_id}`, (comment_id) => {
|
||||||
setComments((comments) => {
|
setComments((comments) => {
|
||||||
return comments.filter((comment) => comment._id !== comment_id)
|
return comments.filter((comment) => comment._id !== comment_id)
|
||||||
})
|
})
|
||||||
@ -117,8 +117,8 @@ export default (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const unlistenEvents = () => {
|
const unlistenEvents = () => {
|
||||||
window.app.api.namespaces["main"].unlistenEvent(`post.new.comment.${props.post_id}`)
|
window.app.cores.api.namespaces["main"].unlistenEvent(`post.new.comment.${props.post_id}`)
|
||||||
window.app.api.namespaces["main"].unlistenEvent(`post.delete.comment.${props.post_id}`)
|
window.app.cores.api.namespaces["main"].unlistenEvent(`post.delete.comment.${props.post_id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
@ -143,7 +143,7 @@ export default (props) => {
|
|||||||
return <CommentCard
|
return <CommentCard
|
||||||
data={comment}
|
data={comment}
|
||||||
onClickDelete={handleCommentDelete}
|
onClickDelete={handleCommentDelete}
|
||||||
self={app.permissions.checkUserIdIsSelf(comment.user._id)}
|
self={app.cores.permissions.checkUserIdIsSelf(comment.user._id)}
|
||||||
/>
|
/>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -154,9 +154,9 @@ export default (props) => {
|
|||||||
|
|
||||||
return <div className="comments">
|
return <div className="comments">
|
||||||
<div className="header">
|
<div className="header">
|
||||||
<h1>
|
<h3>
|
||||||
<Icons.MessageSquare /> Comments
|
<Icons.MessageSquare /> Comments
|
||||||
</h1>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
{renderComments()}
|
{renderComments()}
|
||||||
<div className="commentCreatorWrapper">
|
<div className="commentCreatorWrapper">
|
||||||
|
@ -16,19 +16,6 @@
|
|||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
|
||||||
display: inline-flex;
|
|
||||||
flex-direction: row;
|
|
||||||
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
font-size: 20px;
|
|
||||||
|
|
||||||
svg {
|
|
||||||
margin: 0 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.comment {
|
.comment {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -59,12 +46,12 @@
|
|||||||
.username {
|
.username {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #000;
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeAgo {
|
.timeAgo {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #999;
|
color: rgb(var(--bg_color_4));
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,11 +87,5 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 30px 5px;
|
|
||||||
|
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
border-radius: 10px;
|
|
||||||
|
|
||||||
background-color: rgba(var(--background-color-accent), 0.6);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user