Files: 354bcc491180e33154ea042ff61d5912ae2d95ab / app / page / userFind.js
1283 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, Value, computed, map } = require('mutant') |
3 | |
4 | exports.gives = nest('app.page.userFind') |
5 | |
6 | exports.needs = nest({ |
7 | 'about.html.image': 'first', |
8 | 'app.html.link': 'first', |
9 | 'about.async.suggest': 'first', |
10 | 'translations.sync.strings': 'first', |
11 | }) |
12 | |
13 | exports.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.content', [ |
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