1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-01-26 15:04:19 +01:00

updated postpage

This commit is contained in:
Enrico Fasoli 2015-11-23 16:07:04 +01:00
parent e2d1fd1ed8
commit ce187c3ddc
3 changed files with 29 additions and 2 deletions

View File

@ -43,7 +43,7 @@ module.exports = function(boardsAPI){
<div className="icons"> <div className="icons">
<UserID id={this.props.post.op}></UserID> <UserID id={this.props.post.op}></UserID>
<Icon name="clock-o" className="not-first"/> {this.getDate()} <Icon name="clock-o" className="not-first"/> {this.getDate()}
<Icon name="comments" className="not-first" /> <Link to={this.postLink()}>View</Link> <Icon name="comments" className="not-first" /> <Link className="nounderline" to={this.postLink()}>View</Link>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,4 +1,5 @@
var React = require('react') var React = require('react')
var Link = require('react-router').Link
module.exports = function(boardsAPI){ module.exports = function(boardsAPI){
var UserID = require('userID.jsx')(boardsAPI) var UserID = require('userID.jsx')(boardsAPI)
@ -10,6 +11,7 @@ module.exports = function(boardsAPI){
}, },
componentDidMount: function(){ componentDidMount: function(){
boardsAPI.use(boards => { boardsAPI.use(boards => {
boards.init()
boards.getEventEmitter().on('init', err => { boards.getEventEmitter().on('init', err => {
if(!err && this.isMounted()){ if(!err && this.isMounted()){
this.init(boards) this.init(boards)
@ -31,9 +33,22 @@ module.exports = function(boardsAPI){
} }
}) })
}, },
getContext(){
if(this.props.params.userid){
if(this.props.params.boardname)
return <div>Posted by <UserID id={this.props.params.userid} /> in <Link to={'@/'+this.props.params.userid+'/'+this.props.params.boardname}>#{this.props.params.boardname}</Link></div>
else
return <div>Posted by <UserID id={this.props.params.userid} /></div>
} else return <div><h6 className="light">You are viewing a single post</h6></div>
},
render: function(){ render: function(){
if(this.state.api) if(this.state.api)
return <Post post={this.state.post} board={this.props.params.boardname} /> return <div className="post-page">
<div className="text-center">
{this.getContext()}
</div>
<Post post={this.state.post} board={this.props.params.boardname} />
</div>
else return <GetIPFS /> else return <GetIPFS />
} }
}) })

View File

@ -20,6 +20,10 @@ a {
text-decoration: none; text-decoration: none;
} }
.black {
color: black
}
.center-block { .center-block {
margin:auto; margin:auto;
display:block; display:block;
@ -75,6 +79,10 @@ a:hover {
color: #707070; color: #707070;
} }
.post .icons .a {
color: #707070;
}
.post .icons .user-id { .post .icons .user-id {
display: inline-block; display: inline-block;
} }
@ -83,6 +91,10 @@ a:hover {
margin-left: 1rem; margin-left: 1rem;
} }
.post-page .user-id {
display: inline
}
.navbar { .navbar {
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
display: block; display: block;