git ssb

2+

mixmix / ticktack



Tree: ee8e72469e3082880b91e42e3ed64747ad35033f

Files: ee8e72469e3082880b91e42e3ed64747ad35033f / app / page / userFind.js

1285 bytesRaw
1const nest = require('depnest')
2const { h, Value, computed, map } = require('mutant')
3
4exports.gives = nest('app.page.userFind')
5
6exports.needs = nest({
7 'about.html.image': 'first',
8 'app.html.link': 'first',
9 'about.async.suggest': 'first',
10 'translations.sync.strings': 'first',
11})
12
13exports.create = (api) => {
14 return nest('app.page.userFind', userFind)
15
16 function userFind (location) {
17 const strings = api.translations.sync.strings()
18 const input = Value()
19
20 const suggester = api.about.async.suggest()
21 const users = computed(input, input => suggester(input))
22
23 const Link = api.app.html.link
24
25 return h('Page -userFind', {title: strings.userFind.pageTitle}, [
26 h('div.container', [
27 h('div.search', [
28 h('i.fa.fa-search'),
29 h('input', {
30 placeholder: strings.userFind.action.findAUser,
31 autofocus: 'autofocus',
32 'ev-input': e => input.set(e.target.value)
33 }),
34 ]),
35 h('div.results', map(users, user => {
36 return Link({ feed: user.id },
37 h('div.result', [
38 api.about.html.image(user.id),
39 h('div.alias', user.title),
40 h('pre.key', user.id),
41 ])
42 )
43 }))
44 ])
45 ])
46 }
47}
48
49
50
51
52

Built with git-ssb-web