Commit f3409d0dc8b00fb3846783f9e510314430c1ecd1
Merge pull request #11 from ticktackim/profile
WIP profile pageDominic Tarr authored on 8/14/2017, 10:53:14 PM
GitHub committed on 8/14/2017, 10:53:14 PM
Parent: d2ef619dd77cafe0c113840831438790127a1875
Parent: ce8d61fcc1f40737fead142b9c628519f7e9a145
Files changed
app/html/link.mcss | added |
app/index.js | changed |
app/page/userShow.js | changed |
app/page/threadNew.js | added |
router/sync/routes.js | changed |
app/html/link.mcss | ||
---|---|---|
@@ -1,0 +1,6 @@ | ||
1 | +Link { | |
2 | + color: blue | |
3 | + :hover { | |
4 | + text-decoration: underline | |
5 | + } | |
6 | +} |
app/index.js | ||
---|---|---|
@@ -17,7 +17,8 @@ | ||
17 | 17 | home: require('./page/home'), |
18 | 18 | settings: require('./page/settings'), |
19 | 19 | userFind: require('./page/userFind'), |
20 | 20 | userShow: require('./page/userShow'), |
21 | + threadNew: require('./page/threadNew'), | |
21 | 22 | threadShow: require('./page/threadShow'), |
22 | 23 | } |
23 | 24 | } |
app/page/userShow.js | ||
---|---|---|
@@ -3,19 +3,34 @@ | ||
3 | 3 | |
4 | 4 | exports.gives = nest('app.page.userShow') |
5 | 5 | |
6 | 6 | exports.needs = nest({ |
7 | - 'app.html.nav': 'first' | |
7 | + 'app.html.link': 'first', | |
8 | + 'app.html.nav': 'first', | |
9 | + 'about.html.image': 'first', | |
10 | + 'about.obs.name': 'first', | |
11 | + 'keys.sync.id': 'first', | |
8 | 12 | }) |
9 | 13 | |
10 | 14 | exports.create = (api) => { |
11 | 15 | return nest('app.page.userShow', userShow) |
12 | 16 | |
13 | 17 | function userShow (location) { |
14 | 18 | |
19 | + const { feed } = location | |
20 | + const Link = api.app.html.link | |
21 | + const myId = api.keys.sync.id() | |
22 | + | |
15 | 23 | return h('Page -userShow', [ |
16 | - h('h1', 'User show'), | |
24 | + h('h1', api.about.obs.name(feed)), | |
17 | 25 | api.app.html.nav(), |
18 | - h('p', `key: ${location.key}`) | |
26 | + api.about.html.image(feed), | |
27 | + h('div', 'follow button'), | |
28 | + h('div', 'friends in common'), | |
29 | + feed !== myId | |
30 | + ? Link({ page: 'threadNew', feed }, 'New Thread') | |
31 | + : '', | |
32 | + h('div', 'conversations you\'ve had with dominic'), | |
33 | + h('div', 'groups dominic is in'), | |
19 | 34 | ]) |
20 | 35 | } |
21 | 36 | } |
app/page/threadNew.js | ||
---|---|---|
@@ -1,0 +1,26 @@ | ||
1 | +const nest = require('depnest') | |
2 | +const { h } = require('mutant') | |
3 | + | |
4 | +exports.gives = nest('app.page.threadNew') | |
5 | + | |
6 | +exports.needs = nest({ | |
7 | + 'about.html.image': 'first', | |
8 | + 'about.obs.name': 'first', | |
9 | + 'app.html.nav': 'first', | |
10 | + 'app.html.thread': 'first', | |
11 | +}) | |
12 | + | |
13 | +exports.create = (api) => { | |
14 | + return nest('app.page.threadNew', threadNew) | |
15 | + | |
16 | + function threadNew (location) { | |
17 | + const { feed } = location | |
18 | + | |
19 | + return h('Page -threadNew', [ | |
20 | + h('h1', ['New thread with ', api.about.obs.name(feed)]), | |
21 | + api.about.html.image(feed), | |
22 | + api.app.html.nav(), | |
23 | + h('div', 'compose box') // a special one which takes us to threadShow | |
24 | + ]) | |
25 | + } | |
26 | +} |
router/sync/routes.js | ||
---|---|---|
@@ -11,9 +11,10 @@ | ||
11 | 11 | 'app.page.groupNew': 'first', |
12 | 12 | 'app.page.groupShow': 'first', |
13 | 13 | 'app.page.userFind': 'first', |
14 | 14 | 'app.page.userShow': 'first', |
15 | - 'app.page.threadShow': 'first' | |
15 | + 'app.page.threadNew': 'first', | |
16 | + 'app.page.threadShow': 'first', | |
16 | 17 | }) |
17 | 18 | |
18 | 19 | exports.create = (api) => { |
19 | 20 | return nest('router.sync.routes', (sofar = []) => { |
@@ -29,16 +30,17 @@ | ||
29 | 30 | [ location => location.page === 'groupIndex', pages.groupIndex ], |
30 | 31 | [ location => location.page === 'groupNew', pages.groupNew ], |
31 | 32 | [ location => location.type === 'groupShow' && isMsg(location.key), pages.groupShow ], |
32 | 33 | |
34 | + // Thread pages | |
35 | + // QUESTION - should this be for private threads + group threads? | |
36 | + [ location => location.page === 'threadNew' && isFeed(location.feed), pages.threadNew ], | |
37 | + [ location => isMsg(location.key), pages.threadShow ], | |
38 | + | |
33 | 39 | // User pages |
34 | 40 | [ location => location.page === 'userFind', pages.userFind ], |
35 | 41 | [ location => isFeed(location.feed), pages.userShow ], |
36 | 42 | |
37 | - // Thread pages | |
38 | - // QUESTION - should this be for private threads + group threads? | |
39 | - [ location => isMsg(location.key), pages.threadShow ], | |
40 | - | |
41 | 43 | // Error page |
42 | 44 | [ location => true, pages.error ] |
43 | 45 | ] |
44 | 46 |
Built with git-ssb-web