modules/page/html/render/public.jsView |
---|
60 | 60 | var connectedPubs = computed([connectedPeers, localPeers], (c, l) => c.filter(x => !l.includes(x))) |
61 | 61 | var contact = api.profile.obs.contact(id) |
62 | 62 | |
63 | 63 | var prepend = [ |
64 | | - api.message.html.compose({ meta: { type: 'post' }, placeholder: i18n('Write a public message') }) |
| 64 | + api.message.html.compose({ meta: { type: 'post' }, placeholder: i18n('Write a public message') }), |
| 65 | + noVisibleNewPostsWarning() |
65 | 66 | ] |
66 | 67 | |
67 | 68 | var lastMessage = null |
68 | 69 | |
131 | 132 | var result = h('div.SplitView', [ |
132 | 133 | h('div.side', [ |
133 | 134 | getSidebar() |
134 | 135 | ]), |
135 | | - h('div.main', [ |
136 | | - when( |
137 | | - computed([contact.isNotFollowingAnybody, loading], (a,b) => a && !b), |
138 | | - renderNoVisiblePostsWarning(i18n) |
139 | | - ), |
140 | | - feedView]) |
| 136 | + h('div.main', feedView) |
141 | 137 | ]) |
142 | 138 | |
143 | 139 | result.pendingUpdates = feedView.pendingUpdates |
144 | 140 | result.reload = function () { |
265 | 261 | ]) |
266 | 262 | ] |
267 | 263 | } |
268 | 264 | |
| 265 | + function noVisibleNewPostsWarning() { |
| 266 | + var content = |
| 267 | + h('div', {classList: 'PublicFeed main'}, h('section -notFollowingAnyoneWarning', [ |
| 268 | + h('h1', i18n('You are not following anybody.')), |
| 269 | + h('h3', i18n(`You may not be able to see new posts and replies.`)), |
| 270 | + h('h3', i18n('You can only see new posts from people you follow, and people that they follow.')), |
| 271 | + h('h3', i18n('Follow one or more users to see some new posts.')) |
| 272 | + ])) |
| 273 | + |
| 274 | + return when( |
| 275 | + computed([loading, contact.isNotFollowingAnybody], |
| 276 | + (isLoading,isNotFollowingAnybody) => !isLoading && isNotFollowingAnybody |
| 277 | + ), |
| 278 | + content |
| 279 | + ) |
| 280 | + } |
| 281 | + |
269 | 282 | function subscribe (id) { |
270 | 283 | api.message.async.publish({ |
271 | 284 | type: 'channel', |
272 | 285 | channel: id, |
289 | 302 | } |
290 | 303 | } |
291 | 304 | } |
292 | 305 | |
293 | | -function renderNoVisiblePostsWarning(i18n) { |
294 | | - return h('div', {classList: 'PublicFeed main'}, h('section -notFollowingAnyoneWarning', [ |
295 | | - h('h1', i18n('You are not following anybody.')), |
296 | | - h('h3', i18n(`You may not be able to see new posts and replies.`)), |
297 | | - h('h3', i18n('You can only see new posts from people you follow, and people that they follow.')), |
298 | | - h('h3', i18n('Follow one or more users to see some new posts.')) |
299 | | - ])) |
300 | | -} |
301 | | - |
302 | 306 | function getType (msg) { |
303 | 307 | return msg && msg.value && msg.value.content && msg.value.content.type |
304 | 308 | } |
305 | 309 | |