Commit 2f3728d62f4995c91fc3de4f0ca6b5a08ceccfb7
Merge branch 'master' into get
mix irving committed on 8/17/2017, 3:57:01 AMParent: 8f710d26c85cbaa5cb40a9ab64fe40cc85df0934
Parent: 48bebcda44d351b3e77a42a761d37c9ff72ec9f0
Files changed
app/index.js | changed |
app/page/channel.js | changed |
app/page/userShow.js | changed |
app/page/image.js | added |
app/page/image.mcss | added |
main.js | changed |
package-lock.json | changed |
package.json | changed |
router/sync/routes.js | changed |
styles/mixins.js | changed |
styles/suggest-box.mcss | added |
app/index.js | ||
---|---|---|
@@ -10,8 +10,9 @@ | ||
10 | 10 | }, |
11 | 11 | page: { |
12 | 12 | channel: require('./page/channel'), |
13 | 13 | error: require('./page/error'), |
14 | + image: require('./page/image'), | |
14 | 15 | groupFind: require('./page/groupFind'), |
15 | 16 | groupIndex: require('./page/groupIndex'), |
16 | 17 | groupNew: require('./page/groupNew'), |
17 | 18 | groupShow: require('./page/groupShow'), |
@@ -28,4 +29,5 @@ | ||
28 | 29 | |
29 | 30 | |
30 | 31 | |
31 | 32 | |
33 | + |
app/page/channel.js | ||
---|---|---|
@@ -1,8 +1,9 @@ | ||
1 | 1 | const nest = require('depnest') |
2 | 2 | const { h, computed } = require('mutant') |
3 | 3 | const More = require('hypermore') |
4 | 4 | const morphdom = require('morphdom') |
5 | +const get = require('lodash/get') | |
5 | 6 | |
6 | 7 | exports.gives = nest('app.page.channel') |
7 | 8 | |
8 | 9 | exports.needs = nest({ |
@@ -22,14 +23,14 @@ | ||
22 | 23 | } |
23 | 24 | |
24 | 25 | exports.create = (api) => { |
25 | 26 | return nest('app.page.channel', function (location) { |
26 | - // location here can expected to be: { page: 'home' } | |
27 | + const { channel } = location | |
27 | 28 | var strings = api.translations.sync.strings() |
28 | 29 | |
29 | 30 | var container = h('div.container', []) |
30 | 31 | |
31 | - var channelObs = api.state.obs.channel(location.channel) | |
32 | + var channelObs = api.state.obs.channel(channel) | |
32 | 33 | |
33 | 34 | //disable "Show More" button when we are at the last thread. |
34 | 35 | var disableShowMore = computed([channelObs], threads => !!threads.ended) |
35 | 36 | |
@@ -41,22 +42,13 @@ | ||
41 | 42 | // but they are here to be compatible with the old MCSS. |
42 | 43 | h('div.container', [ |
43 | 44 | //private section |
44 | 45 | h('section.updates -directMessage', [ |
45 | - h('div.threads', | |
46 | - Object.keys(threads.roots) | |
47 | - .map(function (id) { | |
48 | - return threads.roots[id] | |
49 | - }) | |
50 | - .filter(function (thread) { | |
51 | - return thread.value && thread.value.content.channel == location.channel | |
52 | - }) | |
53 | - .sort(function (a, b) { | |
54 | - return latestUpdate(b) - latestUpdate(a) | |
55 | - }) | |
56 | - .map(function (thread) { | |
57 | - return api.app.html.threadCard(thread) | |
58 | - }) | |
46 | + h('div.threads', Object.keys(threads.roots) | |
47 | + .map(id => threads.roots[id]) | |
48 | + .filter(thread => get(thread, 'value.content.channel') == channel) | |
49 | + .sort((a, b) => latestUpdate(b) - latestUpdate(a)) | |
50 | + .map(thread => api.app.html.threadCard(thread)) | |
59 | 51 | ) |
60 | 52 | ]) |
61 | 53 | ]) |
62 | 54 | ) |
app/page/userShow.js | ||
---|---|---|
@@ -29,9 +29,9 @@ | ||
29 | 29 | function userShow (location) { |
30 | 30 | |
31 | 31 | const { feed } = location |
32 | 32 | const myId = api.keys.sync.id() |
33 | - var name = api.about.obs.name(feed) | |
33 | + const name = api.about.obs.name(feed) | |
34 | 34 | |
35 | 35 | const strings = api.translations.sync.strings() |
36 | 36 | |
37 | 37 | const { followers } = api.contact.obs |
app/page/image.js | ||
---|---|---|
@@ -1,0 +1,33 @@ | ||
1 | +const nest = require('depnest') | |
2 | +const { h } = require('mutant') | |
3 | + | |
4 | +exports.gives = nest('app.page.image') | |
5 | + | |
6 | +exports.needs = nest({ | |
7 | + 'translations.sync.strings': 'first', | |
8 | + 'about.html.image': 'first', | |
9 | + 'about.obs.name': 'first', | |
10 | + 'app.html.thread': 'first', | |
11 | + 'blob.sync.url': 'first' | |
12 | +}) | |
13 | + | |
14 | +exports.create = (api) => { | |
15 | + var strings = api.translations.sync.strings() | |
16 | + | |
17 | + return nest('app.page.image', function (location) { | |
18 | + return h('Page -image', [ | |
19 | + h('div.container', [ | |
20 | + h('img', {src: api.blob.sync.url(location.blob || location)}) | |
21 | + ]) | |
22 | + ]) | |
23 | + }) | |
24 | +} | |
25 | + | |
26 | + | |
27 | + | |
28 | + | |
29 | + | |
30 | + | |
31 | + | |
32 | + | |
33 | + |
app/page/image.mcss | ||
---|---|---|
@@ -1,0 +1,9 @@ | ||
1 | +Page -image { | |
2 | + div.container { | |
3 | + display: flex | |
4 | + | |
5 | + img { | |
6 | + margin: 0 auto | |
7 | + } | |
8 | + } | |
9 | +} |
main.js | ||
---|---|---|
@@ -25,13 +25,24 @@ | ||
25 | 25 | }, |
26 | 26 | require('patchcore') |
27 | 27 | ) |
28 | 28 | |
29 | -const api = entry(sockets, nest('app.html.app', 'first')) | |
29 | +const api = entry(sockets, nest({ | |
30 | + 'app.html.app': 'first', | |
31 | + 'invite.async.autofollow': 'first' | |
32 | +})) | |
30 | 33 | |
31 | 34 | document.body.appendChild(api.app.html.app()) |
32 | 35 | |
36 | +api.invite.async.autofollow( | |
37 | + 'wx.larpa.net:8008:@DTNmX+4SjsgZ7xyDh5xxmNtFqa6pWi5Qtw7cE8aR9TQ=.ed25519~YIRnryeLBhtBa2il9fCWDlAIFWR37Uh63Vep0L6tk6c=', | |
38 | + function (err, follows) { | |
39 | + console.log('autofollowed', err, follows); | |
40 | +}) | |
33 | 41 | |
34 | 42 | |
35 | 43 | |
36 | 44 | |
37 | 45 | |
46 | + | |
47 | + | |
48 | + |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 192040 bytes New file size: 192042 bytes |
package.json | ||
---|---|---|
@@ -32,9 +32,9 @@ | ||
32 | 32 | "mutant": "^3.21.2", |
33 | 33 | "obv-debounce": "^1.0.2", |
34 | 34 | "open-external": "^0.1.1", |
35 | 35 | "patch-history": "^1.0.0", |
36 | - "patchcore": "^1.9.1", | |
36 | + "patchcore": "^1.10.0", | |
37 | 37 | "pull-next": "^1.0.1", |
38 | 38 | "pull-obv": "^1.3.0", |
39 | 39 | "pull-stream": "^3.6.0", |
40 | 40 | "read-directory": "^2.1.0", |
router/sync/routes.js | ||
---|---|---|
@@ -1,6 +1,6 @@ | ||
1 | 1 | const nest = require('depnest') |
2 | -const { isMsg, isFeed } = require('ssb-ref') | |
2 | +const { isMsg, isFeed, isBlob } = require('ssb-ref') | |
3 | 3 | exports.gives = nest('router.sync.routes') |
4 | 4 | |
5 | 5 | exports.needs = nest({ |
6 | 6 | 'app.page.error': 'first', |
@@ -14,16 +14,18 @@ | ||
14 | 14 | 'app.page.userFind': 'first', |
15 | 15 | 'app.page.userShow': 'first', |
16 | 16 | 'app.page.threadNew': 'first', |
17 | 17 | 'app.page.threadShow': 'first', |
18 | + 'app.page.image': 'first', | |
18 | 19 | }) |
19 | 20 | |
20 | 21 | exports.create = (api) => { |
21 | 22 | return nest('router.sync.routes', (sofar = []) => { |
22 | 23 | const pages = api.app.page |
23 | 24 | // route format: [ routeValidator, routeFunction ] |
24 | 25 | |
25 | 26 | const routes = [ |
27 | + [ location => isBlob(location.blob), pages.image ], | |
26 | 28 | [ location => location.page === 'home', pages.home ], |
27 | 29 | [ location => location.channel , pages.channel ], |
28 | 30 | [ location => location.page === 'settings', pages.settings ], |
29 | 31 | |
@@ -51,12 +53,4 @@ | ||
51 | 53 | } |
52 | 54 | |
53 | 55 | |
54 | 56 | |
55 | - | |
56 | - | |
57 | - | |
58 | - | |
59 | - | |
60 | - | |
61 | - | |
62 | - |
styles/mixins.js | ||
---|---|---|
@@ -64,23 +64,23 @@ | ||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | 67 | $roundLeft { |
68 | - border-top-left-radius: .9rem | |
69 | - border-bottom-left-radius: .9rem | |
68 | + border-top-left-radius: 1.2rem | |
69 | + border-bottom-left-radius: 1.2rem | |
70 | 70 | } |
71 | 71 | |
72 | 72 | $roundRight { |
73 | - border-top-right-radius: .9rem | |
74 | - border-bottom-right-radius: .9rem | |
73 | + border-top-right-radius: 1.2rem | |
74 | + border-bottom-right-radius: 1.2rem | |
75 | 75 | } |
76 | 76 | |
77 | 77 | $roundTop { |
78 | - border-top-left-radius: .9rem | |
79 | - border-top-right-radius: .9rem | |
78 | + border-top-left-radius: 1.2rem | |
79 | + border-top-right-radius: 1.2rem | |
80 | 80 | } |
81 | 81 | |
82 | 82 | $roundBottom { |
83 | - border-bottom-left-radius: .9rem | |
84 | - border-bottom-right-radius: .9rem | |
83 | + border-bottom-left-radius: 1.2rem | |
84 | + border-bottom-right-radius: 1.2rem | |
85 | 85 | } |
86 | 86 | ` |
styles/suggest-box.mcss | ||
---|---|---|
@@ -1,0 +1,54 @@ | ||
1 | +body { | |
2 | + div.suggest-box { | |
3 | + width: max-content | |
4 | + background-color: #fff | |
5 | + border: 1px gainsboro solid | |
6 | + | |
7 | + padding: .2rem .5rem | |
8 | + margin-top: .35rem | |
9 | + | |
10 | + ul { | |
11 | + list-style-type: none | |
12 | + padding: 0 | |
13 | + | |
14 | + li { | |
15 | + display: flex | |
16 | + align-items: center | |
17 | + | |
18 | + padding-right: .2rem | |
19 | + margin-bottom: .2rem | |
20 | + | |
21 | + img { | |
22 | + height: 36px | |
23 | + width: 36px | |
24 | + border-radius: 36px | |
25 | + | |
26 | + padding: .2rem | |
27 | + /* TODO make smaller emoji thumbnails */ | |
28 | + } | |
29 | + strong { | |
30 | + flex-grow: 1 | |
31 | + margin-left: .5rem | |
32 | + font-weight: 300 | |
33 | + } | |
34 | + small { | |
35 | + font-family: monospace | |
36 | + margin-left: .5rem | |
37 | + padding-right: .2rem | |
38 | + font-size: 1rem | |
39 | + } | |
40 | + } | |
41 | + | |
42 | + li.selected { | |
43 | + color: #fff | |
44 | + background: #0caaf9 | |
45 | + | |
46 | + img {} | |
47 | + strong {} | |
48 | + small {} | |
49 | + } | |
50 | + } | |
51 | + } | |
52 | +} | |
53 | + | |
54 | + |
Built with git-ssb-web