git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit 9313ea1e25179b299f9cb6236b02af7c73861aad

Merge branch 'master' into theme-picker-dark

Matt McKegg committed on 9/16/2017, 2:43:05 AM
Parent: 2dee2554f4144c95c5ddec92074b224296f476ef
Parent: 771e0f5dd80b0edb43f9e4e9a03ea5f30656dae4

Files changed

main-window.jschanged
modules/feed/html/rollup.jschanged
modules/message/html/compose.jschanged
package.jsonchanged
styles/light/compose.mcsschanged
main-window.jsView
@@ -72,9 +72,10 @@
7272 Array.from(document.head.children)
7373 .filter(c => c.tagName == 'STYLE')
7474 .forEach(c => c.innerText = '')
7575
76- const theme = require('./styles')[name]
76+ var theme = require('./styles')[name]
77+ if (!theme) theme = require('./styles')['light']
7778 insertCss(theme)
7879 })
7980
8081 var container = h(`MainWindow -${process.platform}`, [
modules/feed/html/rollup.jsView
@@ -97,9 +97,9 @@
9797
9898 if (updates() === 0 && msg.value.author === yourId && container.scrollTop < 20) {
9999 refresh()
100100 } else {
101- updates.set(updates() + 1)
101+ updates.set(newSinceRefresh.size)
102102 }
103103 })
104104 )
105105 })
@@ -179,9 +179,13 @@
179179 previousId = msg.key
180180 return result
181181 })
182182
183- var renderedMessage = api.message.html.render(item, {inContext: true})
183+ var renderedMessage = api.message.html.render(item, {
184+ inContext: true,
185+ priority: highlightItems.has(item.key) ? 2 : 0
186+ })
187+
184188 if (!renderedMessage) return h('div')
185189 if (lastBumpType) {
186190 var bumps = lastBumpType === 'vote'
187191 ? getLikeAuthors(groupedBumps[lastBumpType])
modules/message/html/compose.jsView
@@ -52,9 +52,28 @@
5252 disabled: publishing,
5353 placeholder
5454 })
5555
56+ var warningMessage = Value(null)
57+ var warning = h('section.warning',
58+ { className: when(warningMessage, '-open', '-closed') },
59+ [
60+ h('div.warning', warningMessage),
61+ h('div.close', { 'ev-click': () => warningMessage.set(null) }, 'x')
62+ ]
63+ )
5664 var fileInput = api.blob.html.input(file => {
65+ const megabytes = file.size / 1024 / 1024
66+ if (megabytes >= 5) {
67+ const rounded = Math.floor(megabytes*100)/100
68+ warningMessage.set([
69+ h('i.fa.fa-exclamation-triangle'),
70+ h('strong', file.name),
71+ ` is ${rounded}MB - the current limit is 5MB`
72+ ])
73+ return
74+ }
75+
5776 files.push(file)
5877 filesById[file.link] = file
5978
6079 var embed = file.type.indexOf('image/') === 0 ? '!' : ''
@@ -89,8 +108,9 @@
89108 when(expanded, '-expanded', '-contracted')
90109 ]
91110 }, [
92111 textArea,
112+ warning,
93113 actions
94114 ])
95115
96116 addSuggest(textArea, (inputText, cb) => {
package.jsonView
@@ -29,9 +29,9 @@
2929 "hashlru": "^2.2.0",
3030 "insert-css": "~2.0.0",
3131 "level": "~1.7.0",
3232 "lrucache": "^1.0.2",
33- "micro-css": "^2.0.0",
33+ "micro-css": "^2.0.1",
3434 "mime-types": "^2.1.15",
3535 "moment": "^2.18.1",
3636 "mutant": "^3.21.2",
3737 "mutant-pull-reduce": "^1.1.0",
@@ -70,7 +70,7 @@
7070 "suggest-box": "^2.2.3",
7171 "text-node-searcher": "^1.1.1"
7272 },
7373 "devDependencies": {
74- "electron": "~1.6.11"
74+ "electron": "~1.7.6"
7575 }
7676 }
styles/light/compose.mcssView
@@ -20,8 +20,35 @@
2020 background: #ebf7ee;
2121 }
2222 }
2323
24+ section.warning {
25+ color: #fff
26+ font-size: 1.2rem
27+ background-color: #ff00b6
28+
29+ height: 0
30+ padding: 0 .5rem
31+ transition: all ease-in .1s
32+
33+ display: flex
34+ justify-content: space-between
35+
36+
37+ -open {
38+ padding: .5rem
39+ height: initial
40+ }
41+
42+ i.fa { margin-right: .5rem }
43+ div.warning {
44+ strong { margin-right: .3rem }
45+ }
46+ div.close {
47+ cursor: pointer
48+ }
49+ }
50+
2451 section.actions {
2552 display: flex
2653 flex-direction: row
2754 align-items: baseline

Built with git-ssb-web