git ssb

2+

mixmix / ticktack



Commit 88efa57edc6f7800ae827d2a28a7aab3065c1159

fix scroller filter bug, add scroller to context.level.-two

mix irving committed on 11/19/2017, 8:27:12 AM
Parent: bc3baa90f43110f56698bc1c3de13714835c9d08

Files changed

app/html/context.jschanged
app/html/scroller.jschanged
app/html/context.jsView
@@ -92,9 +92,9 @@
9292 return api.app.html.scroller({
9393 classList: [ 'level', '-one' ],
9494 prepend,
9595 stream: api.feed.pull.private,
96- filter: pull(
96+ filter: () => pull(
9797 pull.filter(msg => msg.value.content.type === 'post'), // TODO is this the best way to protect against votes?
9898 pull.filter(msg => msg.value.author != myKey),
9999 pull.filter(msg => msg.value.content.recps),
100100 pull.through(updateRecentMsgLog),
@@ -122,33 +122,34 @@
122122 if (!targetUser) return
123123
124124 var threads = MutantArray()
125125
126- pull(
127- next(api.feed.pull.private, {reverse: true, limit: 100, live: false}, ['value', 'timestamp']),
128- pull.filter(msg => msg.value.content.recps),
129- pull.filter(msg => msg.value.content.recps
130- .map(recp => typeof recp === 'object' ? recp.link : recp)
131- .some(recp => recp === targetUser)
126+ const prepend = Option({
127+ selected: page === 'threadNew',
128+ location: {page: 'threadNew', feed: targetUser},
129+ label: h('Button', strings.threadNew.action.new),
130+ })
131+
132+ return api.app.html.scroller({
133+ classList: [ 'level', '-two' ],
134+ prepend,
135+ stream: api.feed.pull.private,
136+ filter: () => pull(
137+ pull.filter(msg => msg.value.content.recps),
138+ pull.filter(msg => msg.value.content.recps
139+ .map(recp => typeof recp === 'object' ? recp.link : recp)
140+ .some(recp => recp === targetUser)
141+ ),
142+ api.feed.pull.rollup() // TODO - not technically a filter ...?
132143 ),
133- api.feed.pull.rollup(),
134- pull.drain(thread => threads.push(thread))
135- )
136-
137- return h('div.level.-two', [
138- Option({
139- selected: page === 'threadNew',
140- location: {page: 'threadNew', feed: targetUser},
141- label: h('Button', strings.threadNew.action.new),
142- }),
143- map(threads, thread => {
144+ render: (thread) => {
144145 return Option({
145146 label: api.message.html.subject(thread),
146147 selected: thread.key === root,
147148 location: Object.assign(thread, { feed: targetUser }),
148149 })
149- }, { comparer: (a, b) => a === b })
150- ])
150+ }
151+ })
151152 }
152153
153154 function Option ({ notifications = 0, imageEl, label, location, selected }) {
154155 const className = selected ? '-selected' : ''
app/html/scroller.jsView
@@ -15,72 +15,26 @@
1515
1616 function createScroller (opts = {}) {
1717 const {
1818 stream,
19- filter = pull.filter((msg) => true),
20- // renderer,
19+ filter = () => pull.filter((msg) => true),
20+ // render,
2121 // classList = [],
22- // content = h('section.content'),
2322 // prepend = [],
2423 // append = []
2524 } = opts
2625
27- const streamToTop = undefined
28- // pull(
29- // next(stream, {old: false, limit: 100}, ['value', 'timestamp']),
30- // filter // is a pull-stream through
31- // )
26+ const streamToTop = pull(
27+ next(stream, {old: false, limit: 100}, ['value', 'timestamp']),
28+ filter() // is a pull-stream through
29+ )
3230
3331 const streamToBottom = pull(
3432 next(stream, {reverse: true, limit: 100, live: false}, ['value', 'timestamp']),
35- filter
33+ filter()
3634 )
3735
3836 return Scroller(Object.assign({}, opts, { streamToTop, streamToBottom }))
39-
40- // const scroller = h('Scroller', { classList, style: { overflow: 'auto' } }, [
41- // h('div.wrapper', [
42- // h('header', prepend),
43- // content,
44- // h('footer', append)
45- // ])
46- // ])
47- // // scroller.scroll = keyscroll(content) // used for e.g. reset
48-
49- // draw()
50-
51- // return {
52- // scroller,
53- // content,
54- // // reset,
55- // }
56-
57- // function draw () {
58- // reset()
59-
60- // if (streamTop) {
61- // pull(
62- // next(streamTop, {old: false, limit: 100}, ['value', 'timestamp']),
63- // filter,
64- // // filterDownThrough(),
65- // pullScroll(scroller, content, renderer, true, false)
66- // )
67- // }
68-
69- // if (streamBottom) {
70- // pull(
71- // next(streamBottom, {reverse: true, limit: 100, live: false}, ['value', 'timestamp']),
72- // filter,
73- // // filterUpThrough(),
74- // pullScroll(scroller, content, renderer, false, false)
75- // )
76- // }
77- // }
78-
79- // function reset () {
80- // }
81- // }
82-
8337 }
8438 }
8539
8640 function keyscroll (content) {

Built with git-ssb-web