git ssb

2+

mixmix / ticktack



Commit d0639ad38eaa9038c50046656e228137f3ac4aa8

Merge remote-tracking branch 'origin/master' into userFind

mix irving committed on 8/18/2017, 3:19:47 AM
Parent: f98c407e53e9a0b812757db574e4a35fcff143d4
Parent: 6b1478bdfa54da8cc7d272b584f5ff2fcb5a76cc

Files changed

app/html/header.mcsschanged
app/page/channel.jschanged
app/page/page.mcsschanged
app/page/threadNew.jschanged
message/html/compose.jschanged
router/sync/routes.jschanged
translations/sync.jschanged
app/html/header.mcssView
@@ -1,7 +1,5 @@
11 Header {
2- margin: 1rem 0 0 1rem
3-
42 nav {
53 $navFA
64 padding: 1rem 0
75
app/page/channel.jsView
@@ -6,8 +6,9 @@
66
77 exports.gives = nest('app.page.channel')
88
99 exports.needs = nest({
10+ 'app.html.link': 'first',
1011 'app.html.threadCard': 'first',
1112 'history.sync.push': 'first',
1213 'state.obs.channel': 'first',
1314 'translations.sync.strings': 'first',
@@ -47,9 +48,12 @@
4748 return updates
4849 }
4950 )
5051
51- return h('Page -home', {title: location.channel}, [
52+ const Link = api.app.html.link
53+
54+ return h('Page -home', {title: channel}, [
55+ Link({ page: 'threadNew', channel }, h('Button -primary', strings.channel.action.newThread)),
5256 h('div.container', [ threadsHtmlObs ]),
5357 h('Button -showMore', {
5458 'ev-click': threadsHtmlObs.more,
5559 disabled: disableShowMore
app/page/page.mcssView
@@ -1,13 +1,13 @@
11 Page {
22 $backgroundPrimary
3+ margin-top: 4rem
34
45 div.container {
56 $maxWidth
67 min-height: 100vh
78 padding: 1rem
89 margin: 0 auto
9- margin-top: 4rem
1010
1111 div.Thread {
1212 margin-bottom: 1rem
1313 }
app/page/threadNew.jsView
@@ -17,9 +17,17 @@
1717
1818 return nest('app.page.threadNew', threadNew)
1919
2020 function threadNew (location) {
21+ const { feed, channel } = location
22+
23+ if (feed) return threadNewFeed(location)
24+ if (channel) return threadNewChannel(location)
25+ }
26+
27+ function threadNewFeed (location) {
2128 const strings = api.translations.sync.strings()
29+
2230 const { feed } = location
2331 const name = api.about.obs.name(feed)
2432
2533 const meta = Struct({
@@ -56,9 +64,43 @@
5664 composer
5765 ])
5866 ])
5967 }
60-}
6168
69+ function threadNewChannel (location) {
70+ const strings = api.translations.sync.strings()
6271
72+ const { channel } = location
6373
74+ const meta = Struct({
75+ type: 'post',
76+ channel,
77+ subject: Value()
78+ })
79+ const composer = api.message.html.compose(
80+ { meta, shrink: false },
81+ (err, msg) => api.history.sync.push(err ? err : msg)
82+ )
6483
84+ return h('Page -threadNew', {title: strings.threadNew.pageTitle}, [
85+ h('div.container', [
86+ h('div.field -channel', [
87+ h('div.label', strings.threadNew.field.channel),
88+ h('div.recps', [
89+ h('div.recp', [
90+ h('div.name', `#${channel}`)
91+ ])
92+ ])
93+ ]),
94+ h('div.field -subject', [
95+ h('div.label', strings.threadNew.field.subject),
96+ h('input', {
97+ 'ev-input': e => meta.subject.set(e.target.value),
98+ placeholder: strings.optionalField
99+ }),
100+ ]),
101+ composer
102+ ])
103+ ])
104+ }
105+}
106+
message/html/compose.jsView
@@ -171,8 +171,10 @@
171171 publishBtn.disabled = false
172172 handleErr(err)
173173 }
174174
175+ debugger
176+
175177 return api.message.async.publish(content, done)
176178 // return api.message.html.confirm(content, done)
177179
178180 function done (err, msg) {
router/sync/routes.jsView
@@ -23,13 +23,8 @@
2323 const pages = api.app.page
2424 // route format: [ routeValidator, routeFunction ]
2525
2626 const routes = [
27- [ location => isBlob(location.blob), pages.image ],
28- [ location => location.page === 'home', pages.home ],
29- [ location => location.channel , pages.channel ],
30- [ location => location.page === 'settings', pages.settings ],
31-
3227 // Group pages
3328 [ location => location.page === 'groupFind', pages.groupFind ],
3429 [ location => location.page === 'groupIndex', pages.groupIndex ],
3530 [ location => location.page === 'groupNew', pages.groupNew ],
@@ -37,20 +32,24 @@
3732
3833 // Thread pages
3934 // QUESTION - should this be for private threads + group threads?
4035 [ location => location.page === 'threadNew' && isFeed(location.feed), pages.threadNew ],
36+ [ location => location.page === 'threadNew' && location.channel, pages.threadNew ],
4137 [ location => isMsg(location.key), pages.threadShow ],
4238
4339 // User pages
4440 [ location => location.page === 'userFind', pages.userFind ],
4541 [ location => isFeed(location.feed), pages.userShow ],
4642
43+ [ location => location.page === 'home', pages.home ],
44+ [ location => location.page === 'settings', pages.settings ],
45+ [ location => isBlob(location.blob), pages.image ],
46+ [ location => location.channel , pages.channel ],
47+
4748 // Error page
4849 [ location => true, pages.error ]
4950 ]
5051
5152 return [...routes, ...sofar]
5253 })
5354 }
5455
55-
56-
translations/sync.jsView
@@ -10,9 +10,13 @@
1010 loading: 'Loading...',
1111 optionalField: 'optional',
1212 sendMessage: 'Send',
1313 showMore: 'Show More',
14- channels: 'Channels',
14+ channel: {
15+ action: {
16+ newThread: 'New thread'
17+ }
18+ },
1519 directMessages: 'Direct Messages',
1620 home: "Home",
1721 error: "Error",
1822 errorNotFound: "The page wasn't found",
@@ -25,9 +29,10 @@
2529 threadNew: {
2630 pageTitle: 'New Thread',
2731 field: {
2832 to: 'To',
29- subject: 'Subject'
33+ subject: 'Subject',
34+ channel: 'Channel'
3035 }
3136
3237 },
3338 threadShow: 'Direct Messages',

Built with git-ssb-web