From 7c0149318952adebc9caa87ff0eabd34a3a089b6 Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Wed, 16 Dec 2015 17:39:59 +0100 Subject: [PATCH] fixed up profile editor --- webapp/pages/profile-editor.jsx | 36 ++++++++++++++++++++++++++++++--- webapp/style.css | 27 ++++++++++++++++--------- 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/webapp/pages/profile-editor.jsx b/webapp/pages/profile-editor.jsx index 37cbd6b..55b9f48 100644 --- a/webapp/pages/profile-editor.jsx +++ b/webapp/pages/profile-editor.jsx @@ -1,6 +1,7 @@ var React = require('react') var GetIPFS = require('getipfs.jsx') var Icon = require('icon.jsx') +var Link = require('react-router').Link module.exports = function (boardsAPI) { return React.createClass({ @@ -45,7 +46,11 @@ module.exports = function (boardsAPI) { } }, skip () { - this.setState({ loading: false }) + this.setState({ loading: false, updating: false, error: false }) + }, + refresh () { + this.setState({ loading: true }) + boardsAPI.use(b => this.getProfile(b)) }, save () { var boards = this.state.api @@ -53,13 +58,24 @@ module.exports = function (boardsAPI) { name: this.state.name, description: this.state.description } + this.setState({ updating: true }) boards.createProfile(profile, err => { - console.log('CREATE:', err) + this.setState({ error: err, updating: false }) + if (err) console.log('Profile Publish error:', err) }) }, render () { if (this.state.api) { - if (this.state.loading) { + if (this.state.error) { + return
+
+ +

Ooops

+

{this.state.error}

+ +
+
+ } else if (this.state.loading) { return
@@ -67,6 +83,15 @@ module.exports = function (boardsAPI) {
+ } else if (this.state.updating) { + return
+
+ +

Publishing...

+

Pressing the Skip button will not abort the publish operation.

+ +
+
} else { return (
@@ -74,6 +99,9 @@ module.exports = function (boardsAPI) {

This App uses IPFS to store your profile. When you are offline, other users or servers that viewed your profile will serve it to others.

+

Warning: due to a bug in go-ipfs, it may take up to a minute + for your changes to be visibile. Your profile will appear unchanged during + this time.

@@ -84,6 +112,8 @@ module.exports = function (boardsAPI) {
+ + View
) diff --git a/webapp/style.css b/webapp/style.css index 3280e9b..080e2e8 100644 --- a/webapp/style.css +++ b/webapp/style.css @@ -146,11 +146,6 @@ a:hover { margin-left: .5rem; } -.settings .buttons .button { - display: block; - margin: 1rem auto; - width: 80% -} .homepage { text-align: center; max-width: 70rem; @@ -179,15 +174,27 @@ a:hover { margin: 3rem auto; } -@media (min-width: 400px) { +.buttons .button { + display: block; + margin: auto; + width: 80% +} + +.buttons .not-first { + /* mobile only */ + margin-top: 1rem; +} + +@media (min-width: 500px) { /* larger than mobile */ - .settings .buttons { + .buttons { text-align: inherit; } - .settings .buttons .not-first { - margin: 0 1rem; + .buttons .not-first { + margin-left: 1rem; + margin-top: auto; } - .settings .buttons .button { + .buttons .button { display: inline-block; width: auto; }