Files: 0b0275502152a806a995b36fd4d29e8c3df1195e / app / html / sideNav / sideNavAddressBook.js
2083 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, computed, Struct, map, when, Dict, Array: MutantArray, Value, Set, resolve } = require('mutant') |
3 | const pull = require('pull-stream') |
4 | const next = require('pull-next-step') |
5 | const get = require('lodash/get') |
6 | const isEmpty = require('lodash/isEmpty') |
7 | const path = require('path') |
8 | |
9 | exports.gives = nest({ |
10 | 'app.html.sideNav': true, |
11 | }) |
12 | |
13 | exports.needs = nest({ |
14 | // 'app.html.scroller': 'first', |
15 | // 'about.html.avatar': 'first', |
16 | // 'about.obs.name': 'first', |
17 | // 'feed.pull.private': 'first', |
18 | // 'history.sync.push': 'first', |
19 | // 'message.html.subject': 'first', |
20 | // 'sbot.obs.localPeers': 'first', |
21 | 'translations.sync.strings': 'first', |
22 | // 'unread.sync.isUnread': 'first' |
23 | }) |
24 | |
25 | exports.create = (api) => { |
26 | return nest({ |
27 | 'app.html.sideNav': sideNav, |
28 | }) |
29 | |
30 | function sideNav (location, relationships) { |
31 | if (location.page !== 'addressBook') return |
32 | |
33 | const strings = api.translations.sync.strings().addressBook |
34 | |
35 | // TODO - show local peers? |
36 | // var nearby = api.sbot.obs.localPeers() |
37 | |
38 | return h('SideNav -addressBook', [ |
39 | LevelOneSideNav(), |
40 | ]) |
41 | |
42 | function LevelOneSideNav () { |
43 | function count (relationshipType) { |
44 | return computed(relationships, rels => rels[relationshipType].length) |
45 | } |
46 | |
47 | return h('div.level.-one', [ |
48 | h('section', [ |
49 | h('Option', [ |
50 | h('Button -primary', {}, strings.action.addUser), |
51 | ]), |
52 | h('hr'), |
53 | ]), |
54 | |
55 | //Friends |
56 | h('section', [ |
57 | h('header',strings.heading.people), |
58 | h('Option', [ |
59 | h('i.fa.fa-angle-right'), |
60 | strings.section.friends, |
61 | h('div.count', count('friends')) |
62 | ]), |
63 | h('Option',[ |
64 | h('i.fa.fa-angle-right'), |
65 | strings.section.following, |
66 | h('div.count', count('following')) |
67 | ]), |
68 | h('Option',[ |
69 | h('i.fa.fa-angle-right'), |
70 | strings.section.followers, |
71 | h('div.count', count('followers')) |
72 | ]), |
73 | ]) |
74 | ]) |
75 | } |
76 | } |
77 | } |
78 | |
79 |
Built with git-ssb-web