git ssb

2+

mixmix / ticktack



Commit 2f46470aad18da0d76890f9f0f30c34ada88472b

wip - multi-person PM

mix irving committed on 2/5/2018, 8:01:02 PM
Parent: 71dbadafffeb775edb0eb90985feeac67464d988

Files changed

app/page/threadNew.jschanged
app/page/threadNew.mcsschanged
app/page/threadNew.jsView
@@ -1,11 +1,11 @@
11 const nest = require('depnest')
2-const { h, Struct, Value, computed } = require('mutant')
2+const { h, Struct, Value, Array: MutantArray, computed, map } = require('mutant')
33
44 exports.gives = nest('app.page.threadNew')
55
66 exports.needs = nest({
7- 'about.html.image': 'first',
7+ 'about.html.avatar': 'first',
88 'about.obs.name': 'first',
99 'app.html.sideNav': 'first',
1010 'app.html.thread': 'first',
1111 'history.sync.push': 'first',
@@ -21,28 +21,30 @@
2121 function threadNew (location) {
2222 const { feed, channel } = location
2323
2424 if (feed) return threadNewFeed(location)
25- // if (channel) return threadNewChannel(location)
2625 }
2726
2827 function threadNewFeed (location) {
2928 const strings = api.translations.sync.strings()
29+ const myId = api.keys.sync.id()
3030
3131 const { feed } = location
32- const name = api.about.obs.name(feed)
32+ const name = api.about.obs.name
3333
34+ const searchInput = Value()
3435 const meta = Struct({
3536 type: 'post',
36- recps: [
37- api.keys.sync.id(),
38- { link: feed, name }
39- ],
37+ recps: MutantArray ([
38+ myId,
39+ { link: feed, name: name(feed) }
40+ ]),
4041 subject: Value()
4142 })
43+
4244 const composer = api.message.html.compose(
4345 { meta, shrink: false },
44- (err, msg) => api.history.sync.push(err ? err : Object.assign(msg, { feed }))
46+ (err, msg) => api.history.sync.push(err ? err : Object.assign(msg, { feed })) // TODO check this
4547 )
4648
4749 return h('Page -threadNew', {title: strings.threadNew.pageTitle}, [
4850 api.app.html.sideNav(location),
@@ -50,12 +52,13 @@
5052 h('div.container', [
5153 h('div.field -to', [
5254 h('div.label', strings.threadNew.field.to),
5355 h('div.recps', [
54- h('div.recp', [
55- api.about.html.image(feed),
56- h('div.name', name)
57- ])
56+ map(meta.recps, Recipient),
57+ h('input', {
58+ 'ev-input': e => searchInput.set(e.target.value),
59+ placeholder: strings.optionalField
60+ }),
5861 ])
5962 ]),
6063 h('div.field -subject', [
6164 h('div.label', strings.threadNew.field.subject),
@@ -67,45 +70,17 @@
6770 composer
6871 ])
6972 ])
7073 ])
71- }
7274
73- // function threadNewChannel (location) {
74- // const strings = api.translations.sync.strings()
75+ function Recipient (r) {
76+ if (r === myId) return
7577
76- // const { channel, flash } = location
78+ return h('div.recp', [
79+ api.about.html.avatar(r.link, 'tiny'),
80+ h('div.name', r.name)
81+ ])
82+ }
83+ }
7784
78- // const meta = Struct({
79- // type: 'post',
80- // channel,
81- // subject: Value()
82- // })
83- // const composer = api.message.html.compose(
84- // { meta, shrink: false },
85- // (err, msg) => api.history.sync.push(err ? err : msg)
86- // )
87-
88- // return h('Page -threadNew', {title: strings.threadNew.pageTitle}, [
89- // h('div.content', [
90- // flash ? h('div.flash', flash) : '',
91- // h('div.field -channel', [
92- // h('div.label', strings.channel),
93- // h('div.recps', [
94- // h('div.recp', [
95- // h('div.name', `#${channel}`)
96- // ])
97- // ])
98- // ]),
99- // h('div.field -subject', [
100- // h('div.label', strings.threadNew.field.subject),
101- // h('input', {
102- // 'ev-input': e => meta.subject.set(e.target.value),
103- // placeholder: strings.optionalField
104- // }),
105- // ]),
106- // composer
107- // ])
108- // ])
109- // }
11085 }
11186
app/page/threadNew.mcssView
@@ -36,32 +36,40 @@
3636 outline: none
3737 }
3838
3939 div.recps {
40+ flex-grow: 1
41+ height: 2.5rem
42+
43+ $backgroundPrimaryText
44+ padding-left: .5rem
45+ $borderSubtle
46+ border-radius: 6rem
47+
4048 display: flex
4149
4250 div.recp {
43- padding: .3rem
44- min-width: 5rem
45- $borderSubtle
46- border-radius: 6rem
47- $backgroundPrimaryText
48-
4951 margin-right: 1rem
5052
5153 display: flex
5254 align-items: center
5355
54- img {
55- width: 2rem
56- height: 2rem
57- border-radius: 2rem
56+ img.Avatar {
5857 }
5958
6059 div.name {
6160 margin: 0 .5rem
6261 }
6362 }
63+
64+ input {
65+ flex-grow: 1
66+
67+ $fontBasic
68+ margin-right: 1rem
69+ border: none
70+ outline: none
71+ }
6472 }
6573
6674 }
6775 }

Built with git-ssb-web