Skip to content

Commit 6a5caf3

Browse files
committed
Fix author photo bug and scroll to top on context change
1 parent 016d1f8 commit 6a5caf3

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class App extends Component {
2020
}
2121

2222
fetchHotPosts() {
23+
window.scrollTo(0,0)
2324
let _this = this;
2425
this.setState({ isLoading: true });
2526
axios.get(`${baseURL}/ajax/posts/hot`)
@@ -33,6 +34,7 @@ class App extends Component {
3334
}
3435

3536
fetchTrendingPosts() {
37+
window.scrollTo(0,0)
3638
let _this = this;
3739
this.setState({ isLoading: true });
3840
axios.get(`${baseURL}/ajax/posts/stories/trending`)

components/PostCard.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export class PostCard extends Component {
1919
}
2020

2121
loadProfileImage(src){
22+
if(!src){
23+
return;
24+
}
2225
if (src.indexOf('//res.cloudinary.com') !== -1 && src.indexOf('/upload/') !== -1) {
2326
return this.getReplacedImage(src);
2427
}
@@ -41,7 +44,7 @@ export class PostCard extends Component {
4144
</a>
4245
<div className="post-footer">
4346
<a href={`${post.author ? 'https://hashnode.com/@'+post.author.username+'?utm_source=chrome_extension&utm_medium=extension' : ''}`} target="_blank" className="author">
44-
<img src={((post.author && this.loadProfileImage(post.author.photo)) || dummyUserImage)} />
47+
<img src={((post.author && post.author.photo && this.loadProfileImage(post.author.photo)) || dummyUserImage)} />
4548
</a>
4649
<div className="post-activity">
4750
<a href={`https://hashnode.com/post/${post.slug}-${post.cuid}?utm_source=chrome_extension&utm_medium=extension`} target="_blank" className="reactions">

manifest.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Hashnode — The Dev Community",
33
"manifest_version": 2,
4-
"version": "0.0.3",
4+
"version": "0.0.4",
55
"description": "Hashnode Chrome Extension to read hot discussions and stories. Stay up-to-date with what's happening in the developer's community.",
66
"permissions": [],
77
"background": {},
@@ -14,12 +14,6 @@
1414
},
1515
"author": "Hashnode",
1616
"homepage_url": "https://hashnode.com",
17-
"default_icon": {
18-
"16": "images/hn-logo-16.png",
19-
"32": "images/hn-logo-32.png",
20-
"48": "images/hn-logo-48.png",
21-
"128": "images/hn-logo-128.png"
22-
},
2317
"icons": {
2418
"16": "images/hn-logo-16.png",
2519
"32": "images/hn-logo-32.png",

0 commit comments

Comments
 (0)