git ssb

10+

Matt McKegg / patchwork



Commit 232d1b421613d81a3488bf7c5cfd585639edb91b

add "More" nav menu, move gatherings and others in here

Matt McKegg committed on 6/29/2017, 2:31:25 AM
Parent: 652c6133c026281265b284256390a078fd7279c7

Files changed

main-window.jschanged
styles/main-window.mcsschanged
main-window.jsView
@@ -53,9 +53,9 @@
5353 })
5454 })
5555
5656 var views = api.app.views(api.page.html.render, [
57- '/public', '/private', '/gatherings', id, '/mentions'
57+ '/public', '/private', id, '/mentions'
5858 ])
5959
6060 var pendingCount = computed([
6161 views.get('/public').pendingUpdates,
@@ -84,9 +84,13 @@
8484 ]),
8585 h('span.nav', [
8686 tab('Public', '/public'),
8787 tab('Private', '/private'),
88- tab('Gatherings', '/gatherings')
88+ dropTab('More', [
89+ ['Channels', '/channels'],
90+ ['Gatherings', '/gatherings'],
91+ ['Extended Network', '/all'],
92+ ])
8993 ]),
9094 h('span.appTitle', [
9195 h('span.title', 'Patchwork'),
9296 api.app.html.progressNotifier()
@@ -130,8 +134,33 @@
130134 return container
131135
132136 // scoped
133137
138+ function dropTab (title, items) {
139+ var menu = electron.remote.Menu.buildFromTemplate(items.map(item => {
140+ return {
141+ label: item[0],
142+ click () {
143+ setView(item[1])
144+ }
145+ }
146+ }))
147+
148+ var element = h('a -drop', {
149+ 'ev-click': (ev) => {
150+ var rects = element.getBoundingClientRect()
151+ electron.remote.getCurrentWindow().webContents.getZoomFactor((factor) => {
152+ menu.popup(electron.remote.getCurrentWindow(), {
153+ x: Math.round(rects.left * factor),
154+ y: Math.round(rects.bottom * factor) + 4,
155+ async: true
156+ })
157+ })
158+ }
159+ }, title)
160+ return element
161+ }
162+
134163 function setView (href) {
135164 views.setView(href)
136165 }
137166
styles/main-window.mcssView
@@ -103,8 +103,26 @@
103103 background: #d2d2d2
104104 }
105105 }
106106
107+ -drop {
108+
109+ :after {
110+ background-image: svg(dropArrow)
111+ background-repeat: no-repeat;
112+ background-position: center right;
113+ width: 10px;
114+ height: 14px;
115+ display: inline-block;
116+ content: ' ';
117+ margin-left: 6px;
118+ margin-right: -6px;
119+ border-left: 1px solid #d2d2d2;
120+ padding-left: 5px;
121+ margin-bottom: -2px;
122+ }
123+ }
124+
107125 -add {
108126 border-color: #498849
109127 background-color: #255D24
110128 text-shadow: 1px 1px 1px #000
@@ -261,4 +279,20 @@
261279 100% {
262280 max-height: 100px
263281 }
264282 }
283+
284+@svg dropArrow {
285+ width: 12px
286+ height: 6px
287+ content: "<path d='M2,0 L10,0 L6,6 Z' />"
288+
289+ path {
290+ fill: #888
291+ }
292+
293+ -active {
294+ path {
295+ fill: #DDD
296+ }
297+ }
298+}

Built with git-ssb-web