git ssb

2+

mixmix / ticktack



Commit db1b91bf9f68e6db25b325fd506058608428302e

push styling more towards kik

mix irving committed on 8/11/2017, 5:11:20 AM
Parent: daba97bd476315a1c5da4761622e3c4ad7d7dd1d

Files changed

app/html/thread.mcsschanged
app/page/home.jschanged
app/page/home.mcsschanged
styles/mixins.jschanged
app/html/thread.mcssView
@@ -5,9 +5,9 @@
55 div.my-chunk {
66 $chunk
77
88 justify-content: space-between
9-
9+
1010 div.avatar {
1111 visibility: hidden
1212 }
1313
@@ -67,9 +67,9 @@
6767 div.msg {
6868 line-height: 1.2rem
6969 background-color: #fff
7070 padding: 0 .7rem
71- margin-bottom: .1rem
71+ margin-bottom: .1rem
7272 border-radius: .3rem
7373 }
7474 div.msg-spacer {
7575 flex-grow: grow
app/page/home.jsView
@@ -65,38 +65,58 @@
6565 function link(location) {
6666 return {'ev-click': () => api.history.sync.push(location)}
6767 }
6868
69- function item (context, thread) {
69+ function item (context, thread, opts = {}) {
7070 if(!thread.value) return
71+
72+ const subjectEl = h('div.subject', [
73+ opts.nameRecipients
74+ ? h('div.recps', buildRecipientNames(thread).map(recp => h('div.recp', recp)))
75+ : null,
76+ subject(thread)
77+ ])
78+
7179 const lastReply = thread.replies && last(thread.replies)
7280 const replyEl = lastReply
7381 ? h('div.reply', [
74- h('div.author', [api.about.obs.name(lastReply.value.author), ':']),
75- subject(lastReply)
76- ])
82+ h('div.replySymbol', '► '),
83+ subject(lastReply)
84+ ])
7785 : null
7886
87+
88+ // REFACTOR: move this to a template?
89+ function buildRecipientNames (thread) {
90+ const myId = api.keys.sync.id()
91+
92+ return thread.value.content.recps
93+ .map(link => isString(link) ? link : link.link)
94+ .filter(link => link !== myId)
95+ .map(api.about.obs.name)
96+ }
97+
7998 return h('div.thread', link(thread), [
8099 h('div.context', context),
81100 h('div.content', [
82- h('div.subject', [subject(thread)]),
101+ subjectEl,
83102 replyEl
84103 ])
85104 ])
86105 }
87106
88- function threadGroup (threads, obj, toName) {
107+ function threadGroup (threads, obj, toContext, opts) {
89108 // threads = a state object for all the types of threads
90109 // obj = a map of keys to root ids, where key ∈ (channel | group | concatenated list of pubkeys)
91- // toName = fn that derives a name from a particular thread
92-
110+ // toContext = fn that derives the context of the group
111+ // opts = { nameRecipients }
112+
93113 var groupEl = h('div.threads')
94114 for(var k in obj) {
95115 var id = obj[k]
96116 var thread = get(threads, ['roots', id])
97117 if(thread && thread.value) {
98- var el = item(toName(k, thread), thread)
118+ var el = item(toContext(k, thread), thread, opts)
99119 if(el) groupEl.appendChild(el)
100120 }
101121 }
102122 return groupEl
@@ -118,18 +138,18 @@
118138 h('h2', 'Direct Messages'),
119139 threadGroup(
120140 threads,
121141 threads.private,
122- function (_, msg) {
142+ function (_, msg)
123143 // NB: msg passed in is actually a 'thread', but only care about root msg
124144 const myId = api.keys.sync.id()
125-
145+
126146 return msg.value.content.recps
127147 .map(link => isString(link) ? link : link.link)
128- .filter(link => link !== myId)
148+ .filter(link => link !== myId)
129149 .map(api.about.html.image)
130-
131- }
150+ },
151+ { nameRecipients: true }
132152 )
133153 ])
134154
135155 const channelUpdatesSection = h('section.updates -channel', [
app/page/home.mcssView
@@ -3,16 +3,37 @@
33 div.container {
44 $primaryBackground
55
66 section.updates {
7+
78 -directMessage {
89 $homePageSection
10+
11+ div.threads {
12+ div.thread {
13+ div.content {
14+ div.subject {
15+ display: flex
16+
17+ div.recps {
18+ display: flex
19+ font-weight: 600
20+ margin-right: .4rem
21+
22+ div.recp {
23+ margin-right: .4rem
24+ }
25+ }
26+ }
27+ }
28+ }
29+ }
930 }
1031
1132 -channel {
1233 $homePageSection
1334
14- div.threads {
35+ div.threads {
1536 div.thread {
1637 div.context {
1738 background: #fff
1839 min-width: 8rem
@@ -71,17 +92,19 @@
7192 border: 1px solid #ddd
7293 border-radius: 1rem
7394
7495 div.subject {
75- font-weight: 600
96+ font-size: 1.2rem
7697 margin-bottom: .3rem
7798
78- $smallMarkdown
99+ $largeMarkdown
79100 }
80101 div.reply {
81102 display: flex
82- div.author {
83- font-weight: 600
103+ color: #444
104+
105+ div.replySymbol {
106+ margin-left: .7rem
84107 margin-right: .3rem
85108 }
86109
87110 $smallMarkdown
styles/mixins.jsView
@@ -36,15 +36,26 @@
3636 }
3737
3838 $smallMarkdown {
3939 div.Markdown {
40- h1, h2, h3, h4, h5, h6, p {
41- font-size: 1rem
42- margin: 0
40+ h1, h2, h3, h4, h5, h6, p {
41+ font-size: 1rem
42+ font-weight: 300
43+ margin: 0
4344 }
4445 }
4546 }
4647
48+$largeMarkdown {
49+ div.Markdown {
50+ h1, h2, h3, h4, h5, h6, p {
51+ font-size: 1.2rem
52+ font-weight: 300
53+ margin: 0
54+ }
55+ }
56+}
57+
4758 $roundLeft {
4859 border-top-left-radius: .9rem
4960 border-bottom-left-radius: .9rem
5061 }

Built with git-ssb-web