Files: c4e6d69c2cdcc875fc3ac222471b3c5d55810b77 / modules / profile-edit.js
1265 bytesRaw
1 | var h = require('hyperscript') |
2 | var u = require('../util') |
3 | var pull = require('pull-stream') |
4 | var Scroller = require('../pull-scroll') |
5 | var id = require('../keys').id |
6 | |
7 | exports.needs = { |
8 | publish: 'first', |
9 | avatar_edit: 'first' |
10 | } |
11 | |
12 | exports.gives = { |
13 | screen_view: true |
14 | } |
15 | |
16 | exports.create = function (api) { |
17 | return { |
18 | screen_view: function (path, sbot) { |
19 | if(path === 'Edit') { |
20 | var identify = h('input.identify', {placeholder: 'Your Name', name: 'namespace'}) |
21 | var div = h('div.scroller__wrapper', |
22 | h('div.column.scroller__content', {style: 'margin-top: 25%;'}, |
23 | h('div.message', |
24 | h('h1', 'Edit Your Profile'), |
25 | h('form', |
26 | identify, |
27 | h('button', 'Publish Name', {onclick: function (e) { |
28 | if(identify.value) |
29 | api.publish({ |
30 | type: 'about', |
31 | about: id, |
32 | name: identify.value || undefined, |
33 | }), |
34 | setTimeout(function() { location.reload() }, 100), |
35 | e.preventDefault() |
36 | }}) |
37 | ), |
38 | api.avatar_edit(id) |
39 | ) |
40 | ) |
41 | ) |
42 | return div |
43 | } |
44 | } |
45 | } |
46 | } |
47 | |
48 |
Built with git-ssb-web