Skip to content

Commit 9af4a04

Browse files
authored
Merge pull request #47 from sikehish/master
Fixed: Blank page if no user found #45
2 parents 7b7c5c2 + 854f5a9 commit 9af4a04

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/component/Profile/profilePage.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,3 +1146,10 @@ font-size: 0.9rem;
11461146
width: 78vw;
11471147
}
11481148
}
1149+
1150+
1151+
/* Used to display user not found message */
1152+
.not-found{
1153+
color: rgb(71, 200, 122, 0.9);
1154+
text-align: center;
1155+
}

src/component/Profile/profilePage.jsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ function ProfilePage() {
8282

8383
useEffect(() => {
8484
// When the component mounts, call showTweets to display the tweets
85-
showTweets();
85+
86+
//ensuring that tweets arent shown when the user doesnt exist(could lead to errors and hence the if condition)
87+
if(accessProfile) showTweets();
8688
dispatch(ProfileAction(apiname));
8789
}, [apiname]);
8890

@@ -182,6 +184,24 @@ function ProfilePage() {
182184
return formattedDate;
183185
}
184186

187+
/* Used to display user not found message */
188+
if(!accessProfile) return (
189+
<>
190+
<Sidebar />
191+
{loading === true ? <Loader loading={loading} /> : <div className="PROFILE POPUPBG">
192+
<div className="profileDiv1">
193+
<img src={avatar} className="pImage" alt="Avatar" />
194+
<div className="PBLOCK1">
195+
<div className="pBlock1">
196+
<h3 className="not-found">User @{apiname} not found ☹️</h3>
197+
</div>
198+
</div>
199+
</div>
200+
</div>}
201+
</>
202+
)
203+
204+
185205
return (
186206
<>
187207
<Sidebar />

0 commit comments

Comments
 (0)