mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
update CommentsCard
component
This commit is contained in:
parent
ccbf0cbf65
commit
897a98bec1
@ -104,12 +104,12 @@ export default (props) => {
|
||||
}
|
||||
|
||||
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) => {
|
||||
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) => {
|
||||
return comments.filter((comment) => comment._id !== comment_id)
|
||||
})
|
||||
@ -117,8 +117,8 @@ export default (props) => {
|
||||
}
|
||||
|
||||
const unlistenEvents = () => {
|
||||
window.app.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.new.comment.${props.post_id}`)
|
||||
window.app.cores.api.namespaces["main"].unlistenEvent(`post.delete.comment.${props.post_id}`)
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
@ -143,7 +143,7 @@ export default (props) => {
|
||||
return <CommentCard
|
||||
data={comment}
|
||||
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">
|
||||
<div className="header">
|
||||
<h1>
|
||||
<h3>
|
||||
<Icons.MessageSquare /> Comments
|
||||
</h1>
|
||||
</h3>
|
||||
</div>
|
||||
{renderComments()}
|
||||
<div className="commentCreatorWrapper">
|
||||
|
@ -16,19 +16,6 @@
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.header {
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
|
||||
align-items: center;
|
||||
|
||||
font-size: 20px;
|
||||
|
||||
svg {
|
||||
margin: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.comment {
|
||||
position: relative;
|
||||
display: flex;
|
||||
@ -59,12 +46,12 @@
|
||||
.username {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.timeAgo {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
color: rgb(var(--bg_color_4));
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
@ -100,11 +87,5 @@
|
||||
right: 0;
|
||||
|
||||
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