git ssb

2+

mixmix / ticktack



Commit f3409d0dc8b00fb3846783f9e510314430c1ecd1

Merge pull request #11 from ticktackim/profile

WIP profile page
Dominic 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.mcssadded
app/index.jschanged
app/page/userShow.jschanged
app/page/threadNew.jsadded
router/sync/routes.jschanged
app/html/link.mcssView
@@ -1,0 +1,6 @@
1+Link {
2+ color: blue
3+ :hover {
4+ text-decoration: underline
5+ }
6+}
app/index.jsView
@@ -17,7 +17,8 @@
1717 home: require('./page/home'),
1818 settings: require('./page/settings'),
1919 userFind: require('./page/userFind'),
2020 userShow: require('./page/userShow'),
21+ threadNew: require('./page/threadNew'),
2122 threadShow: require('./page/threadShow'),
2223 }
2324 }
app/page/userShow.jsView
@@ -3,19 +3,34 @@
33
44 exports.gives = nest('app.page.userShow')
55
66 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',
812 })
913
1014 exports.create = (api) => {
1115 return nest('app.page.userShow', userShow)
1216
1317 function userShow (location) {
1418
19+ const { feed } = location
20+ const Link = api.app.html.link
21+ const myId = api.keys.sync.id()
22+
1523 return h('Page -userShow', [
16- h('h1', 'User show'),
24+ h('h1', api.about.obs.name(feed)),
1725 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'),
1934 ])
2035 }
2136 }
app/page/threadNew.jsView
@@ -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.jsView
@@ -11,9 +11,10 @@
1111 'app.page.groupNew': 'first',
1212 'app.page.groupShow': 'first',
1313 'app.page.userFind': 'first',
1414 'app.page.userShow': 'first',
15- 'app.page.threadShow': 'first'
15+ 'app.page.threadNew': 'first',
16+ 'app.page.threadShow': 'first',
1617 })
1718
1819 exports.create = (api) => {
1920 return nest('router.sync.routes', (sofar = []) => {
@@ -29,16 +30,17 @@
2930 [ location => location.page === 'groupIndex', pages.groupIndex ],
3031 [ location => location.page === 'groupNew', pages.groupNew ],
3132 [ location => location.type === 'groupShow' && isMsg(location.key), pages.groupShow ],
3233
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+
3339 // User pages
3440 [ location => location.page === 'userFind', pages.userFind ],
3541 [ location => isFeed(location.feed), pages.userShow ],
3642
37- // Thread pages
38- // QUESTION - should this be for private threads + group threads?
39- [ location => isMsg(location.key), pages.threadShow ],
40-
4143 // Error page
4244 [ location => true, pages.error ]
4345 ]
4446

Built with git-ssb-web