git ssb

2+

mixmix / ticktack



Commit 08bdd1675bfb45b44e82c17c1269c2aafd4ae82b

Merge branch 'homescreen' of github.com:ticktackim/ticktack-wp1 into homescreen

Dominic Tarr committed on 8/14/2017, 7:58:29 AM
Parent: 55ff62f5eea8b7d0e3fb82d71183f46c8b686c5a
Parent: 5abfc002ffe8f5899adc25a75831481771f6163e

Files changed

app/html/nav.jschanged
app/html/nav.mcsschanged
app/html/link.jsadded
app/index.jschanged
app/page/group.jsdeleted
app/page/error.jsadded
app/page/groupFind.jsadded
app/page/groupIndex.jsadded
app/page/groupNew.jsadded
app/page/private.jsdeleted
app/page/groupShow.jsadded
app/page/settings.jsadded
app/page/threadShow.jsadded
app/page/userFind.jsadded
app/page/userShow.jsadded
package-lock.jsonchanged
package.jsonchanged
router/sync/routes.jschanged
app/html/nav.jsView
@@ -3,8 +3,9 @@
33
44 exports.gives = nest('app.html.nav')
55
66 exports.needs = nest({
7+ 'app.html.link': 'first',
78 'history.sync.push': 'first',
89 'history.sync.back': 'first'
910 })
1011
@@ -12,15 +13,19 @@
1213 return nest('app.html.nav', nav)
1314
1415 function nav (id) {
1516 const { push, back } = api.history.sync
17+
18+ const goHome = () => push({page: 'home'})
19+ // CHANGE THIS : zero history
20+ const Link = api.app.html.link
21+
1622 return h('Nav', [
1723 h('div.back', { 'ev-click': back }, '←'),
18- h('div', { 'ev-click': () => push({page: 'home'}) }, 'Home')
19- // h('div', { 'ev-click': () => push({type: 'group', key: '%sadlkjas;lkdjas'}) }, 'Group'),
20-// h('div', { 'ev-click': () => push({key: '%fXXZgQrwnj7F+Y19H0IXxNriuvPFoahvusih3UzpkfA=.sha256'}) }, 'Thread A'),
21-// h('div', { 'ev-click': () => push({key: '%3cWZHeN6k03XpvDBxrxP5bGLsNByFLTvr/rKYFV4f+c=.sha256'}) }, 'Thread B'),
22-// h('a', { href: '%YRhFXmsAwipgyiwuHSP+EBr9fGjSqrMpWXUxgWcHxkM=.sha256' }, 'href link')
24+ h('div', { 'ev-click': goHome }, 'Home'),
25+ Link({ page: 'settings' }, 'Settings'),
26+ Link({ page: 'userFind' }, 'Find a User'),
27+ h('a', { href: '%YRhFXmsAwipgyiwuHSP+EBr9fGjSqrMpWXUxgWcHxkM=.sha256' }, 'A Thread')
2328 ])
2429 }
2530 }
2631
app/html/nav.mcssView
@@ -3,9 +3,10 @@
33 align-items: center
44
55 margin: 0 0 1rem 1rem
66
7- div {
7+ a, div {
8+ color: #222
89 margin-right: 1rem
910
1011 :hover {
1112 text-decoration: underline
app/html/link.jsView
@@ -1,0 +1,17 @@
1+const nest = require('depnest')
2+const { h } = require('mutant')
3+
4+exports.gives = nest('app.html.link')
5+
6+exports.needs = nest({
7+ 'history.sync.push': 'first',
8+})
9+
10+exports.create = (api) => {
11+ return nest('app.html.link', (location, body) => {
12+ return h('Link', {
13+ 'ev-click': () => api.history.sync.push(location)
14+ }, body)
15+ })
16+}
17+
app/index.jsView
@@ -4,15 +4,24 @@
44 },
55 html: {
66 app: require('./html/app'),
77 thread: require('./html/thread'),
8+ link: require('./html/link'),
89 nav: require('./html/nav'),
9- threadCard: require('./html/thread-card')
10+ threadCard: require('./html/thread-card'),
11+ nav: require('./html/nav'),
1012 },
1113 page: {
12- group: require('./page/group'),
1314 channel: require('./page/channel'),
15+ error: require('./page/error'),
16+ groupFind: require('./page/groupFind'),
17+ groupIndex: require('./page/groupIndex'),
18+ groupNew: require('./page/groupNew'),
19+ groupShow: require('./page/groupShow'),
1420 home: require('./page/home'),
15- private: require('./page/private')
21+ settings: require('./page/settings'),
22+ threadShow: require('./page/threadShow'),
23+ userFind: require('./page/userFind'),
24+ userShow: require('./page/userShow'),
1625 }
1726 }
1827
app/page/group.jsView
@@ -1,23 +1,0 @@
1-const nest = require('depnest')
2-const { h } = require('mutant')
3-
4-exports.gives = nest('app.page.group')
5-
6-exports.needs = nest({
7- 'app.html.nav': 'first'
8-})
9-
10-exports.create = (api) => {
11- return nest('app.page.group', group)
12-
13- function group (location) {
14- // location here can be the root message of a group : { type: 'group', key }
15- // TODO show specific group index described by key
16-
17- return h('Page -group', [
18- h('h1', 'Group'),
19- api.app.html.nav(),
20- h('p', `key: ${location.key}`)
21- ])
22- }
23-}
app/page/error.jsView
@@ -1,0 +1,22 @@
1+const nest = require('depnest')
2+const { h } = require('mutant')
3+
4+exports.gives = nest('app.page.error')
5+
6+exports.needs = nest({
7+ 'app.html.nav': 'first'
8+})
9+
10+exports.create = (api) => {
11+ return nest('app.page.error', error)
12+
13+ function error (location) {
14+
15+ return h('Page -error', [
16+ h('h1', 'Error'),
17+ api.app.html.nav(),
18+ "The route wasn't found of there was an error",
19+ location.error
20+ ])
21+ }
22+}
app/page/groupFind.jsView
@@ -1,0 +1,21 @@
1+const nest = require('depnest')
2+const { h } = require('mutant')
3+
4+exports.gives = nest('app.page.groupFind')
5+
6+exports.needs = nest({
7+ 'app.html.nav': 'first'
8+})
9+
10+exports.create = (api) => {
11+ return nest('app.page.groupFind', groupFind)
12+
13+ function groupFind (location) {
14+
15+ return h('Page -groupFind', [
16+ h('h1', 'Group Find'),
17+ api.app.html.nav(),
18+ h('p', `key: ${location.key}`)
19+ ])
20+ }
21+}
app/page/groupIndex.jsView
@@ -1,0 +1,19 @@
1+const nest = require('depnest')
2+const { h } = require('mutant')
3+
4+exports.gives = nest('app.page.groupIndex')
5+
6+exports.needs = nest({
7+ 'app.html.nav': 'first'
8+})
9+
10+exports.create = (api) => {
11+ return nest('app.page.groupIndex', groupIndex)
12+
13+ function groupIndex (location) {
14+ return h('Page -groupIndex', [
15+ h('h1', 'Group Index'),
16+ api.app.html.nav()
17+ ])
18+ }
19+}
app/page/groupNew.jsView
@@ -1,0 +1,19 @@
1+const nest = require('depnest')
2+const { h } = require('mutant')
3+
4+exports.gives = nest('app.page.groupNew')
5+
6+exports.needs = nest({
7+ 'app.html.nav': 'first'
8+})
9+
10+exports.create = (api) => {
11+ return nest('app.page.groupNew', groupNew)
12+
13+ function groupNew (location) {
14+ return h('Page -groupNew', [
15+ h('h1', 'Group New'),
16+ api.app.html.nav()
17+ ])
18+ }
19+}
app/page/private.jsView
@@ -1,25 +1,0 @@
1-const nest = require('depnest')
2-const { h } = require('mutant')
3-
4-exports.gives = nest('app.page.private')
5-
6-exports.needs = nest({
7- 'app.html.nav': 'first',
8- 'app.html.thread': 'first'
9-})
10-
11-exports.create = (api) => {
12- return nest('app.page.private', privatePage)
13-
14- function privatePage (location) {
15- // location here can expected to be an ssb-message
16-
17- const thread = api.app.html.thread(location.key)
18-
19- return h('Page -private', [
20- h('h1', 'Private message'),
21- api.app.html.nav(),
22- h('div.container', thread)
23- ])
24- }
25-}
app/page/groupShow.jsView
@@ -1,0 +1,23 @@
1+const nest = require('depnest')
2+const { h } = require('mutant')
3+
4+exports.gives = nest('app.page.groupShow')
5+
6+exports.needs = nest({
7+ 'app.html.nav': 'first'
8+})
9+
10+exports.create = (api) => {
11+ return nest('app.page.groupShow', groupShow)
12+
13+ function groupShow (location) {
14+ // location here can be the root message of a group : { type: 'group', key }
15+ // TODO show specific group index described by key
16+
17+ return h('Page -groupShow', [
18+ h('h1', 'Group Show'),
19+ api.app.html.nav(),
20+ h('p', `key: ${location.key}`)
21+ ])
22+ }
23+}
app/page/settings.jsView
@@ -1,0 +1,20 @@
1+const nest = require('depnest')
2+const { h } = require('mutant')
3+
4+exports.gives = nest('app.page.settings')
5+
6+exports.needs = nest({
7+ 'app.html.nav': 'first'
8+})
9+
10+exports.create = (api) => {
11+ return nest('app.page.settings', settings)
12+
13+ function settings (location) {
14+
15+ return h('Page -settings', [
16+ h('h1', 'Settings'),
17+ api.app.html.nav(),
18+ ])
19+ }
20+}
app/page/threadShow.jsView
@@ -1,0 +1,25 @@
1+const nest = require('depnest')
2+const { h } = require('mutant')
3+
4+exports.gives = nest('app.page.threadShow')
5+
6+exports.needs = nest({
7+ 'app.html.nav': 'first',
8+ 'app.html.thread': 'first'
9+})
10+
11+exports.create = (api) => {
12+ return nest('app.page.threadShow', threadShow)
13+
14+ function threadShow (location) {
15+ // location here can expected to be an ssb-message
16+
17+ const thread = api.app.html.thread(location.key)
18+
19+ return h('Page -threadShow', [
20+ h('h1', 'Private message'),
21+ api.app.html.nav(),
22+ h('div.container', thread)
23+ ])
24+ }
25+}
app/page/userFind.jsView
@@ -1,0 +1,20 @@
1+const nest = require('depnest')
2+const { h } = require('mutant')
3+
4+exports.gives = nest('app.page.userFind')
5+
6+exports.needs = nest({
7+ 'app.html.nav': 'first'
8+})
9+
10+exports.create = (api) => {
11+ return nest('app.page.userFind', userFind)
12+
13+ function userFind (location) {
14+
15+ return h('Page -userFind', [
16+ h('h1', 'Find a User'),
17+ api.app.html.nav()
18+ ])
19+ }
20+}
app/page/userShow.jsView
@@ -1,0 +1,21 @@
1+const nest = require('depnest')
2+const { h } = require('mutant')
3+
4+exports.gives = nest('app.page.userShow')
5+
6+exports.needs = nest({
7+ 'app.html.nav': 'first'
8+})
9+
10+exports.create = (api) => {
11+ return nest('app.page.userShow', userShow)
12+
13+ function userShow (location) {
14+
15+ return h('Page -userShow', [
16+ h('h1', 'User show'),
17+ api.app.html.nav(),
18+ h('p', `key: ${location.key}`)
19+ ])
20+ }
21+}
package-lock.jsonView
@@ -737,14 +737,13 @@
737737 "resolved": "https://registry.npmjs.org/human-time/-/human-time-0.0.1.tgz",
738738 "integrity": "sha1-KA0DNjeRmTBrLhUY49X2OBy4UH0="
739739 },
740740 "hypermore": {
741- "version": "1.1.1",
742- "resolved": "https://registry.npmjs.org/hypermore/-/hypermore-1.1.1.tgz",
743- "integrity": "sha512-mGoJJMvv8ONFIJHt6GYm2bnSVq6qPdBsdk+WRHoU4jpYtREIicXpnthbqJaR3NzFKLWAoaymxF4IMgTIYs3Y6A==",
741+ "version": "2.0.0",
742+ "resolved": "https://registry.npmjs.org/hypermore/-/hypermore-2.0.0.tgz",
743+ "integrity": "sha512-aNkOCuYOeLbCFmNIjlZY5edhpcuS96Q46YnLwAg2WfPWcj6qUycb7JQO+PPOI4eqJuBUCQADqAPYNBzm/9O6Kg==",
744744 "requires": {
745- "mutant": "3.21.2",
746- "pull-obv": "1.2.0"
745+ "mutant": "3.21.2"
747746 }
748747 },
749748 "increment-buffer": {
750749 "version": "1.0.1",
@@ -1002,8 +1001,13 @@
10021001 "version": "1.0.11",
10031002 "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz",
10041003 "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0="
10051004 },
1005+ "obv-debounce": {
1006+ "version": "1.0.2",
1007+ "resolved": "https://registry.npmjs.org/obv-debounce/-/obv-debounce-1.0.2.tgz",
1008+ "integrity": "sha1-AAJjSTfQfYlsGNZr7crvh2h2Sp8="
1009+ },
10061010 "once": {
10071011 "version": "1.4.0",
10081012 "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
10091013 "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
@@ -1191,11 +1195,11 @@
11911195 "resolved": "https://registry.npmjs.org/pull-next/-/pull-next-1.0.1.tgz",
11921196 "integrity": "sha1-A/TX0Zhy/BEUFh6I227PTGXmHlY="
11931197 },
11941198 "pull-obv": {
1195- "version": "1.2.0",
1196- "resolved": "https://registry.npmjs.org/pull-obv/-/pull-obv-1.2.0.tgz",
1197- "integrity": "sha512-GsOYI5oq6UM0gUUDfOaWRLmhAKLy/nPF+xjJBiqLYcGtC3aYLVnjGMv42Nl/a4Gt7eo0b16EH5UlC5c4CYFWRw=="
1199+ "version": "1.3.1",
1200+ "resolved": "https://registry.npmjs.org/pull-obv/-/pull-obv-1.3.1.tgz",
1201+ "integrity": "sha1-UjNnAxWbMwi7vQvAe/zhgwd4L3A="
11981202 },
11991203 "pull-pair": {
12001204 "version": "1.1.0",
12011205 "resolved": "https://registry.npmjs.org/pull-pair/-/pull-pair-1.1.0.tgz",
package.jsonView
@@ -24,8 +24,9 @@
2424 "lodash": "^4.17.4",
2525 "micro-css": "^2.0.1",
2626 "morphdom": "^2.3.3",
2727 "mutant": "^3.21.2",
28+ "obv-debounce": "^1.0.2",
2829 "open-external": "^0.1.1",
2930 "patch-history": "^1.0.0",
3031 "patchcore": "^1.9.1",
3132 "pull-next": "^1.0.1",
router/sync/routes.jsView
@@ -1,13 +1,20 @@
11 const nest = require('depnest')
2-const ref = require('ssb-ref')
2+const { isMsg, isFeed } = require('ssb-ref')
33 exports.gives = nest('router.sync.routes')
44
55 exports.needs = nest({
6+ 'app.page.error': 'first',
67 'app.page.home': 'first',
7- 'app.page.group': 'first',
88 'app.page.channel': 'first',
9- 'app.page.private': 'first'
9+ 'app.page.settings': 'first',
10+ 'app.page.groupFind': 'first',
11+ 'app.page.groupIndex': 'first',
12+ 'app.page.groupNew': 'first',
13+ 'app.page.groupShow': 'first',
14+ 'app.page.userFind': 'first',
15+ 'app.page.userShow': 'first',
16+ 'app.page.threadShow': 'first'
1017 })
1118
1219 exports.create = (api) => {
1320 return nest('router.sync.routes', (sofar = []) => {
@@ -15,11 +22,27 @@
1522 // route format: [ routeValidator, routeFunction ]
1623
1724 const routes = [
1825 [ location => location.page === 'home', pages.home ],
19- [ location => location.type === 'group', pages.group ],
2026 [ location => location.channel , pages.channel ],
21- [ location => ref.isMsg(location.key), pages.private ]
27+ [ location => location.page === 'settings', pages.settings ],
28+
29+ // Group pages
30+ [ location => location.page === 'groupFind', pages.groupFind ],
31+ [ location => location.page === 'groupIndex', pages.groupIndex ],
32+ [ location => location.page === 'groupNew', pages.groupNew ],
33+ [ location => location.type === 'groupShow' && isMsg(location.key), pages.groupShow ],
34+
35+ // User pages
36+ [ location => location.page === 'userFind', pages.userFind ],
37+ [ location => isFeed(location.feed), pages.userShow ],
38+
39+ // Thread pages
40+ // QUESTION - should this be for private threads + group threads?
41+ [ location => isMsg(location.key), pages.threadShow ],
42+
43+ // Error page
44+ [ location => true, pages.error ]
2245 ]
2346
2447 return [...routes, ...sofar]
2548 })

Built with git-ssb-web