git ssb

2+

mixmix / ticktack



Commit a73aa37ff93b9ce8d191f6ab8ad82e4c673126f2

add avatars thread, additional styling

mix irving committed on 8/8/2017, 12:22:27 PM
Parent: 964f30d756aca5cfd83467fe5cfea951e981f4b7

Files changed

app/html/thread.jschanged
app/html/thread.mcsschanged
index.jschanged
styles/mixins.jschanged
blob/index.jsadded
blob/sync/url.jsadded
app/html/thread.jsView
@@ -6,8 +6,9 @@
66
77 exports.gives = nest('app.html.thread')
88
99 exports.needs = nest({
10+ 'about.html.image': 'first',
1011 'app.sync.goTo': 'first',
1112 'message.html.markdown': 'first'
1213 })
1314
@@ -25,28 +26,32 @@
2526 const { goTo } = api.app.sync
2627 const threadView = h('Thread',
2728 map(chunkedThread, chunk => {
2829
29- return computed(chunk, chunk => get(chunk, '[0].value.author') === myId
30- ? h('div.my-chunk', [
30+ return computed(chunk, chunk => {
31+ const author = get(chunk, '[0].value.author')
32+ if (author === myId) {
33+ return h('div.my-chunk', [
3134 h('div.avatar'),
3235 h('div.msgs', map(chunk, msg => {
3336 return h('div.msg-row', [
3437 h('div.spacer'),
3538 message(msg)
3639 ])
3740 }))
3841 ])
39- : h('div.other-chunk', [
40- h('div.avatar', 'other'),
42+ } else {
43+ return h('div.other-chunk', [
44+ h('div.avatar', api.about.html.image(author)),
4145 h('div.msgs', map(chunk, msg => {
4246 return h('div.msg-row', [
4347 message(msg),
4448 h('div.spacer')
4549 ])
4650 }))
4751 ])
48- )
52+ }
53+ })
4954 })
5055 )
5156
5257 function message (msg) {
app/html/thread.mcssView
@@ -21,19 +21,19 @@
2121 div.msg-row {
2222 div.msg {
2323 $primaryColor
2424
25- border-bottom-left-radius: .7rem
26- border-top-left-radius: .7rem
25+ border-bottom-left-radius: .9rem
26+ border-top-left-radius: .9rem
2727 }
2828 :first-child {
2929 div.msg {
30- border-top-right-radius: .7rem
30+ border-top-right-radius: .9rem
3131 }
3232 }
3333 :last-child {
3434 div.msg {
35- border-bottom-right-radius: .7rem
35+ border-bottom-right-radius: .9rem
3636 }
3737 }
3838 }
3939 }
@@ -46,19 +46,19 @@
4646
4747 div.msg-row {
4848 div.msg {
4949 border: 1.5px #ddd solid
50- border-bottom-right-radius: .7rem
51- border-top-right-radius: .7rem
50+ border-bottom-right-radius: .9rem
51+ border-top-right-radius: .9rem
5252 }
5353 :first-child {
5454 div.msg {
55- border-top-left-radius: .7rem
55+ border-top-left-radius: .9rem
5656 }
5757 }
5858 :last-child {
5959 div.msg {
60- border-bottom-left-radius: .7rem
60+ border-bottom-left-radius: .9rem
6161 }
6262 }
6363 }
6464 }
@@ -69,13 +69,15 @@
6969 display: flex
7070 margin-bottom: .5rem
7171
7272 div.avatar {
73- background-color: grey
74- width: 2rem
75- height: 2rem
76- border-radius: 1rem
73+ background-color: #333
74+ $smallAvatar
7775
76+ img {
77+ $smallAvatar
78+ }
79+
7880 margin-right: 1rem
7981 }
8082
8183 div.msgs {
@@ -86,9 +88,9 @@
8688 div.msg {
8789 line-height: 1.2rem
8890 background-color: #fff
8991 padding: 0 .7rem
90- margin-bottom: .3rem
92+ margin-bottom: .1rem
9193 border-radius: .3rem
9294 }
9395 div.msg-spacer {
9496 flex-grow: grow
index.jsView
@@ -1,6 +1,7 @@
11 const ticktack = {
22 app: require('./app'),
3+ blob: require('./blob'),
34 router: require('./router'),
45 styles: require('./styles')
56 }
67
styles/mixins.jsView
@@ -18,16 +18,18 @@
1818 $colorSubtle {
1919 color: #222
2020 }
2121
22-$avatarSmall {
23- width: 32px
24- height: 32px
22+$smallAvatar {
23+ width: 3rem
24+ height: 3rem
25+ border-radius: 1.5rem
2526 }
2627
27-$avatarLarge {
28- width: 56px
29- height: 56px
28+$largeAvatar {
29+ width: 6rem
30+ height: 6rem
31+ border-radius: 3rem
3032 }
3133 `
3234
3335
blob/index.jsView
@@ -1,0 +1,6 @@
1+module.exports = {
2+ sync: {
3+ url: require('./sync/url')
4+ }
5+}
6+
blob/sync/url.jsView
@@ -1,0 +1,13 @@
1+const nest = require('depnest')
2+
3+exports.gives = nest('blob.sync.url')
4+
5+exports.create = function (api) {
6+ return nest('blob.sync.url', function (id) {
7+ // return id
8+
9+ return 'http://localhost:8989/blobs/get/' + id
10+ })
11+}
12+
13+

Built with git-ssb-web