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) {
|
componentWillReceiveProps (props) {
|
||||||
if (!this.state.init) {
|
boardsAPI.use(b => this.init(b, props))
|
||||||
if (this.props.params.userid) {
|
},
|
||||||
boards.getBoardSettings(this.props.params.userid, this.props.params.boardname)
|
init (boards, newProps) {
|
||||||
}
|
var props = newProps || this.props
|
||||||
this.setState({ init: true, api: true, boards: boards })
|
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 () {
|
toolbox () {
|
||||||
return <div className="iconbar text-center">
|
return <div className="iconbar text-center">
|
||||||
@ -63,7 +64,11 @@ module.exports = function (boardsAPI) {
|
|||||||
render () {
|
render () {
|
||||||
if (this.state.api) {
|
if (this.state.api) {
|
||||||
if (this.state.loading) {
|
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 {
|
} else {
|
||||||
return (<div className="board">
|
return (<div className="board">
|
||||||
<h2>{this.state.name}</h2>
|
<h2>{this.state.name}</h2>
|
||||||
|
@ -24,7 +24,7 @@ module.exports = function (boardsAPI) {
|
|||||||
},
|
},
|
||||||
init (boards) {
|
init (boards) {
|
||||||
if (this.state.init) return
|
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)
|
if (this.props.params.posthash) this.downloadPost(boards)
|
||||||
},
|
},
|
||||||
downloadPost (boards) {
|
downloadPost (boards) {
|
||||||
@ -88,6 +88,9 @@ module.exports = function (boardsAPI) {
|
|||||||
<button className="button button-primary center-block" onClick={this.skip}>Skip</button>
|
<button className="button button-primary center-block" onClick={this.skip}>Skip</button>
|
||||||
</Saving>
|
</Saving>
|
||||||
} else {
|
} else {
|
||||||
|
if (this.state.userid && this.props.params.boardname) {
|
||||||
|
var boardurl = '/@' + this.state.userid + '/' + this.props.params.boardname
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="editor">
|
<div className="editor">
|
||||||
<h2><Icon name="pencil" className="light" />
|
<h2><Icon name="pencil" className="light" />
|
||||||
@ -109,6 +112,7 @@ module.exports = function (boardsAPI) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="buttons">
|
<div className="buttons">
|
||||||
<button className="button button-primary" onClick={this.save}>Publish</button>
|
<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()}
|
{this.additionalButtons()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user