Commit 10e34b53d3a68d175823c7588d903463e08056ce
check that text is a string, remove dead code, comment functional css
Dominic Tarr committed on 10/16/2017, 1:47:08 AMParent: f7625b47743ad250e7a0c780a3520e726cf3f2dd
Files changed
app/html/thread-card.js | changed |
app/html/thread-card.js | ||
---|---|---|
@@ -83,30 +83,23 @@ | ||
83 | 83 | var strings = api.translations.sync.strings() |
84 | 84 | const { subject } = api.message.html |
85 | 85 | |
86 | 86 | if(!thread.value) return |
87 | - if(!thread.value.content.text) return | |
87 | + if('string' === typeof thread.value.content.text) return | |
88 | 88 | |
89 | -// const subjectEl = h('div.subject', [ | |
90 | -// opts.nameRecipients | |
91 | -// ? h('div.recps', buildRecipientNames(thread).map(recp => h('div.recp', recp))) | |
92 | -// : null, | |
93 | -// subject(thread) | |
94 | -// ]) | |
95 | - | |
96 | 89 | const lastReply = thread.replies && maxBy(thread.replies, r => r.timestamp) |
97 | -// const replySample = lastReply ? subject(lastReply) : null | |
98 | 90 | |
99 | 91 | const onClick = opts.onClick || function () { api.history.sync.push(thread) } |
100 | 92 | const id = `${thread.key.replace(/[^a-z0-9]/gi, '')}` //-${JSON.stringify(opts)}` |
101 | 93 | // id is only here to help morphdom morph accurately |
102 | 94 | |
103 | 95 | var img = marksum.image(thread.value.content.text) |
104 | 96 | var m = /\!\[[^]+\]\(([^\)]+)\)/.exec(img) |
105 | - console.log(m, img) | |
97 | + | |
106 | 98 | if(m) { |
107 | - //hey this works! fit an image into a specific size (see thread-card.mcss) | |
99 | + //Hey this works! fit an image into a specific size (see thread-card.mcss) | |
108 | 100 | //centered, and scaled to fit the square (works with both landscape and portrait!) |
101 | + //This is functional css not opinionated css, so all embedded. | |
109 | 102 | img = h('Thumbnail') |
110 | 103 | img.style = 'background-image: url("'+api.blob.sync.url(m[1])+'"); background-position:center; background-size: cover;' |
111 | 104 | } |
112 | 105 | else img = '' |
@@ -134,33 +127,4 @@ | ||
134 | 127 | ]) |
135 | 128 | }) |
136 | 129 | } |
137 | 130 | |
138 | - | |
139 | - | |
140 | - | |
141 | - | |
142 | - | |
143 | - | |
144 | - | |
145 | - | |
146 | - | |
147 | - | |
148 | - | |
149 | - | |
150 | - | |
151 | - | |
152 | - | |
153 | - | |
154 | - | |
155 | - | |
156 | - | |
157 | - | |
158 | - | |
159 | - | |
160 | - | |
161 | - | |
162 | - | |
163 | - | |
164 | - | |
165 | - | |
166 | - |
Built with git-ssb-web