Commit 72e27cc7fada9532d1951f62691f02afd6b81b03
Add 'not following anyone' warning to channel pages too.
Gordon Martin committed on 12/28/2017, 2:07:04 PMParent: 02eb138217bf2dd28c3be988febc79c8d62e190b
Files changed
locales/en.json | ||
---|---|---|
@@ -129,6 +129,13 @@ | ||
129 | 129 | "Block": "Block", |
130 | 130 | "Write a private reply": "Write a private reply", |
131 | 131 | "Write a public reply": "Write a public reply", |
132 | 132 | "External Link": "External Link", |
133 | - "subscribed to ": "subscribed to " | |
133 | + "subscribed to ": "subscribed to ", | |
134 | + "unsubscribed from ": "unsubscribed from ", | |
135 | + "Click to unsubscribe": "Click to unsubscribe", | |
136 | + "Subscribed": "Subscribed", | |
137 | + "Write a message in this channel": "Write a message in this channel", | |
138 | + "mentioned this channel": "mentioned this channel", | |
139 | + "You are not Following Anyone": "You are not Following Anyone", | |
140 | + "You may not be able to see new channel content until you follow some users or pubs.": "You may not be able to see new channel content until you follow some users or pubs." | |
134 | 141 | } |
modules/page/html/render/channel.js | ||
---|---|---|
@@ -9,9 +9,10 @@ | ||
9 | 9 | 'feed.pull.channel': 'first', |
10 | 10 | 'sbot.pull.log': 'first', |
11 | 11 | 'message.async.publish': 'first', |
12 | 12 | 'keys.sync.id': 'first', |
13 | - 'intl.sync.i18n': 'first' | |
13 | + 'intl.sync.i18n': 'first', | |
14 | + 'profile.obs.contact': 'first' | |
14 | 15 | }) |
15 | 16 | |
16 | 17 | exports.gives = nest('page.html.render') |
17 | 18 | |
@@ -19,11 +20,15 @@ | ||
19 | 20 | const i18n = api.intl.sync.i18n |
20 | 21 | return nest('page.html.render', function channel (path) { |
21 | 22 | if (path[0] !== '#') return |
22 | 23 | |
24 | + var id = api.keys.sync.id() | |
25 | + | |
23 | 26 | var channel = api.channel.sync.normalize(path.substr(1)) |
24 | - var subscribedChannels = api.channel.obs.subscribed(api.keys.sync.id()) | |
27 | + var subscribedChannels = api.channel.obs.subscribed(id) | |
25 | 28 | |
29 | + var contact = api.profile.obs.contact(id) | |
30 | + | |
26 | 31 | var prepend = [ |
27 | 32 | h('PageHeading', [ |
28 | 33 | h('h1', `#${channel}`), |
29 | 34 | h('div.meta', [ |
@@ -42,9 +47,10 @@ | ||
42 | 47 | ]), |
43 | 48 | api.message.html.compose({ |
44 | 49 | meta: {type: 'post', channel}, |
45 | 50 | placeholder: i18n('Write a message in this channel') |
46 | - }) | |
51 | + }), | |
52 | + noVisibleNewPostsWarning() | |
47 | 53 | ] |
48 | 54 | |
49 | 55 | return api.feed.html.rollup(api.feed.pull.channel(channel), { |
50 | 56 | prepend, |
@@ -69,8 +75,22 @@ | ||
69 | 75 | if (typeof link === 'string' && link.startsWith('#')) { |
70 | 76 | return `#${api.channel.sync.normalize(link.slice(1))}` |
71 | 77 | } |
72 | 78 | } |
79 | + | |
80 | + function noVisibleNewPostsWarning() { | |
81 | + var content = | |
82 | + h('div', {classList: 'NotFollowingAnyoneWarning'}, h('section -notFollowingAnyoneWarning', [ | |
83 | + h('h1', i18n('You are not Following Anyone')), | |
84 | + h('p', i18n('You may not be able to see new channel content until you follow some users or pubs.')), | |
85 | + h('p', [i18n("For help, see the 'Getting Started' guide at "), | |
86 | + h('a', {href: 'https://www.scuttlebutt.nz/'}, 'https://www.scuttlebutt.nz/')] | |
87 | + ), | |
88 | + ])) | |
89 | + | |
90 | + return when(contact.isNotFollowingAnybody, content) | |
91 | + } | |
92 | + | |
73 | 93 | }) |
74 | 94 | |
75 | 95 | function subscribe (id) { |
76 | 96 | // confirm |
modules/page/html/render/public.js | ||
---|---|---|
@@ -263,9 +263,9 @@ | ||
263 | 263 | } |
264 | 264 | |
265 | 265 | function noVisibleNewPostsWarning() { |
266 | 266 | var content = |
267 | - h('div', {classList: 'PublicFeed main'}, h('section -notFollowingAnyoneWarning', [ | |
267 | + h('div', {classList: 'NotFollowingAnyoneWarning'}, h('section -notFollowingAnyoneWarning', [ | |
268 | 268 | h('h1', i18n('Welcome to Patchwork')), |
269 | 269 | h('p', i18n('You may not be able to see new content until you follow some users or pubs.')), |
270 | 270 | h('p', [i18n("For help, see the 'Getting Started' guide at "), |
271 | 271 | h('a', {href: 'https://www.scuttlebutt.nz/'}, 'https://www.scuttlebutt.nz/')] |
styles/dark/not-following-anyone.mcss | ||
---|---|---|
@@ -1,0 +1,28 @@ | ||
1 | +NotFollowingAnyoneWarning { | |
2 | + margin: auto | |
3 | + | |
4 | + section { | |
5 | + padding: 20px 20px 20px 20px | |
6 | + width: 700px | |
7 | + | |
8 | + -notFollowingAnyoneWarning { | |
9 | + border: 1px solid #ffba4e | |
10 | + background: #5f410b | |
11 | + margin: 5px 0 | |
12 | + color: #ffdda7 | |
13 | + font-size: 110% | |
14 | + } | |
15 | + | |
16 | + h1 { | |
17 | + font-size: 120% | |
18 | + font-weight: bold | |
19 | + margin: 0 | |
20 | + color: white | |
21 | + } | |
22 | + | |
23 | + p { | |
24 | + margin: 0 | |
25 | + margin-top: 8px | |
26 | + } | |
27 | + } | |
28 | +} |
styles/dark/public-feed.mcss | ||
---|---|---|
@@ -1,28 +1,0 @@ | ||
1 | -PublicFeed { | |
2 | - margin: auto | |
3 | - | |
4 | - section { | |
5 | - padding: 20px 20px 20px 20px | |
6 | - width: 700px | |
7 | - | |
8 | - -notFollowingAnyoneWarning { | |
9 | - border: 1px solid #ffba4e | |
10 | - background: #5f410b | |
11 | - margin: 5px 0 | |
12 | - color: #ffdda7 | |
13 | - font-size: 110% | |
14 | - } | |
15 | - | |
16 | - h1 { | |
17 | - font-size: 120% | |
18 | - font-weight: bold | |
19 | - margin: 0 | |
20 | - color: white | |
21 | - } | |
22 | - | |
23 | - p { | |
24 | - margin: 0 | |
25 | - margin-top: 8px | |
26 | - } | |
27 | - } | |
28 | -} |
styles/light/not-following-anyone.mcss | ||
---|---|---|
@@ -1,0 +1,29 @@ | ||
1 | +NotFollowingAnyoneWarning { | |
2 | + margin: auto | |
3 | + | |
4 | + section { | |
5 | + background: #4c4a4a | |
6 | + padding: 20px 20px 20px 20px | |
7 | + width: 700px | |
8 | + | |
9 | + -notFollowingAnyoneWarning { | |
10 | + border: 1px solid #ffc965; | |
11 | + background: #ffebcc; | |
12 | + margin: 5px 0; | |
13 | + color: #8a6800; | |
14 | + font-size: 110%; | |
15 | + } | |
16 | + | |
17 | + h1 { | |
18 | + font-size: 120% | |
19 | + font-weight: bold | |
20 | + margin: 0 | |
21 | + color: #583805 | |
22 | + } | |
23 | + | |
24 | + p { | |
25 | + margin: 0 | |
26 | + margin-top: 8px | |
27 | + } | |
28 | + } | |
29 | +} |
styles/light/public-feed.mcss | ||
---|---|---|
@@ -1,29 +1,0 @@ | ||
1 | -PublicFeed { | |
2 | - margin: auto | |
3 | - | |
4 | - section { | |
5 | - background: #4c4a4a | |
6 | - padding: 20px 20px 20px 20px | |
7 | - width: 700px | |
8 | - | |
9 | - -notFollowingAnyoneWarning { | |
10 | - border: 1px solid #ffc965; | |
11 | - background: #ffebcc; | |
12 | - margin: 5px 0; | |
13 | - color: #8a6800; | |
14 | - font-size: 110%; | |
15 | - } | |
16 | - | |
17 | - h1 { | |
18 | - font-size: 120% | |
19 | - font-weight: bold | |
20 | - margin: 0 | |
21 | - color: #583805 | |
22 | - } | |
23 | - | |
24 | - p { | |
25 | - margin: 0 | |
26 | - margin-top: 8px | |
27 | - } | |
28 | - } | |
29 | -} |
Built with git-ssb-web