git ssb

10+

Matt McKegg / patchwork



Commit 72e27cc7fada9532d1951f62691f02afd6b81b03

Add 'not following anyone' warning to channel pages too.

Gordon Martin committed on 12/28/2017, 2:07:04 PM
Parent: 02eb138217bf2dd28c3be988febc79c8d62e190b

Files changed

locales/en.jsonchanged
modules/page/html/render/channel.jschanged
modules/page/html/render/public.jschanged
styles/dark/not-following-anyone.mcssadded
styles/dark/public-feed.mcssdeleted
styles/light/not-following-anyone.mcssadded
styles/light/public-feed.mcssdeleted
locales/en.jsonView
@@ -129,6 +129,13 @@
129129 "Block": "Block",
130130 "Write a private reply": "Write a private reply",
131131 "Write a public reply": "Write a public reply",
132132 "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."
134141 }
modules/page/html/render/channel.jsView
@@ -9,9 +9,10 @@
99 'feed.pull.channel': 'first',
1010 'sbot.pull.log': 'first',
1111 'message.async.publish': 'first',
1212 'keys.sync.id': 'first',
13- 'intl.sync.i18n': 'first'
13+ 'intl.sync.i18n': 'first',
14+ 'profile.obs.contact': 'first'
1415 })
1516
1617 exports.gives = nest('page.html.render')
1718
@@ -19,11 +20,15 @@
1920 const i18n = api.intl.sync.i18n
2021 return nest('page.html.render', function channel (path) {
2122 if (path[0] !== '#') return
2223
24+ var id = api.keys.sync.id()
25+
2326 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)
2528
29+ var contact = api.profile.obs.contact(id)
30+
2631 var prepend = [
2732 h('PageHeading', [
2833 h('h1', `#${channel}`),
2934 h('div.meta', [
@@ -42,9 +47,10 @@
4247 ]),
4348 api.message.html.compose({
4449 meta: {type: 'post', channel},
4550 placeholder: i18n('Write a message in this channel')
46- })
51+ }),
52+ noVisibleNewPostsWarning()
4753 ]
4854
4955 return api.feed.html.rollup(api.feed.pull.channel(channel), {
5056 prepend,
@@ -69,8 +75,22 @@
6975 if (typeof link === 'string' && link.startsWith('#')) {
7076 return `#${api.channel.sync.normalize(link.slice(1))}`
7177 }
7278 }
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+
7393 })
7494
7595 function subscribe (id) {
7696 // confirm
modules/page/html/render/public.jsView
@@ -263,9 +263,9 @@
263263 }
264264
265265 function noVisibleNewPostsWarning() {
266266 var content =
267- h('div', {classList: 'PublicFeed main'}, h('section -notFollowingAnyoneWarning', [
267+ h('div', {classList: 'NotFollowingAnyoneWarning'}, h('section -notFollowingAnyoneWarning', [
268268 h('h1', i18n('Welcome to Patchwork')),
269269 h('p', i18n('You may not be able to see new content until you follow some users or pubs.')),
270270 h('p', [i18n("For help, see the 'Getting Started' guide at "),
271271 h('a', {href: 'https://www.scuttlebutt.nz/'}, 'https://www.scuttlebutt.nz/')]
styles/dark/not-following-anyone.mcssView
@@ -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.mcssView
@@ -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.mcssView
@@ -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.mcssView
@@ -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