git ssb

2+

mixmix / ticktack



Commit 3f20b6a02893dcb23a3239a1e9623b8234222ba7

Merge pull request #33 from ticktackim/patch-profile

Patch profile
mix irving authored on 8/24/2017, 11:28:24 PM
GitHub committed on 8/24/2017, 11:28:24 PM
Parent: 94d5b75f602ffb83fa7f38bb651ad50015fb10cc
Parent: 00db2720562a9536989a440889c17cb7fdad9c30

Files changed

app/html/thread.mcsschanged
app/index.jschanged
app/page/userShow.jschanged
app/page/userShow.mcsschanged
app/page/userEdit.jsadded
app/page/userEdit.mcssadded
main.jschanged
package-lock.jsonchanged
package.jsonchanged
router/sync/routes.jschanged
translations/en.jschanged
app/html/thread.mcssView
@@ -65,9 +65,9 @@
6565 div.msg { $roundBottom }
6666 }
6767
6868 div.msg {
69- line-height: 1.2rem
69 + line-height: 1.2
7070 background-color: #fff
7171 padding: 0 .7rem
7272 border-radius: 4px
7373 }
app/index.jsView
@@ -19,16 +19,12 @@
1919 groupShow: require('./page/groupShow'),
2020 home: require('./page/home'),
2121 settings: require('./page/settings'),
2222 threadShow: require('./page/threadShow'),
23 + userEdit: require('./page/userEdit'),
2324 userFind: require('./page/userFind'),
2425 userShow: require('./page/userShow'),
2526 threadNew: require('./page/threadNew'),
2627 threadShow: require('./page/threadShow'),
2728 }
2829 }
2930
30-
31-
32-
33-
34-
app/page/userShow.jsView
@@ -5,13 +5,12 @@
55
66 exports.gives = nest('app.page.userShow')
77
88 exports.needs = nest({
9- 'translations.sync.strings': 'first',
9 + 'about.html.image': 'first',
10 + 'about.obs.name': 'first',
1011 'app.html.link': 'first',
1112 'app.html.threadCard': 'first',
12- 'about.html.image': 'first',
13- 'about.obs.name': 'first',
1413 'contact.async.follow': 'first',
1514 'contact.async.unfollow': 'first',
1615 'contact.obs.followers': 'first',
1716 'feed.pull.private': 'first',
@@ -55,16 +54,16 @@
5554 h('Button', { disabled: 'disabled' }, strings.loading )
5655 )
5756
5857
59- const threads = MutantArray()
58 + const threads = MutantArray()
6059 pull(
6160 // next(api.feed.pull.private, {reverse: true, limit: 100, live: false}, ['value', 'timestamp']),
6261 // api.feed.pull.private({reverse: true, limit: 100, live: false}),
6362 api.feed.pull.private({reverse: true, live: false}),
6463 pull.filter(msg => {
6564 const recps = get(msg, 'value.content.recps')
66- if (!recps) return
65 + if (!recps) return
6766
6867 return recps
6968 .map(r => typeof r === 'object' ? r.link : r)
7069 .includes(feed)
@@ -77,16 +76,23 @@
7776 const Link = api.app.html.link
7877
7978 return h('Page -userShow', {title: name}, [
8079 h('div.container', [
80 + h('header', [
81 + h('h1', name),
82 + Link({ page: 'userEdit', feed }, h('i.fa.fa-pencil'))
83 + ]),
8184 api.about.html.image(feed),
8285 feed !== myId
8386 ? h('div.friendship', [
8487 h('div.state', ourRelationship),
8588 followButton
8689 ]) : '',
90 +
91 +
8792 // h('div', '...friends in common'),
8893 // h('div', '...groups this person is in'),
94 +
8995 feed !== myId
9096 ? Link({ page: 'threadNew', feed }, h('Button -primary', strings.userShow.action.directMessage))
9197 : '',
9298 h('div.threads', map(threads, api.app.html.threadCard))
@@ -95,10 +101,4 @@
95101 }
96102 }
97103
98104
99-
100-
101-
102-
103-
104-
app/page/userShow.mcssView
@@ -1,7 +1,23 @@
11 Page -userShow {
22 div.container {
3 + header {
4 + display: flex
5 + align-items: baseline
36
7 + h1 {
8 + margin-right: 1rem
9 + }
10 + div.Link {
11 + color: #666
12 + :hover {
13 + $colorPrimaryFG
14 + }
15 + }
16 + }
17 +
18 + img.Avatar {}
19 +
420 div.friendship {
521 display: flex
622 align-items: center
723
@@ -9,9 +25,9 @@
925
1026 div.state { flex-basis: 12rem }
1127 div.Button {}
1228 }
13-
1429
30 + div.threads {}
1531 }
1632 }
1733
app/page/userEdit.jsView
@@ -1,0 +1,46 @@
1 +const nest = require('depnest')
2 +const { h } = require('mutant')
3 +
4 +exports.gives = nest('app.page.userEdit')
5 +
6 +exports.needs = nest({
7 + 'about.page.edit': 'first',
8 + 'history.sync.push': 'first',
9 + 'translations.sync.strings': 'first',
10 +})
11 +
12 +exports.create = (api) => {
13 + return nest('app.page.userEdit', userEdit)
14 +
15 + function userEdit (location) {
16 + // location is an object { feed, page: 'userEdit' }
17 + const { feed } = location
18 +
19 + const strings = api.translations.sync.strings()
20 +
21 + const options = Object.assign({}, location, {
22 + feed,
23 + labels: {
24 + name: strings.userEdit.section.name,
25 + avatar: strings.userEdit.section.avatar,
26 + instructionCrop: strings.userEdit.instruction.crop,
27 + okay: strings.userEdit.action.okay,
28 + cancel: strings.userEdit.action.cancel,
29 + save: strings.userEdit.action.save,
30 + }
31 + })
32 +
33 + const callback = (err, didEdit) => {
34 + if (err) throw new Error ('Error editing profile', err)
35 +
36 + api.history.sync.push({ page: 'userShow', feed })
37 + }
38 +
39 + return h('Page -userEdit', {}, [
40 + h('div.container', [
41 + api.about.page.edit(options, callback)
42 + ])
43 + ])
44 + }
45 +}
46 +
app/page/userEdit.mcssView
@@ -1,0 +1,7 @@
1 +Page -userEdit {
2 + div.container {
3 + max-width: 40rem
4 +
5 + }
6 +}
7 +
main.jsView
@@ -26,8 +26,9 @@
2626 styles: require('./styles'),
2727 state: require('./state/obs'),
2828 unread: require('./unread'),
2929 },
30 + require('patch-profile'),
3031 require('patchcore')
3132 )
3233
3334 const api = entry(sockets, nest({
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 197011 bytes
New file size: 198685 bytes
package.jsonView
@@ -32,8 +32,9 @@
3232 "morphdom": "^2.3.3",
3333 "mutant": "^3.21.2",
3434 "obv-debounce": "^1.0.2",
3535 "open-external": "^0.1.1",
36 + "patch-profile": "^1.0.1",
3637 "patch-settings": "^1.0.0",
3738 "patchcore": "^1.10.2",
3839 "pull-next": "^1.0.1",
3940 "pull-obv": "^1.3.0",
router/sync/routes.jsView
@@ -10,8 +10,9 @@
1010 'app.page.groupFind': 'first',
1111 'app.page.groupIndex': 'first',
1212 'app.page.groupNew': 'first',
1313 'app.page.groupShow': 'first',
14 + 'app.page.userEdit': 'first',
1415 'app.page.userFind': 'first',
1516 'app.page.userShow': 'first',
1617 'app.page.threadNew': 'first',
1718 'app.page.threadShow': 'first',
@@ -21,9 +22,9 @@
2122 exports.create = (api) => {
2223 return nest('router.sync.routes', (sofar = []) => {
2324 const pages = api.app.page
2425 // route format: [ routeValidator, routeFunction ]
25-
26 +
2627 const routes = [
2728
2829 // Thread pages
2930 [ location => location.page === 'threadNew' && isFeed(location.feed), pages.threadNew ],
@@ -31,8 +32,9 @@
3132 [ location => isMsg(location.key), pages.threadShow ],
3233
3334 // User pages
3435 [ location => location.page === 'userFind', pages.userFind ],
36 + [ location => location.page === 'userEdit' && isFeed(location.feed), pages.userEdit ],
3537 [ location => isFeed(location.feed), pages.userShow ],
3638
3739 // Group pages
3840 [ location => location.page === 'groupFind', pages.groupFind ],
translations/en.jsView
@@ -35,8 +35,22 @@
3535 channel: 'Channel'
3636 }
3737 },
3838 threadShow: 'Direct Messages',
39 + userEdit: {
40 + section: {
41 + name: 'Name',
42 + avatar: 'Avatar'
43 + },
44 + instruction: {
45 + crop: 'Click and drag to crop your avatar'
46 + },
47 + action: {
48 + okay: 'Okay',
49 + cancel: 'Cancel',
50 + save: 'Save'
51 + }
52 + },
3953 userFind: {
4054 action: {
4155 findAUser: 'Find a user',
4256 }

Built with git-ssb-web