From 2344de08819355cda34753013af689de14b7042b Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Fri, 9 Feb 2018 14:40:56 +0100 Subject: [PATCH] more UI polish, added other fields to metadata form --- src/components/Board.js | 5 ++-- src/components/BoardEditorForm.js | 45 +++++++++++++++++++++++++++---- src/components/OpenBoardForm.js | 12 +++++++-- src/containers/BoardEditor.js | 5 ++-- 4 files changed, 55 insertions(+), 12 deletions(-) diff --git a/src/components/Board.js b/src/components/Board.js index 0a1df45..72b40b6 100644 --- a/src/components/Board.js +++ b/src/components/Board.js @@ -6,7 +6,7 @@ import { shortenAddress } from '../utils/orbitdb'; import moment from 'moment' export default function Board({ address, posts, metadata, replicating, stats, replicationInfo, lastReplicated }) { - const { email, website, title } = metadata || {} + const { email, website, title, description } = metadata || {} const peerCount = (stats.peers || []).length const online = peerCount > 0 const writeable = stats.access ? (stats.access.writeable ? 'Yes' : 'No') : '?' @@ -24,6 +24,7 @@ export default function Board({ address, posts, metadata, replicating, stats, re {title || 'Unnamed Board'} Board + { description ?

{description}

: null } @@ -75,7 +76,7 @@ export default function Board({ address, posts, metadata, replicating, stats, re Website - {website ? {website} : 'N/A'} + {website ? {website} : 'N/A'} diff --git a/src/components/BoardEditorForm.js b/src/components/BoardEditorForm.js index 33e8f04..aa6418e 100644 --- a/src/components/BoardEditorForm.js +++ b/src/components/BoardEditorForm.js @@ -1,16 +1,19 @@ import React, { Component } from 'react' import { Icon, Container, Card, Form, Button } from 'semantic-ui-react' +import { Link } from 'react-router-dom' export default class BoardEditorForm extends Component { constructor(props){ super(props) this.state = { - title: props.title || '' + title: props.title || '', + website: props.website || '', + email: props.email || '' } } render() { - const { title } = this.state + const { title, website, email } = this.state const { address, updateBoardMetadata } = this.props return @@ -33,9 +36,31 @@ export default class BoardEditorForm extends Component { onChange={this.updateTitle.bind(this)} /> - + + + + + + + + + + +
+ + +
@@ -46,4 +71,14 @@ export default class BoardEditorForm extends Component { const title = event.target.value this.setState({ title }) } + + updateWebsite(event) { + const website = event.target.value + this.setState({ website }) + } + + updateEmail(event) { + const email = event.target.value + this.setState({ email }) + } } \ No newline at end of file diff --git a/src/components/OpenBoardForm.js b/src/components/OpenBoardForm.js index 22f53f5..8051aee 100644 --- a/src/components/OpenBoardForm.js +++ b/src/components/OpenBoardForm.js @@ -1,5 +1,6 @@ import React, { Component } from 'react' -import { Container, Card, Form, Button } from 'semantic-ui-react' +import { Icon, Container, Card, Form, Button } from 'semantic-ui-react' +import { Link } from 'react-router-dom' export default class OpenBoardForm extends Component { constructor(props){ @@ -38,7 +39,14 @@ export default class OpenBoardForm extends Component { onChange={this.updateAddress.bind(this)} /> - +
+ + +
diff --git a/src/containers/BoardEditor.js b/src/containers/BoardEditor.js index c2c001e..f8b0dc6 100644 --- a/src/containers/BoardEditor.js +++ b/src/containers/BoardEditor.js @@ -13,14 +13,13 @@ function BoardEditor({ boards, boardEditor, match, updateBoardMetadata }) { board={board} address={address} updateBoardMetadata={updateBoardMetadata} - {...boardEditor} + {...board.metadata} /> } function mapStateToProps(state){ return { - boards: state.boards.boards, - boardEditor: state.boardEditor + boards: state.boards.boards } }