git ssb

0+

ev / minbase



Tree: 3ee0398629a78832c2fbe78831ce756faeaeca74

Files: 3ee0398629a78832c2fbe78831ce756faeaeca74 / modules / edit.js

2217 bytesRaw
1var h = require('hyperscript')
2var u = require('../util')
3var pull = require('pull-stream')
4var Scroller = require('pull-scroll')
5var id = require('../keys').id
6var ref = require('ssb-ref')
7
8exports.needs = {
9 message_confirm: 'first',
10 avatar_edit: 'first'
11}
12
13exports.gives = {
14 screen_view: true
15}
16
17exports.create = function (api) {
18 return {
19 screen_view: function (path, sbot) {
20 if(path === 'Edit') {
21 var nameInput = h('input', {placeholder: 'New name'})
22
23 var locInput = h('input', {placeholder: 'New location'})
24
25 var descInput = h('textarea', {placeholder: 'New description', style: 'width: 97%;'})
26
27 var div = h('div.column.scroller', {style: 'overflow: auto;'},
28 h('div.scroller__wrapper',
29 h('div.column.scroller__content',
30 h('div.message',
31 h('h1', 'Edit profile'),
32 nameInput,
33 h('button.btn.btn-primary', 'Preview', {onclick: function () {
34 if(nameInput.value) {
35 api.message_confirm({
36 type: 'about',
37 about: id,
38 name: nameInput.value || undefined
39 })
40 }
41 }}),
42 h('hr'),
43 locInput,
44 h('button.btn.btn-primary', 'Preview', {onclick: function () {
45 if(locInput.value) {
46 api.message_confirm({
47 type: 'loc',
48 about: id,
49 loc: locInput.value || undefined
50 })
51 }
52 }}),
53 h('hr'),
54 descInput,
55 h('button.btn.btn-primary', 'Preview', {onclick: function (){
56 if(descInput.value) {
57 api.message_confirm({
58 type: 'description',
59 about: id,
60 description: descInput.value || undefined
61 })
62 }
63 }}),
64 h('hr'),
65 api.avatar_edit
66 )
67 )
68 )
69 )
70 return div
71 }
72 }
73 }
74}
75
76

Built with git-ssb-web