Fixing after react update
This commit is contained in:
Vendored
BIN
Binary file not shown.
@@ -1,9 +1,16 @@
|
||||
import React, { useState } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
<<<<<<< HEAD
|
||||
import { Link, Navigate } from 'react-router-dom';
|
||||
import { setAlert } from '../../actions/alert';
|
||||
import { register } from '../../actions/auth';
|
||||
import PropTypes from 'prop-types';
|
||||
=======
|
||||
import PropTypes from 'prop-types';
|
||||
import { Link, Navigate } from 'react-router-dom';
|
||||
import { setAlert } from '../../actions/alert';
|
||||
import { register } from '../../actions/auth';
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
const Register = ({ setAlert, register, isAuthenticated }) => {
|
||||
const [formData, setFormData] = useState({
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
<<<<<<< HEAD
|
||||
import React, { useEffect } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import DashboardActions from './DashboardActions';
|
||||
import Experience from './Experience';
|
||||
import Education from './Education';
|
||||
import { getCurrentProfile, deleteAccount } from '../../actions/profile';
|
||||
=======
|
||||
import React, { useEffect } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import PropTypes from "prop-types";
|
||||
@@ -6,12 +16,17 @@ import DashboardActions from "./DashboardActions";
|
||||
import Experience from "./Experience";
|
||||
import Education from "./Education";
|
||||
import { getCurrentProfile, deleteAccount } from "../../actions/profile";
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
const Dashboard = ({
|
||||
getCurrentProfile,
|
||||
deleteAccount,
|
||||
auth: { user },
|
||||
<<<<<<< HEAD
|
||||
profile: { profile }
|
||||
=======
|
||||
profile: { profile },
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
}) => {
|
||||
useEffect(() => {
|
||||
getCurrentProfile();
|
||||
@@ -51,12 +66,20 @@ Dashboard.propTypes = {
|
||||
getCurrentProfile: PropTypes.func.isRequired,
|
||||
deleteAccount: PropTypes.func.isRequired,
|
||||
auth: PropTypes.object.isRequired,
|
||||
<<<<<<< HEAD
|
||||
profile: PropTypes.object.isRequired
|
||||
=======
|
||||
profile: PropTypes.object.isRequired,
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
auth: state.auth,
|
||||
<<<<<<< HEAD
|
||||
profile: state.profile
|
||||
=======
|
||||
profile: state.profile,
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, { getCurrentProfile, deleteAccount })(
|
||||
|
||||
@@ -17,4 +17,8 @@ const DashboardActions = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default DashboardActions;
|
||||
<<<<<<< HEAD
|
||||
export default DashboardActions;
|
||||
=======
|
||||
export default DashboardActions;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -46,4 +46,8 @@ Education.propTypes = {
|
||||
deleteEducation: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(null, { deleteEducation })(Education);
|
||||
<<<<<<< HEAD
|
||||
export default connect(null, { deleteEducation })(Education);
|
||||
=======
|
||||
export default connect(null, { deleteEducation })(Education);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
@@ -47,4 +50,8 @@ Experience.propTypes = {
|
||||
deleteExperience: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(null, { deleteExperience })(Experience);
|
||||
<<<<<<< HEAD
|
||||
export default connect(null, { deleteExperience })(Experience);
|
||||
=======
|
||||
export default connect(null, { deleteExperience })(Experience);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -20,4 +20,8 @@ const mapStateToProps = (state) => ({
|
||||
alerts: state.alert
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(Alert);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps)(Alert);
|
||||
=======
|
||||
export default connect(mapStateToProps)(Alert);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -5,6 +5,25 @@ import PropTypes from 'prop-types';
|
||||
|
||||
const Landing = ({ isAuthenticated }) => {
|
||||
if (isAuthenticated) {
|
||||
<<<<<<< HEAD
|
||||
return <Navigate to="/dashboard" />;
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="landing">
|
||||
<div className="dark-overlay">
|
||||
<div className="landing-inner">
|
||||
<h1 className="x-large">Developer Connector</h1>
|
||||
<p className="lead">
|
||||
Create a developer profile/portfolio, share posts and get help from
|
||||
other developers
|
||||
</p>
|
||||
<div className="buttons">
|
||||
<Link to="/register" className="btn btn-primary">
|
||||
Sign Up
|
||||
</Link>
|
||||
<Link to="/login" className="btn btn-light">
|
||||
=======
|
||||
return <Navigate to='/dashboard' />;
|
||||
}
|
||||
|
||||
@@ -22,6 +41,7 @@ const Landing = ({ isAuthenticated }) => {
|
||||
Sign Up
|
||||
</Link>
|
||||
<Link to='/login' className='btn btn-light'>
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
Login
|
||||
</Link>
|
||||
</div>
|
||||
@@ -35,8 +55,16 @@ Landing.propTypes = {
|
||||
isAuthenticated: PropTypes.bool
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
const mapStateToProps = (state) => ({
|
||||
isAuthenticated: state.auth.isAuthenticated
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(Landing);
|
||||
=======
|
||||
const mapStateToProps = state => ({
|
||||
isAuthenticated: state.auth.isAuthenticated
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(Landing);
|
||||
export default connect(mapStateToProps)(Landing);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -11,4 +11,8 @@ const NotFound = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default NotFound;
|
||||
<<<<<<< HEAD
|
||||
export default NotFound;
|
||||
=======
|
||||
export default NotFound;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -11,4 +11,8 @@ const Spinner = () => (
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
export default Spinner;
|
||||
<<<<<<< HEAD
|
||||
export default Spinner;
|
||||
=======
|
||||
export default Spinner;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -41,4 +41,8 @@ CommentForm.propTypes = {
|
||||
export default connect(
|
||||
null,
|
||||
{ addComment }
|
||||
)(CommentForm);
|
||||
<<<<<<< HEAD
|
||||
)(CommentForm);
|
||||
=======
|
||||
)(CommentForm);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -45,4 +45,8 @@ const mapStateToProps = (state) => ({
|
||||
auth: state.auth
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, { deleteComment })(CommentItem);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps, { deleteComment })(CommentItem);
|
||||
=======
|
||||
export default connect(mapStateToProps, { deleteComment })(CommentItem);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -41,4 +41,8 @@ const mapStateToProps = (state) => ({
|
||||
post: state.post
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, { getPost })(Post);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps, { getPost })(Post);
|
||||
=======
|
||||
export default connect(mapStateToProps, { getPost })(Post);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -41,4 +41,8 @@ PostForm.propTypes = {
|
||||
export default connect(
|
||||
null,
|
||||
{ addPost }
|
||||
)(PostForm);
|
||||
<<<<<<< HEAD
|
||||
)(PostForm);
|
||||
=======
|
||||
)(PostForm);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -34,7 +34,11 @@ const AddEducation = ({ addEducation }) => {
|
||||
className="form"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
<<<<<<< HEAD
|
||||
addEducation(formData).then(() => navigate('/dashboard'));
|
||||
=======
|
||||
addEducation(formData, navigate);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
}}
|
||||
>
|
||||
<div className="form-group">
|
||||
@@ -115,4 +119,8 @@ AddEducation.propTypes = {
|
||||
addEducation: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(null, { addEducation })(AddEducation);
|
||||
<<<<<<< HEAD
|
||||
export default connect(null, { addEducation })(AddEducation);
|
||||
=======
|
||||
export default connect(null, { addEducation })(AddEducation);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -33,7 +33,11 @@ const AddExperience = ({ addExperience }) => {
|
||||
className="form"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
<<<<<<< HEAD
|
||||
addExperience(formData).then(() => navigate('/dashboard'));
|
||||
=======
|
||||
addExperience(formData, navigate);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
}}
|
||||
>
|
||||
<div className="form-group">
|
||||
@@ -116,4 +120,8 @@ AddExperience.propTypes = {
|
||||
addExperience: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(null, { addExperience })(AddExperience);
|
||||
<<<<<<< HEAD
|
||||
export default connect(null, { addExperience })(AddExperience);
|
||||
=======
|
||||
export default connect(null, { addExperience })(AddExperience);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -78,8 +78,16 @@ const ProfileForm = ({
|
||||
setFormData({ ...formData, [e.target.name]: e.target.value });
|
||||
|
||||
const onSubmit = (e) => {
|
||||
<<<<<<< HEAD
|
||||
const editing = profile ? true : false;
|
||||
e.preventDefault();
|
||||
createProfile(formData, editing).then(() => {
|
||||
if (!editing) navigate('/dashboard');
|
||||
});
|
||||
=======
|
||||
e.preventDefault();
|
||||
createProfile(formData, navigate, profile ? true : false);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -273,4 +281,8 @@ const mapStateToProps = (state) => ({
|
||||
|
||||
export default connect(mapStateToProps, { createProfile, getCurrentProfile })(
|
||||
ProfileForm
|
||||
);
|
||||
<<<<<<< HEAD
|
||||
);
|
||||
=======
|
||||
);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -76,11 +76,19 @@ const Profile = ({ getProfileById, profile: { profile }, auth }) => {
|
||||
</section>
|
||||
);
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
Profile.propTypes = {
|
||||
getProfileById: PropTypes.func.isRequired,
|
||||
profile: PropTypes.object.isRequired,
|
||||
auth: PropTypes.object.isRequired
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
const mapStateToProps = (state) => ({
|
||||
profile: state.profile,
|
||||
auth: state.auth
|
||||
|
||||
@@ -31,4 +31,8 @@ ProfileAbout.propTypes = {
|
||||
profile: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default ProfileAbout;
|
||||
<<<<<<< HEAD
|
||||
export default ProfileAbout;
|
||||
=======
|
||||
export default ProfileAbout;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -26,4 +26,8 @@ ProfileEducation.propTypes = {
|
||||
education: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default ProfileEducation;
|
||||
<<<<<<< HEAD
|
||||
export default ProfileEducation;
|
||||
=======
|
||||
export default ProfileEducation;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -26,4 +26,8 @@ ProfileExperience.propTypes = {
|
||||
experience: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default ProfileExperience;
|
||||
<<<<<<< HEAD
|
||||
export default ProfileExperience;
|
||||
=======
|
||||
export default ProfileExperience;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -48,4 +48,8 @@ const mapStateToProps = state => ({
|
||||
repos: state.profile.repos
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
|
||||
=======
|
||||
export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -48,4 +48,8 @@ ProfileTop.propTypes = {
|
||||
profile: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default ProfileTop;
|
||||
<<<<<<< HEAD
|
||||
export default ProfileTop;
|
||||
=======
|
||||
export default ProfileTop;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -39,4 +39,8 @@ ProfileItem.propTypes = {
|
||||
profile: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default ProfileItem;
|
||||
<<<<<<< HEAD
|
||||
export default ProfileItem;
|
||||
=======
|
||||
export default ProfileItem;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -1,3 +1,53 @@
|
||||
<<<<<<< HEAD
|
||||
import React, { Fragment, useEffect } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import Spinner from '../layout/Spinner';
|
||||
import ProfileItem from './ProfileItem';
|
||||
import { getProfiles } from '../../actions/profile';
|
||||
|
||||
const Profiles = ({ getProfiles, profile: { profiles, loading } }) => {
|
||||
useEffect(() => {
|
||||
getProfiles();
|
||||
}, [getProfiles]);
|
||||
|
||||
return (
|
||||
<section className="container">
|
||||
{loading ? (
|
||||
<Spinner />
|
||||
) : (
|
||||
<Fragment>
|
||||
<h1 className="large text-primary">Developers</h1>
|
||||
<p className="lead">
|
||||
<i className="fab fa-connectdevelop" /> Browse and connect with
|
||||
developers
|
||||
</p>
|
||||
<div className="profiles">
|
||||
{profiles.length > 0 ? (
|
||||
profiles.map((profile) => (
|
||||
<ProfileItem key={profile._id} profile={profile} />
|
||||
))
|
||||
) : (
|
||||
<h4>No profiles found...</h4>
|
||||
)}
|
||||
</div>
|
||||
</Fragment>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
Profiles.propTypes = {
|
||||
getProfiles: PropTypes.func.isRequired,
|
||||
profile: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
profile: state.profile
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, { getProfiles })(Profiles);
|
||||
=======
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
@@ -40,3 +90,4 @@ ProfileItem.propTypes = {
|
||||
};
|
||||
|
||||
export default ProfileItem;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -22,4 +22,8 @@ const mapStateToProps = (state) => ({
|
||||
auth: state.auth
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(PrivateRoute);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps)(PrivateRoute);
|
||||
=======
|
||||
export default connect(mapStateToProps)(PrivateRoute);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
Reference in New Issue
Block a user