Skip to content

Commit c22c9ac

Browse files
Requested changes
1 parent 56cbf80 commit c22c9ac

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

src/user/profile/ReadMe.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ class ReadMe extends Component {
2727
}
2828

2929
componentDidMount() {
30-
this.props.getProfile();
31-
}
32-
33-
componentWillReceiveProps(nextProps) {
34-
const { userProfile } = nextProps.user;
30+
const userProfile = this.props.userProfile;
3531
const about = userProfile.info?.about;
3632
let longDescription = true;
3733
if (!about.hasOwnProperty("longDescription")) {

src/user/profile/content/PostContent.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import "./PostContent.scss";
44
import { connect } from "react-redux";
55
import parse from "html-react-parser";
66
import { getAllCommentsOfPost } from "../../../actions/commentAction";
7+
import userIcon2 from '../../../images/userIcon2.jpg'
78

89
class PostContent extends Component {
910
constructor(props) {
@@ -56,13 +57,13 @@ class PostContent extends Component {
5657
<div className="user-post-info">
5758
<div className="user-thumb">
5859
<img
59-
src="https://randomuser.me/api/portraits/med/men/75.jpg"
60+
src={userIcon2}
6061
className="img-responsive"
6162
/>
6263
</div>
6364
<div className="user-information">
64-
<p>{`${post.userId?.name.firstName} ${post.userId?.name.lastName}`}</p>
65-
<small>{post.createdAt}</small>
65+
<p>{`${post?.userId?.name.firstName} ${post?.userId?.name.lastName}`}</p>
66+
<small>{post?.createdAt}</small>
6667
</div>
6768
</div>
6869
<div className="post-action">
@@ -71,7 +72,7 @@ class PostContent extends Component {
7172
</div>
7273

7374
<div className="content-card-body simple-text-card">
74-
<p>{post.content}</p>
75+
<p>{post?.content}</p>
7576
</div>
7677
</div>
7778

@@ -101,7 +102,7 @@ class PostContent extends Component {
101102
<div className="comment-input-holder">
102103
<div className="user-thumb">
103104
<img
104-
src="https://randomuser.me/api/portraits/med/men/75.jpg"
105+
src={userIcon2}
105106
className="img-responsive"
106107
/>
107108
</div>
@@ -119,7 +120,7 @@ class PostContent extends Component {
119120
<div className="comment-item" key={index}>
120121
<div className="user-icon">
121122
<img
122-
src="https://randomuser.me/api/portraits/med/men/75.jpg"
123+
src={userIcon2}
123124
className="img-responsive"
124125
style={{ borderRadius: "50%" }}
125126
/>

src/user/profile/profile-feed.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { Component } from "react";
22
import "./profile-feed.scss";
33
import {
44
FaComments,
5-
FaThumbtack,
65
FaGlobe,
76
FaStickyNote,
87
FaCalendar,
@@ -53,17 +52,18 @@ class ProfileFeed extends Component {
5352
}
5453

5554
componentWillReceiveProps(nextProps) {
56-
const { userEvents, userProjects, userPosts } = nextProps.user;
55+
const { userEvents, userProjects, userPosts, userProfile } = nextProps.user;
5756

5857
this.setState(
5958
{
6059
userProfile: nextProps.user?.userProfile,
6160
userEvents: userEvents,
6261
userProjects: userProjects,
6362
userPosts: userPosts,
63+
longDescription: userProfile?.info?.about?.longDescription
6464
},
6565
() => {
66-
console.log(this.state.userPosts);
66+
console.log(this.state.longDescription);
6767
}
6868
);
6969
}
@@ -128,7 +128,8 @@ class ProfileFeed extends Component {
128128
);
129129
});
130130

131-
const posts = userPosts.map((post, index) => {
131+
const posts =
132+
userPosts.map((post, index) => {
132133
return (
133134
<div
134135
className="postItem"
@@ -141,7 +142,7 @@ class ProfileFeed extends Component {
141142
</div>
142143
<div className="titleDetails">
143144
<div className="postTitle">
144-
{`${post.userId.name.firstName} ${post.userId.name.lastName}`}
145+
{`${post?.userId.name.firstName} ${post?.userId.name.lastName}`}
145146
</div>
146147
<dic className="postDate">{post.createdAt}</dic>
147148
</div>
@@ -156,6 +157,7 @@ class ProfileFeed extends Component {
156157
});
157158

158159
const overviewContent = [...posts, ...events];
160+
const {longDescription}= this.state
159161

160162
return (
161163
<div>
@@ -214,7 +216,7 @@ class ProfileFeed extends Component {
214216
</div>
215217
</div>
216218
<div className="postsContainer">
217-
{type === "ReadMe" ? <ReadMe /> : null}
219+
{type === "ReadMe" ? <ReadMe userProfile={userProfile}/> : null}
218220
<div className="gridContainer">
219221
{type === "All" ? overviewContent : null}
220222
{type === "Event" ? events : null}

0 commit comments

Comments
 (0)