mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-01-10 12:24:20 +01:00
improvements to post editor and board viewer
This commit is contained in:
parent
d335992af0
commit
0bf9dcca1f
@ -46,13 +46,14 @@ module.exports = function (boardsAPI) {
|
||||
}
|
||||
})
|
||||
},
|
||||
init (boards) {
|
||||
if (!this.state.init) {
|
||||
if (this.props.params.userid) {
|
||||
boards.getBoardSettings(this.props.params.userid, this.props.params.boardname)
|
||||
}
|
||||
this.setState({ init: true, api: true, boards: boards })
|
||||
}
|
||||
componentWillReceiveProps (props) {
|
||||
boardsAPI.use(b => this.init(b, props))
|
||||
},
|
||||
init (boards, newProps) {
|
||||
var props = newProps || this.props
|
||||
if (!props.params.userid) return
|
||||
boards.getBoardSettings(props.params.userid, props.params.boardname)
|
||||
this.setState({ loading: true, init: true, api: true, userid: boards.getMyID(), boards: boards })
|
||||
},
|
||||
toolbox () {
|
||||
return <div className="iconbar text-center">
|
||||
@ -63,7 +64,11 @@ module.exports = function (boardsAPI) {
|
||||
render () {
|
||||
if (this.state.api) {
|
||||
if (this.state.loading) {
|
||||
return <Loading title="Downloading Board data" />
|
||||
return <Loading title="Downloading Board data">
|
||||
{ this.props.params.userid === 'me' || this.props.params.userid === this.state.userid
|
||||
? <Link to={'/edit/board/' + this.props.params.boardname} className="button button-primary">Edit Board</Link>
|
||||
: <span></span> }
|
||||
</Loading>
|
||||
} else {
|
||||
return (<div className="board">
|
||||
<h2>{this.state.name}</h2>
|
||||
|
@ -24,7 +24,7 @@ module.exports = function (boardsAPI) {
|
||||
},
|
||||
init (boards) {
|
||||
if (this.state.init) return
|
||||
this.setState({ api: boards, init: true })
|
||||
this.setState({ api: boards, userid: boards.getMyID(), init: true })
|
||||
if (this.props.params.posthash) this.downloadPost(boards)
|
||||
},
|
||||
downloadPost (boards) {
|
||||
@ -88,6 +88,9 @@ module.exports = function (boardsAPI) {
|
||||
<button className="button button-primary center-block" onClick={this.skip}>Skip</button>
|
||||
</Saving>
|
||||
} else {
|
||||
if (this.state.userid && this.props.params.boardname) {
|
||||
var boardurl = '/@' + this.state.userid + '/' + this.props.params.boardname
|
||||
}
|
||||
return (
|
||||
<div className="editor">
|
||||
<h2><Icon name="pencil" className="light" />
|
||||
@ -109,6 +112,7 @@ module.exports = function (boardsAPI) {
|
||||
</div>
|
||||
<div className="buttons">
|
||||
<button className="button button-primary" onClick={this.save}>Publish</button>
|
||||
{boardurl ? <Link className="button not-first" to={boardurl}>View Board</Link> : <span></span> }
|
||||
{this.additionalButtons()}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user