git ssb

9+

cel / ssb-viewer



Commit c1b5c8d3560b86c156450c93e8be1a9fe4205a20

render feed with about description and larger image on top

Anders Rune Jensen committed on 5/12/2017, 8:28:57 PM
Parent: dffd43f062a271d3a9be609e1129bf5ad153a4ff

Files changed

index.jschanged
render.jschanged
index.jsView
@@ -14,9 +14,10 @@
1414 MdRenderer,
1515 renderEmoji,
1616 formatMsgs,
1717 wrapPage,
18- renderThread
18 + renderThread,
19 + renderAbout
1920 } = require('./render');
2021
2122 var appHash = hash([fs.readFileSync(__filename)])
2223
@@ -107,9 +108,9 @@
107108 paramap(addAuthorAbout, 8),
108109 paramap(addFollowAbout, 8),
109110 paramap(addVoteMessage, 8),
110111 paramap(addGitLinks, 8),
111- pull(renderThread(defaultOpts), wrapPage(about.name)),
112 + pull(renderAbout(defaultOpts, about), wrapPage(about.name)),
112113 toPull(res, function (err) {
113114 if (err) console.error('[viewer]', err)
114115 })
115116 )
render.jsView
@@ -11,8 +11,9 @@
1111 exports.MdRenderer = MdRenderer;
1212 exports.renderEmoji = renderEmoji;
1313 exports.formatMsgs = formatMsgs;
1414 exports.renderThread = renderThread;
15 +exports.renderAbout = renderAbout;
1516
1617 function MdRenderer(opts) {
1718 marked.Renderer.call(this, {});
1819 this.opts = opts;
@@ -93,8 +94,32 @@
9394 return cat([pull.once(before), read, pull.once(after)]);
9495 };
9596 }
9697
98 +function renderAbout(opts, about) {
99 + return pull(
100 + pull.map(renderMsg.bind(this, opts)),
101 + wrap(
102 + '<span class="top-tip">You are reading content from ' +
103 + '<a href="https://www.scuttlebutt.nz">Scuttlebutt</a>' +
104 + '</span>' +
105 + '<main>' +
106 + '<article><header><figure>' +
107 + '<img src="' + opts.img_base + escape(about.image) + '" ' +
108 + 'height="200" width="200"><figcaption>' +
109 + 'Feed of ' + about.name + '<br/>' +
110 + (about.description != undefined ?
111 + marked(about.description, opts.marked) : '') +
112 + '</figcaption></figure></header></article>',
113 +
114 + '</main>' +
115 + '<a class="call-to-action" href="https://www.scuttlebutt.nz">' +
116 + 'Join Scuttlebutt now' +
117 + '</a>'
118 + )
119 + );
120 +}
121 +
97122 function renderThread(opts) {
98123 return pull(
99124 pull.map(renderMsg.bind(this, opts)),
100125 wrap(

Built with git-ssb-web