git ssb

16+

Dominic / patchbay



Commit a407ea75e9c86c40b52db83e092f821ca8ab84df

refactor classes to support BEM css

Dominic Tarr committed on 6/24/2016, 9:45:31 PM
Parent: 27e92625a95571a37337ba2095d5d17499d43195

Files changed

modules/compose.jschanged
modules/post.jschanged
modules/private.jschanged
modules/public.jschanged
modules/tabs.jschanged
modules/thread.jschanged
modules/compose.jsView
@@ -62,10 +62,10 @@
6262 }
6363
6464
6565 var composer =
66- h('div', h('div.column', ta,
67- accessories = h('div.row',
66+ h('div.compose', h('div.column', ta,
67+ accessories = h('div.row.compose__controls',
6868 //hidden until you focus the textarea
6969 {style: {display: 'none'}},
7070 file_input(function (file) {
7171 files.push(file)
@@ -97,5 +97,4 @@
9797 return composer
9898
9999 }
100100
101-
modules/post.jsView
@@ -38,4 +38,6 @@
3838
3939
4040
4141
42+
43+
modules/private.jsView
@@ -26,26 +26,38 @@
2626 }
2727
2828 exports.screen_view = function (path) {
2929 if(path === '/private') {
30- var content = h('div.column')
3130 var id = null
3231 sbot_whoami(function (err, me) {
3332 id = me.id
3433 })
3534
36- var div = h('div.column', {style: {'overflow':'auto'}},
37- message_compose({type: 'post', recps: [], private: true},
35+ var div = h('div.column.scroller',
36+ {style: {'overflow':'auto'}},
37+ h('div.scroller__wrapper',
38+ message_compose({type: 'post'}), //header
39+ content
40+ )
41+ )
42+
43+ var compose = message_compose(
44+ {type: 'post', recps: [], private: true},
3845 function (msg) {
3946 msg.recps = [id].concat(msg.mentions).filter(function (e) {
4047 return ref.isFeed('string' === typeof e ? e : e.link)
4148 })
4249 if(!msg.recps.length)
4350 throw new Error('cannot make private message without recipients - just mention them in the message')
4451 return msg
45- }),
46- content)
52+ })
4753
54+ var content = h('div.column.scroller__content')
55+ var div = h('div.column.scroller',
56+ {style: {'overflow':'auto'}},
57+ h('div.scroller__wrapper', compose, content)
58+ )
59+
4860 pull(
4961 sbot_log({old: false}),
5062 unbox(),
5163 Scroller(div, content, message_render, true, false)
@@ -68,4 +80,12 @@
6880 return "PRIVATE"
6981 }
7082
7183
84+
85+
86+
87+
88+
89+
90+
91+
modules/public.jsView
@@ -10,12 +10,16 @@
1010 var sbot_log = plugs.first(exports.sbot_log = [])
1111
1212 exports.screen_view = function (path, sbot) {
1313 if(path === '/public') {
14- var content = h('div.column')
15- var div = h('div.column',
14+
15+ var content = h('div.column.scroller__content')
16+ var div = h('div.column.scroller',
1617 {style: {'overflow':'auto'}},
17- message_compose({type: 'post'}), content
18+ h('div.scroller__wrapper',
19+ message_compose({type: 'post'}), //header
20+ content
21+ )
1822 )
1923
2024 pull(
2125 sbot_log({old: false}),
@@ -45,4 +49,7 @@
4549
4650
4751
4852
53+
54+
55+
modules/tabs.jsView
@@ -14,22 +14,29 @@
1414 var screen_view = plugs.first(exports.screen_view = [])
1515
1616 exports.message_render = []
1717
18-
1918 exports.app = function () {
2019 var tabs = Tabs()
2120 tabs.classList.add('screen')
2221
23- var public = screen_view('/public')
24- if(public) tabs.add('public', public, true)
22+ var saved
23+ try { saved = JSON.parse(localStorage.openTabs) }
24+ catch (_) { saved = ['/public', '/private'] }
25+
26+// var public = screen_view('/public')
27+// if(public) tabs.add('public', public, true)
28+//
29+// var private = screen_view('/private')
30+// if(private) tabs.add('private', private, true)
31+//
32+ saved.forEach(function (path) {
33+ var el = screen_view(path)
34+ if(el) tabs.add(path, el, true)
35+ })
2536
26- var private = screen_view('/private')
27- if(private) tabs.add('private', private, true)
37+ tabs.select(saved[0] || '/public')
2838
29- tabs.select('public')
30-
31-
3239 tabs.onclick = function (ev) {
3340 var link = ancestor(ev.target)
3441 if(!link) return
3542 var path = link.hash.substring(1)
@@ -38,20 +45,20 @@
3845 ev.stopPropagation()
3946
4047 //open external links.
4148 //this ought to be made into something more runcible
42- if(/^https?/.test(link.href))
43- return require('electron').shell.openExternal(link.href)
49+// if(/^https?/.test(link.href))
50+// return require('electron').shell.openExternal(link.href)
4451
4552 if(tabs.has(path)) return tabs.select(path)
4653
4754 var el = screen_view(path)
48- if(el) tabs.add(path, el, !ev.ctrlKey)
49-
55+ if(el) {
56+ tabs.add(path, el, !ev.ctrlKey)
57+ localStorage.openTabs = JSON.stringify(tabs.tabs)
58+ }
5059 }
5160
5261 return tabs
5362 }
5463
5564
56-
57-
modules/thread.jsView
@@ -57,13 +57,15 @@
5757 root: id,
5858 branch: id //mutated when thread is loaded.
5959 }
6060
61- var content = h('div')
62- var div = h('div.column',
61+ var content = h('div.column.scroller__content')
62+ var div = h('div.column.scroller',
6363 {style: {'overflow-y': 'auto'}},
64- content,
65- h('div.editor', message_compose(meta))
64+ h('div.scroller__wrapper',
65+ content,
66+ message_compose(meta)
67+ )
6668 )
6769
6870 pull(
6971 sbot_links({

Built with git-ssb-web