Commit 3f20b6a02893dcb23a3239a1e9623b8234222ba7
Merge pull request #33 from ticktackim/patch-profile
Patch profilemix 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.mcss | changed |
app/index.js | changed |
app/page/userShow.js | changed |
app/page/userShow.mcss | changed |
app/page/userEdit.js | added |
app/page/userEdit.mcss | added |
main.js | changed |
package-lock.json | changed |
package.json | changed |
router/sync/routes.js | changed |
translations/en.js | changed |
app/html/thread.mcss | ||
---|---|---|
@@ -65,9 +65,9 @@ | ||
65 | 65 … | div.msg { $roundBottom } |
66 | 66 … | } |
67 | 67 … | |
68 | 68 … | div.msg { |
69 | - line-height: 1.2rem | |
69 … | + line-height: 1.2 | |
70 | 70 … | background-color: #fff |
71 | 71 … | padding: 0 .7rem |
72 | 72 … | border-radius: 4px |
73 | 73 … | } |
app/index.js | ||
---|---|---|
@@ -19,16 +19,12 @@ | ||
19 | 19 … | groupShow: require('./page/groupShow'), |
20 | 20 … | home: require('./page/home'), |
21 | 21 … | settings: require('./page/settings'), |
22 | 22 … | threadShow: require('./page/threadShow'), |
23 … | + userEdit: require('./page/userEdit'), | |
23 | 24 … | userFind: require('./page/userFind'), |
24 | 25 … | userShow: require('./page/userShow'), |
25 | 26 … | threadNew: require('./page/threadNew'), |
26 | 27 … | threadShow: require('./page/threadShow'), |
27 | 28 … | } |
28 | 29 … | } |
29 | 30 … | |
30 | - | |
31 | - | |
32 | - | |
33 | - | |
34 | - |
app/page/userShow.js | ||
---|---|---|
@@ -5,13 +5,12 @@ | ||
5 | 5 … | |
6 | 6 … | exports.gives = nest('app.page.userShow') |
7 | 7 … | |
8 | 8 … | exports.needs = nest({ |
9 | - 'translations.sync.strings': 'first', | |
9 … | + 'about.html.image': 'first', | |
10 … | + 'about.obs.name': 'first', | |
10 | 11 … | 'app.html.link': 'first', |
11 | 12 … | 'app.html.threadCard': 'first', |
12 | - 'about.html.image': 'first', | |
13 | - 'about.obs.name': 'first', | |
14 | 13 … | 'contact.async.follow': 'first', |
15 | 14 … | 'contact.async.unfollow': 'first', |
16 | 15 … | 'contact.obs.followers': 'first', |
17 | 16 … | 'feed.pull.private': 'first', |
@@ -55,16 +54,16 @@ | ||
55 | 54 … | h('Button', { disabled: 'disabled' }, strings.loading ) |
56 | 55 … | ) |
57 | 56 … | |
58 | 57 … | |
59 | - const threads = MutantArray() | |
58 … | + const threads = MutantArray() | |
60 | 59 … | pull( |
61 | 60 … | // next(api.feed.pull.private, {reverse: true, limit: 100, live: false}, ['value', 'timestamp']), |
62 | 61 … | // api.feed.pull.private({reverse: true, limit: 100, live: false}), |
63 | 62 … | api.feed.pull.private({reverse: true, live: false}), |
64 | 63 … | pull.filter(msg => { |
65 | 64 … | const recps = get(msg, 'value.content.recps') |
66 | - if (!recps) return | |
65 … | + if (!recps) return | |
67 | 66 … | |
68 | 67 … | return recps |
69 | 68 … | .map(r => typeof r === 'object' ? r.link : r) |
70 | 69 … | .includes(feed) |
@@ -77,16 +76,23 @@ | ||
77 | 76 … | const Link = api.app.html.link |
78 | 77 … | |
79 | 78 … | return h('Page -userShow', {title: name}, [ |
80 | 79 … | h('div.container', [ |
80 … | + h('header', [ | |
81 … | + h('h1', name), | |
82 … | + Link({ page: 'userEdit', feed }, h('i.fa.fa-pencil')) | |
83 … | + ]), | |
81 | 84 … | api.about.html.image(feed), |
82 | 85 … | feed !== myId |
83 | 86 … | ? h('div.friendship', [ |
84 | 87 … | h('div.state', ourRelationship), |
85 | 88 … | followButton |
86 | 89 … | ]) : '', |
90 … | + | |
91 … | + | |
87 | 92 … | // h('div', '...friends in common'), |
88 | 93 … | // h('div', '...groups this person is in'), |
94 … | + | |
89 | 95 … | feed !== myId |
90 | 96 … | ? Link({ page: 'threadNew', feed }, h('Button -primary', strings.userShow.action.directMessage)) |
91 | 97 … | : '', |
92 | 98 … | h('div.threads', map(threads, api.app.html.threadCard)) |
@@ -95,10 +101,4 @@ | ||
95 | 101 … | } |
96 | 102 … | } |
97 | 103 … | |
98 | 104 … | |
99 | - | |
100 | - | |
101 | - | |
102 | - | |
103 | - | |
104 | - |
app/page/userShow.mcss | ||
---|---|---|
@@ -1,7 +1,23 @@ | ||
1 | 1 … | Page -userShow { |
2 | 2 … | div.container { |
3 … | + header { | |
4 … | + display: flex | |
5 … | + align-items: baseline | |
3 | 6 … | |
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 … | + | |
4 | 20 … | div.friendship { |
5 | 21 … | display: flex |
6 | 22 … | align-items: center |
7 | 23 … | |
@@ -9,9 +25,9 @@ | ||
9 | 25 … | |
10 | 26 … | div.state { flex-basis: 12rem } |
11 | 27 … | div.Button {} |
12 | 28 … | } |
13 | - | |
14 | 29 … | |
30 … | + div.threads {} | |
15 | 31 … | } |
16 | 32 … | } |
17 | 33 … |
app/page/userEdit.js | ||
---|---|---|
@@ -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.mcss | ||
---|---|---|
@@ -1,0 +1,7 @@ | ||
1 … | +Page -userEdit { | |
2 … | + div.container { | |
3 … | + max-width: 40rem | |
4 … | + | |
5 … | + } | |
6 … | +} | |
7 … | + |
main.js | ||
---|---|---|
@@ -26,8 +26,9 @@ | ||
26 | 26 … | styles: require('./styles'), |
27 | 27 … | state: require('./state/obs'), |
28 | 28 … | unread: require('./unread'), |
29 | 29 … | }, |
30 … | + require('patch-profile'), | |
30 | 31 … | require('patchcore') |
31 | 32 … | ) |
32 | 33 … | |
33 | 34 … | const api = entry(sockets, nest({ |
package-lock.json | ||
---|---|---|
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.json | ||
---|---|---|
@@ -32,8 +32,9 @@ | ||
32 | 32 … | "morphdom": "^2.3.3", |
33 | 33 … | "mutant": "^3.21.2", |
34 | 34 … | "obv-debounce": "^1.0.2", |
35 | 35 … | "open-external": "^0.1.1", |
36 … | + "patch-profile": "^1.0.1", | |
36 | 37 … | "patch-settings": "^1.0.0", |
37 | 38 … | "patchcore": "^1.10.2", |
38 | 39 … | "pull-next": "^1.0.1", |
39 | 40 … | "pull-obv": "^1.3.0", |
router/sync/routes.js | ||
---|---|---|
@@ -10,8 +10,9 @@ | ||
10 | 10 … | 'app.page.groupFind': 'first', |
11 | 11 … | 'app.page.groupIndex': 'first', |
12 | 12 … | 'app.page.groupNew': 'first', |
13 | 13 … | 'app.page.groupShow': 'first', |
14 … | + 'app.page.userEdit': 'first', | |
14 | 15 … | 'app.page.userFind': 'first', |
15 | 16 … | 'app.page.userShow': 'first', |
16 | 17 … | 'app.page.threadNew': 'first', |
17 | 18 … | 'app.page.threadShow': 'first', |
@@ -21,9 +22,9 @@ | ||
21 | 22 … | exports.create = (api) => { |
22 | 23 … | return nest('router.sync.routes', (sofar = []) => { |
23 | 24 … | const pages = api.app.page |
24 | 25 … | // route format: [ routeValidator, routeFunction ] |
25 | - | |
26 … | + | |
26 | 27 … | const routes = [ |
27 | 28 … | |
28 | 29 … | // Thread pages |
29 | 30 … | [ location => location.page === 'threadNew' && isFeed(location.feed), pages.threadNew ], |
@@ -31,8 +32,9 @@ | ||
31 | 32 … | [ location => isMsg(location.key), pages.threadShow ], |
32 | 33 … | |
33 | 34 … | // User pages |
34 | 35 … | [ location => location.page === 'userFind', pages.userFind ], |
36 … | + [ location => location.page === 'userEdit' && isFeed(location.feed), pages.userEdit ], | |
35 | 37 … | [ location => isFeed(location.feed), pages.userShow ], |
36 | 38 … | |
37 | 39 … | // Group pages |
38 | 40 … | [ location => location.page === 'groupFind', pages.groupFind ], |
translations/en.js | |||
---|---|---|---|
@@ -35,8 +35,22 @@ | |||
35 | 35 … | channel: 'Channel' | |
36 | 36 … | } | |
37 | 37 … | }, | |
38 | 38 … | 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 … | + }, | ||
39 | 53 … | userFind: { | |
40 | 54 … | action: { | |
41 | 55 … | findAUser: 'Find a user', | |
42 | 56 … | } |
Built with git-ssb-web