git ssb

0+

Daan Patchwork / ssb-viewer



forked from cel / ssb-viewer

Commit 13d54825caa9906484c32c0b3ba3483fcc7f1923

Render npm packages more

cel committed on 9/1/2018, 1:55:40 AM
Parent: 1a47f5f10e7f528233fc2adfe33565b40ecb322f

Files changed

render.jschanged
render.jsView
@@ -506,9 +506,17 @@
506506 var host = c.address && c.address.host
507507 return h('span.status', 'Connected to the pub ' + host);
508508 }
509509 else if (c.type == "npm-packages") {
510- return [h('span.status', 'Pushed npm packages')];
510+ return h('div.status', 'Pushed npm packages',
511+ Array.isArray(c.mentions) ? h('ul', c.mentions.map(function (link) {
512+ var name = link && link.name
513+ var m = name && /^npm:([^:]*):([^:]*)(?::([^:]*)(?:\.tgz)?)?$/.exec(name)
514+ if (!m) return
515+ var [, name, version, tag] = m
516+ return h('li', name + ' v' + version + (tag ? ' (' + tag + ')' : ''))
517+ })) : ''
518+ );
511519 }
512520 else if (c.type == "channel" && c.subscribed)
513521 return h('span.status',
514522 'Subscribed to channel ',

Built with git-ssb-web