git ssb

16+

Dominic / patchbay



Commit ce182a6ed828db9aa940f352cf28de6409530165

mvp settings page with style hacking (pairing with Zach!)

mix irving committed on 4/8/2018, 10:01:05 AM
Parent: 0aa1e55ffcfbd06056d917ca218a05fb8733cbae

Files changed

app/html/app.jschanged
app/page/settings.jsadded
router/sync/routes.jschanged
app/html/app.jsView
@@ -22,9 +22,9 @@
2222 console.log('STARTING app')
2323
2424 window = api.app.sync.window(window)
2525
26- const initialTabs = ['/public', '/inbox', '/notifications'] // NB router converts these to { page: '/public' }
26 + const initialTabs = ['/settings','/public', '/inbox', '/notifications'] // NB router converts these to { page: '/public' }
2727 const App = h('App', api.app.html.tabs(initialTabs))
2828
2929 api.app.sync.initialise(App)
3030 // runs all the functions in app/sync/initialise
app/page/settings.jsView
@@ -1,0 +1,48 @@
1 +const nest = require('depnest')
2 +const { h } = require('mutant')
3 +const insertCss = require('insert-css')
4 +const compileCss = require('micro-css')
5 +
6 +exports.gives = nest({
7 + 'app.html.menuItem': true,
8 + 'app.page.settings': true
9 +})
10 +
11 +exports.needs = nest({
12 + 'app.sync.goTo': 'first'
13 +})
14 +
15 +exports.create = function (api) {
16 + return nest({
17 + 'app.html.menuItem': menuItem,
18 + 'app.page.settings': publicPage
19 + })
20 +
21 + function menuItem () {
22 + return h('a', {
23 + style: { order: 1 },
24 + 'ev-click': () => api.app.sync.goTo({ page: 'settings' })
25 + }, '/settings')
26 + }
27 +
28 + function publicPage (location) {
29 + const styles = h('textarea')
30 + return h('SettingsPage', [
31 + styles,
32 + h('button', {'ev-click': () => peachify(styles)}, 'peachify')
33 + ])
34 +
35 + function peachify (styles) {
36 + const css = compileCss(styles.value)
37 + // body{
38 + // background-color: peachpuff;
39 + // color: indigo; }
40 +
41 + // a:link, a:visited, a:active {
42 + // color: #116a6a; }
43 + // `
44 + insertCss(css)
45 + }
46 + }
47 +
48 +}
router/sync/routes.jsView
@@ -12,9 +12,11 @@
1212 'profile': 'first',
1313 'search': 'first',
1414 'blob': 'first',
1515 'thread': 'first',
16- 'channel': 'first'
16 + 'channel': 'first',
17 + 'settings': 'first'
18 +
1719 },
1820 'keys.sync.id': 'first'
1921 })
2022
@@ -30,8 +32,9 @@
3032 [ loc => loc.page === 'notifications', pages.notifications ],
3133 [ loc => loc.page === 'errors', pages.errors ],
3234 [ loc => loc.page === 'profile', () => pages.profile({ feed: myId }) ],
3335 [ loc => loc.page === 'search' && loc.query, pages.search ],
36 + [ loc => loc.page === 'settings', pages.settings],
3437
3538 [ loc => isBlob(loc.blob), pages.blob ],
3639 [ loc => isPresent(loc.channel), pages.channel ],
3740 [ loc => isFeed(loc.feed), pages.profile ],

Built with git-ssb-web