Commit 354bcc491180e33154ea042ff61d5912ae2d95ab
add scroller to userShow (removes unread count from here)
mix irving committed on 12/6/2017, 11:54:34 AMParent: 878a75b5b09e6272b0bdbb499735531d4e9864e9
Files changed
app/html/context.js | changed |
app/page/userShow.js | changed |
app/page/userShow.mcss | changed |
app/html/context.js | ||
---|---|---|
@@ -70,9 +70,9 @@ | ||
70 | 70 | ]) |
71 | 71 | |
72 | 72 | function LevelOneContext () { |
73 | 73 | function isDiscoverContext (loc) { |
74 | - const PAGES_UNDER_DISCOVER = ['blogIndex', 'blogShow'] | |
74 | + const PAGES_UNDER_DISCOVER = ['blogIndex', 'blogShow', 'userShow'] | |
75 | 75 | |
76 | 76 | return PAGES_UNDER_DISCOVER.includes(location.page) |
77 | 77 | || get(location, 'value.private') === undefined |
78 | 78 | } |
@@ -180,8 +180,9 @@ | ||
180 | 180 | function LevelTwoContext () { |
181 | 181 | const { key, value, feed: targetUser, page } = location |
182 | 182 | const root = get(value, 'content.root', key) |
183 | 183 | if (!targetUser) return |
184 | + if (page === 'userShow') return | |
184 | 185 | |
185 | 186 | |
186 | 187 | const prepend = Option({ |
187 | 188 | selected: page === 'threadNew', |
app/page/userShow.js | ||
---|---|---|
@@ -8,14 +8,17 @@ | ||
8 | 8 | exports.needs = nest({ |
9 | 9 | 'about.html.avatar': 'first', |
10 | 10 | 'about.obs.name': 'first', |
11 | 11 | 'about.obs.description': 'first', |
12 | + 'app.html.context': 'first', | |
12 | 13 | 'app.html.link': 'first', |
13 | 14 | 'app.html.blogCard': 'first', |
15 | + 'app.html.blogNav': 'first', | |
16 | + 'app.html.scroller': 'first', | |
14 | 17 | 'contact.html.follow': 'first', |
18 | + 'feed.pull.profile': 'first', | |
15 | 19 | 'feed.pull.rollup': 'first', |
16 | 20 | 'message.html.markdown': 'first', |
17 | - 'sbot.pull.userFeed': 'first', | |
18 | 21 | 'keys.sync.id': 'first', |
19 | 22 | 'translations.sync.strings': 'first', |
20 | 23 | 'unread.sync.isUnread': 'first' |
21 | 24 | }) |
@@ -24,76 +27,62 @@ | ||
24 | 27 | var isUnread = api.unread.sync.isUnread |
25 | 28 | return nest('app.page.userShow', userShow) |
26 | 29 | |
27 | 30 | function userShow (location) { |
28 | - | |
29 | 31 | const { feed } = location |
30 | 32 | const myId = api.keys.sync.id() |
31 | - const name = api.about.obs.name(feed) | |
32 | - const description = computed(api.about.obs.description(feed), d => api.message.html.markdown(d || '')) | |
33 | 33 | |
34 | 34 | const strings = api.translations.sync.strings() |
35 | 35 | |
36 | - // const { followers } = api.contact.obs | |
37 | - | |
38 | - // const youFollowThem = computed(followers(feed), followers => followers.includes(myId)) | |
39 | - // const theyFollowYou = computed(followers(myId), followers => followers.includes(feed)) | |
40 | - // const youAreFriends = computed([youFollowThem, theyFollowYou], (a, b) => a && b) | |
41 | - | |
42 | - // const ourRelationship = computed( | |
43 | - // [youAreFriends, youFollowThem, theyFollowYou], | |
44 | - // (youAreFriends, youFollowThem, theyFollowYou) => { | |
45 | - // if (youAreFriends) return strings.userShow.state.friends | |
46 | - // if (theyFollowYou) return strings.userShow.state.theyFollow | |
47 | - // if (youFollowThem) return strings.userShow.state.youFollow | |
48 | - // } | |
49 | - // ) | |
50 | - | |
51 | 36 | const Link = api.app.html.link |
52 | 37 | const userEditButton = Link({ page: 'userEdit', feed }, h('i.fa.fa-pencil')) |
53 | 38 | const directMessageButton = Link({ page: 'threadNew', feed }, h('Button', strings.userShow.action.directMessage)) |
54 | 39 | |
55 | 40 | const BLOG_TYPES = ['blog', 'post'] |
56 | - const blogs = MutantArray() | |
57 | - pull( | |
58 | - api.sbot.pull.userFeed({id: feed, reverse: true, live: false}), | |
59 | - pull.filter(msg => msg.value && msg.value.content && !msg.value.content.root), | |
60 | - pull.filter(msg => BLOG_TYPES.includes(get(msg, 'value.content.type'))), | |
61 | - // pull.filter(msg => get(msg, 'value.content.root') === undefined), | |
62 | - api.feed.pull.rollup(), | |
63 | - //unread state should not be in this file... | |
64 | - pull.through(function (blog) { | |
65 | - if(isUnread(blog)) | |
66 | - blog.unread = true | |
67 | - blog.replies.forEach(function (data) { | |
68 | - if(isUnread(data)) | |
69 | - blog.unread = data.unread = true | |
70 | - }) | |
71 | - }), | |
72 | - pull.drain(blogs.push) | |
73 | - // TODO - new Scroller ? | |
74 | - ) | |
75 | 41 | |
76 | - return h('Page -userShow', {title: name}, [ | |
77 | - h('div.content', [ | |
78 | - h('section.about', [ | |
79 | - api.about.html.avatar(feed, 'large'), | |
80 | - h('h1', [ | |
81 | - name, | |
82 | - feed === myId // Only expose own profile editing right now | |
83 | - ? userEditButton | |
84 | - : '' | |
85 | - ]), | |
86 | - h('div.introduction', description), | |
87 | - feed !== myId | |
88 | - ? h('div.actions', [ | |
89 | - api.contact.html.follow(feed), | |
90 | - h('div.directMessage', directMessageButton) | |
91 | - ]) | |
92 | - : '', | |
42 | + // TODO return some of this ? | |
43 | + // but maybe this shouldn't be done here ? | |
44 | + // pull.through(function (blog) { | |
45 | + // if(isUnread(blog)) | |
46 | + // blog.unread = true | |
47 | + // blog.replies.forEach(function (data) { // this was fed rollups | |
48 | + // if(isUnread(data)) | |
49 | + // blog.unread = data.unread = true | |
50 | + // }) | |
51 | + // }), | |
52 | + | |
53 | + const prepend = [ | |
54 | + api.app.html.blogNav(location), | |
55 | + h('section.about', [ | |
56 | + api.about.html.avatar(feed, 'large'), | |
57 | + h('h1', [ | |
58 | + api.about.obs.name(feed), | |
59 | + feed === myId // Only expose own profile editing right now | |
60 | + ? userEditButton | |
61 | + : '' | |
93 | 62 | ]), |
94 | - h('section.blogs', map(blogs, api.app.html.blogCard)) | |
95 | - ]) | |
63 | + h('div.introduction', computed(api.about.obs.description(feed), d => api.message.html.markdown(d || ''))), | |
64 | + feed !== myId | |
65 | + ? h('div.actions', [ | |
66 | + api.contact.html.follow(feed), | |
67 | + h('div.directMessage', directMessageButton) | |
68 | + ]) | |
69 | + : '', | |
70 | + ]), | |
71 | + ] | |
72 | + | |
73 | + return h('Page -userShow', [ | |
74 | + api.app.html.context(location), | |
75 | + api.app.html.scroller({ | |
76 | + classList: ['content'], | |
77 | + prepend, | |
78 | + stream: api.feed.pull.profile(feed), | |
79 | + filter: () => pull( | |
80 | + pull.filter(msg => get(msg, 'value.content.root') === undefined), | |
81 | + pull.filter(msg => BLOG_TYPES.includes(get(msg, 'value.content.type'))) | |
82 | + ), | |
83 | + render: api.app.html.blogCard | |
84 | + }) | |
96 | 85 | ]) |
97 | 86 | } |
98 | 87 | } |
99 | 88 |
app/page/userShow.mcss | ||
---|---|---|
@@ -1,42 +1,59 @@ | ||
1 | 1 | Page -userShow { |
2 | - div.content { | |
3 | - section.about { | |
4 | - margin-top: 4rem | |
5 | - margin-bottom: 4rem | |
2 | + div.content { padding: 0 } | |
6 | 3 | |
7 | - display: flex | |
8 | - flex-direction: column | |
9 | - align-items: center | |
4 | + div.Scroller.content { | |
5 | + section.top { | |
6 | + section.about { | |
7 | + margin-top: 4rem | |
8 | + margin-bottom: 4rem | |
10 | 9 | |
11 | - img.Avatar { | |
12 | - } | |
10 | + display: flex | |
11 | + flex-direction: column | |
12 | + align-items: center | |
13 | 13 | |
14 | - h1 { | |
15 | - font-weight: 300 | |
16 | - font-size: 1rem | |
17 | - | |
18 | - display: flex | |
19 | - div.Link { | |
20 | - margin-left: .5rem | |
14 | + img.Avatar { | |
21 | 15 | } |
22 | - } | |
16 | + div.introduction { | |
17 | + $maxWidthSmaller | |
18 | + } | |
23 | 19 | |
24 | - div.actions { | |
25 | - display: flex | |
26 | - | |
27 | - div.Follow { | |
28 | - margin-right: 1rem | |
20 | + h1 { | |
21 | + font-weight: 300 | |
22 | + font-size: 1rem | |
23 | + | |
24 | + display: flex | |
25 | + div.Link { | |
26 | + margin-left: .5rem | |
27 | + } | |
29 | 28 | } |
30 | 29 | |
31 | - div.directMessage { | |
30 | + div.actions { | |
31 | + display: flex | |
32 | + | |
33 | + div.Follow { | |
34 | + margin-right: 1rem | |
35 | + } | |
36 | + | |
37 | + div.directMessage { | |
38 | + } | |
32 | 39 | } |
33 | 40 | } |
34 | 41 | } |
35 | 42 | |
36 | - section.blogs { | |
43 | + section.content { | |
44 | + background-color: #fff | |
45 | + $maxWidth | |
46 | + margin: .8rem auto | |
47 | + padding: .5rem 2rem | |
48 | + | |
49 | + display: flex | |
50 | + flex-wrap: wrap | |
51 | + | |
37 | 52 | div.BlogCard { |
38 | - margin-bottom: .5rem | |
53 | + flex-basis: 100% | |
54 | + border-bottom: 1px solid rgba(0,0,0, .1) | |
55 | + /* margin-bottom: .5rem */ | |
39 | 56 | |
40 | 57 | div.context { |
41 | 58 | div.Link { display: none } |
42 | 59 | div.name { display: none } |
Built with git-ssb-web