Skip to content

Commit aa6e4cc

Browse files
committed
add user personal feed
1 parent 0fea6ae commit aa6e4cc

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

public/css/style.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ a {
1111
display: inline-block;*/
1212
}
1313

14-
main {
15-
max-width: 600px;
14+
main, aside {
15+
max-width: 520px;
1616
margin: 0 auto;
1717
}
1818

19+
1920
img {
2021
max-width: 100%;
2122
}

public/js/main.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ function getBlog(username){
5050
displayContent(result)
5151
})
5252
}
53+
54+
function getUserFeed(username){
55+
let query = {
56+
tag: username,
57+
limit: 20
58+
}
59+
steem.api.getDiscussionsByFeed(query, (err, result) => {
60+
console.log(result)
61+
displayContent(result)
62+
});
63+
}
64+
5365
function displayContent(result, initial){
5466
if (!initial) result.shift()
5567
for (let i = 0; i < result.length ; i++) {
@@ -71,15 +83,13 @@ function displayContent(result, initial){
7183
}
7284

7385
let itemTemplate = `
74-
<a href="${post.url}">
7586
<div class="item " data-url="${post.url}" data-permlink="${ post.permlink }">
76-
<img class="item__image " src="https://steemitimages.com/480x768/${image}" onerror="">
87+
<img class="item__image " src="https://steemitimages.com/520x520/${image}" onerror="">
7788
<div class="item__author">
78-
<h1>${post.title}</h1>
79-
<span>@${post.author}</span>
89+
<a href="${post.url}"><h2>${post.title}</h2></a>
90+
<a href="@${post.author}"><span>@${post.author}</span></a>
8091
</div>
8192
</div>
82-
</a>
8393
`
8494
$('.feed-insert').append(itemTemplate)
8595
}
@@ -305,6 +315,10 @@ if ($('main').hasClass('single')) {
305315
getPostAndComments(`/${data.category}/@${data.username}/${data.permlink}`)
306316
}
307317

318+
if ($('main').hasClass('dashboard')) {
319+
let username = $('main').data('username')
320+
getUserFeed(username)
321+
}
308322

309323
if ($('main').hasClass('profile') ) {
310324
let username = $('.profile').data('username')

views/user.pug

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ extends layout
22

33
block content
44
include partials/nav
5-
6-
main
7-
img(src=`${profileImage}` width="200px")
8-
h1 Profile
9-
h2 #{name}
5+
6+
aside
7+
img(src=`${profileImage}` width="50px")
8+
h3 #{name}
109
p #{about}
10+
11+
main.dashboard(data-username=`${name}`)
12+
section.container
13+
.row.feed-insert

0 commit comments

Comments
 (0)