Commit 1c95e6d66767b4da13c66d99d302553400ea4698
Merge remote-tracking branch 'origin/onboarding'
Dominic Tarr committed on 12/8/2017, 6:35:39 AMParent: 162122b46e57bbd1cb6ff6774e6b40502586e89b
Parent: bf0484208f1c2b6a1538391538398b5d7c38ea7a
Files changed
app/html/app.js | changed |
app/html/header.js | changed |
app/index.js | changed |
app/page/splash.js | added |
app/page/splash.mcss | added |
assets/logo_and_name.png | added |
assets/splash.svg | added |
router/sync/routes.js | changed |
translations/en.js | changed |
app/html/app.js | ||
---|---|---|
@@ -29,28 +29,38 @@ | ||
29 | 29 | page |
30 | 30 | ]) |
31 | 31 | } |
32 | 32 | |
33 | - const isOnboarded = api.settings.sync.get('onboarded') | |
34 | - if (isOnboarded) | |
35 | - api.history.sync.push({page: 'blogIndex'}) | |
36 | - else { | |
37 | - api.history.sync.push({ | |
38 | - page:'userEdit', | |
39 | - feed: api.keys.sync.id(), | |
40 | - callback: (err, didEdit) => { | |
41 | - if (err) throw new Error ('Error editing profile', err) | |
33 | + startApp() | |
42 | 34 | |
43 | - if (didEdit) | |
44 | - api.settings.sync.set({ onboarded: true }) | |
35 | + return app | |
36 | + } | |
37 | + }) | |
45 | 38 | |
46 | - api.history.sync.push({ page: 'blogIndex' }) | |
47 | - } | |
48 | - }) | |
49 | - } | |
39 | + function startApp () { | |
40 | + api.history.sync.push({page: 'splash'}) | |
50 | 41 | |
42 | + setTimeout(enterApp, 2000) | |
43 | + } | |
51 | 44 | |
52 | - return app | |
45 | + function enterApp() { | |
46 | + const isOnboarded = api.settings.sync.get('onboarded') | |
47 | + if (isOnboarded) | |
48 | + api.history.sync.push({page: 'blogIndex'}) | |
49 | + else { | |
50 | + api.history.sync.push({ | |
51 | + page:'userEdit', | |
52 | + feed: api.keys.sync.id(), | |
53 | + callback: (err, didEdit) => { | |
54 | + if (err) throw new Error ('Error editing profile', err) | |
55 | + | |
56 | + // if they clicked something, just mark them onboarded | |
57 | + api.settings.sync.set({ onboarded: true }) | |
58 | + | |
59 | + api.history.sync.push({ page: 'blogIndex' }) | |
60 | + } | |
61 | + }) | |
53 | 62 | } |
54 | - }) | |
63 | + | |
64 | + } | |
55 | 65 | } |
56 | 66 |
app/html/header.js | ||
---|---|---|
@@ -17,12 +17,13 @@ | ||
17 | 17 | const { location, push } = nav |
18 | 18 | |
19 | 19 | const loc = computed(location, location => { |
20 | 20 | if (typeof location != 'object') return {} |
21 | - | |
22 | - return location || {} | |
21 | + return location | |
23 | 22 | }) |
24 | 23 | |
24 | + if (loc().page === 'splash') return | |
25 | + | |
25 | 26 | const isSettings = computed(loc, loc => { |
26 | 27 | return SETTINGS_PAGES.includes(loc.page) |
27 | 28 | }) |
28 | 29 |
app/index.js | ||
---|---|---|
@@ -29,8 +29,9 @@ | ||
29 | 29 | // threadShow: require('./page/threadShow'), |
30 | 30 | userEdit: require('./page/userEdit'), |
31 | 31 | // userFind: require('./page/userFind'), |
32 | 32 | userShow: require('./page/userShow'), |
33 | + splash: require('./page/splash'), | |
33 | 34 | threadNew: require('./page/threadNew'), |
34 | 35 | threadShow: require('./page/threadShow'), |
35 | 36 | }, |
36 | 37 | sync: { |
app/page/splash.js | ||
---|---|---|
@@ -1,0 +1,43 @@ | ||
1 | +const nest = require('depnest') | |
2 | +const { h } = require('mutant') | |
3 | +const path = require('path') | |
4 | + | |
5 | +exports.gives = nest('app.page.splash') | |
6 | + | |
7 | +exports.needs = nest({ | |
8 | + 'translations.sync.strings': 'first' | |
9 | +}) | |
10 | + | |
11 | +exports.create = (api) => { | |
12 | + return nest('app.page.splash', splash) | |
13 | + | |
14 | + function splash (location) { | |
15 | + // location is an object { feed, page: 'splash', callback } | |
16 | + | |
17 | + const strings = api.translations.sync.strings() | |
18 | + | |
19 | + const style = { | |
20 | + 'background-image': assetUrl('splash.svg') | |
21 | + } | |
22 | + | |
23 | + return h('Splash', [ | |
24 | + // h('div.top'), | |
25 | + h('div.top', [ | |
26 | + // h('div.logoName', { style: { 'background-image': assetUrl('logo_and_name.png')} } ) | |
27 | + h('img.logoName', { src: assetPath('logo_and_name.png') }) | |
28 | + ]), | |
29 | + h('div.bottom', { style }, [ | |
30 | + h('div.about', strings.splash.about), | |
31 | + h('pre.slogan', strings.splash.slogan), | |
32 | + ]) | |
33 | + ]) | |
34 | + } | |
35 | +} | |
36 | + | |
37 | +function assetPath (name) { | |
38 | + return path.join(__dirname, '../../assets', name) | |
39 | +} | |
40 | + | |
41 | +function assetUrl (name) { | |
42 | + return `url(${assetPath(name)})` | |
43 | +} |
app/page/splash.mcss | ||
---|---|---|
@@ -1,0 +1,52 @@ | ||
1 | +Splash { | |
2 | + position: fixed | |
3 | + top: 0 | |
4 | + bottom: 0 | |
5 | + left: 0 | |
6 | + right: 0 | |
7 | + | |
8 | + | |
9 | + div.top { | |
10 | + height: 11vh | |
11 | + background-color: #2f5ea1 | |
12 | + | |
13 | + img.logoName { | |
14 | + margin: 1vw | |
15 | + } | |
16 | + } | |
17 | + | |
18 | + div.bottom { | |
19 | + width: 100% | |
20 | + height: 100% | |
21 | + background-size: contain | |
22 | + background-repeat: no-repeat | |
23 | + $backgroundPrimary | |
24 | + | |
25 | + padding-top: 26vw | |
26 | + text-align: center | |
27 | + | |
28 | + display: flex | |
29 | + flex-direction: column | |
30 | + align-items: center | |
31 | + | |
32 | + | |
33 | + div.about { | |
34 | + color: #666 | |
35 | + font-size: 1.5rem | |
36 | + line-height: 1.5 | |
37 | + | |
38 | + max-width: 40vw | |
39 | + margin-bottom: 2vw | |
40 | + } | |
41 | + | |
42 | + pre.slogan { | |
43 | + color: #2f5ea1 | |
44 | + font-size: 2.5rem | |
45 | + font-family: cursive, serif | |
46 | + font-style: italic | |
47 | + line-height: 1.2 | |
48 | + } | |
49 | + | |
50 | + } | |
51 | +} | |
52 | + |
assets/logo_and_name.png |
---|
assets/splash.svg |
---|
router/sync/routes.js | ||
---|---|---|
@@ -19,8 +19,9 @@ | ||
19 | 19 | // 'app.page.groupShow': 'first', |
20 | 20 | 'app.page.userEdit': 'first', |
21 | 21 | // 'app.page.userFind': 'first', |
22 | 22 | 'app.page.userShow': 'first', |
23 | + 'app.page.splash': 'first', | |
23 | 24 | 'app.page.threadNew': 'first', |
24 | 25 | 'app.page.threadShow': 'first', |
25 | 26 | // 'app.page.image': 'first', |
26 | 27 | 'blob.sync.url': 'first', |
@@ -31,8 +32,9 @@ | ||
31 | 32 | const pages = api.app.page |
32 | 33 | // route format: [ routeValidator, routeFunction ] |
33 | 34 | |
34 | 35 | const routes = [ |
36 | + [ location => location.page === 'splash', pages.splash ], | |
35 | 37 | |
36 | 38 | // Blog pages |
37 | 39 | [ location => location.page === 'blogIndex', pages.blogIndex ], |
38 | 40 | [ location => location.page === 'blogNew', pages.blogNew ], |
translations/en.js | ||
---|---|---|
@@ -1,5 +1,11 @@ | ||
1 | 1 | module.exports = { |
2 | + splash: { | |
3 | + about: `A new era social network for people who have faith in a decentralized world that values openness, equalty, and freedom`, | |
4 | + slogan: `Connecting the Unconnected | |
5 | +Building Honest Communication | |
6 | +` | |
7 | + }, | |
2 | 8 | blogIndex: { |
3 | 9 | title: 'Discover', |
4 | 10 | }, |
5 | 11 | blogNav: { |
Built with git-ssb-web