Fixing after react update

This commit is contained in:
QkoSad
2023-05-05 23:10:06 +03:00
parent 21fa38cc4d
commit d069e56397
45 changed files with 550 additions and 31 deletions
+5 -1
View File
@@ -41,4 +41,8 @@ PostForm.propTypes = {
export default connect(
null,
{ addPost }
)(PostForm);
<<<<<<< HEAD
)(PostForm);
=======
)(PostForm);
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
+52 -1
View File
@@ -1,4 +1,8 @@
<<<<<<< HEAD
import React from 'react';
=======
import React, { Fragment } from 'react';
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import formatDate from '../../utils/formatDate';
@@ -10,8 +14,12 @@ const PostItem = ({
removeLike,
deletePost,
auth,
<<<<<<< HEAD
post: { _id, text, name, avatar, user, likes, comments, date }
=======
post: { _id, text, name, avatar, user, likes, comments, date },
showActions
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
}) => (
<div className="post bg-white p-1 my-1">
<div>
@@ -24,6 +32,37 @@ const PostItem = ({
<p className="my-1">{text}</p>
<p className="post-date">Posted on {formatDate(date)}</p>
<<<<<<< HEAD
<button
onClick={() => addLike(_id)}
type="button"
className="btn btn-light"
>
<i className="fas fa-thumbs-up" />{' '}
<span>{likes.length > 0 && <span>{likes.length}</span>}</span>
</button>
<button
onClick={() => removeLike(_id)}
type="button"
className="btn btn-light"
>
<i className="fas fa-thumbs-down" />
</button>
<Link to={`/posts/${_id}`} className="btn btn-primary">
Discussion{' '}
{comments.length > 0 && (
<span className="comment-count">{comments.length}</span>
)}
</Link>
{!auth.loading && user === auth.user._id && (
<button
onClick={() => deletePost(_id)}
type="button"
className="btn btn-danger"
>
<i className="fas fa-times" />
</button>
=======
{showActions && (
<Fragment>
<button
@@ -57,22 +96,30 @@ const PostItem = ({
</button>
)}
</Fragment>
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
)}
</div>
</div>
);
<<<<<<< HEAD
=======
PostItem.defaultProps = {
showActions: true
};
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
PostItem.propTypes = {
post: PropTypes.object.isRequired,
auth: PropTypes.object.isRequired,
addLike: PropTypes.func.isRequired,
removeLike: PropTypes.func.isRequired,
<<<<<<< HEAD
deletePost: PropTypes.func.isRequired
=======
deletePost: PropTypes.func.isRequired,
showActions: PropTypes.bool
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
};
const mapStateToProps = (state) => ({
@@ -81,4 +128,8 @@ const mapStateToProps = (state) => ({
export default connect(mapStateToProps, { addLike, removeLike, deletePost })(
PostItem
);
<<<<<<< HEAD
);
=======
);
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
+5 -1
View File
@@ -35,4 +35,8 @@ const mapStateToProps = (state) => ({
post: state.post
});
export default connect(mapStateToProps, { getPosts })(Posts);
<<<<<<< HEAD
export default connect(mapStateToProps, { getPosts })(Posts);
=======
export default connect(mapStateToProps, { getPosts })(Posts);
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb