|
@ -9,6 +9,7 @@ import ProfileInformation from '../components/ProfileInformation'; |
|
|
import TopicList from '../components/TopicList'; |
|
|
import TopicList from '../components/TopicList'; |
|
|
import PostList from '../components/PostList'; |
|
|
import PostList from '../components/PostList'; |
|
|
import LoadingSpinner from '../components/LoadingSpinner'; |
|
|
import LoadingSpinner from '../components/LoadingSpinner'; |
|
|
|
|
|
import { setNavBarTitle } from '../redux/actions/userInterfaceActions'; |
|
|
|
|
|
|
|
|
class Profile extends Component { |
|
|
class Profile extends Component { |
|
|
constructor(props, context) { |
|
|
constructor(props, context) { |
|
@ -34,10 +35,6 @@ class Profile extends Component { |
|
|
(<WithBlockchainData |
|
|
(<WithBlockchainData |
|
|
component={ProfileInformation} |
|
|
component={ProfileInformation} |
|
|
callsInfo={[{ |
|
|
callsInfo={[{ |
|
|
contract: 'Forum', |
|
|
|
|
|
method: 'getUsername', |
|
|
|
|
|
params: [this.state.userAddress] |
|
|
|
|
|
},{ |
|
|
|
|
|
contract: 'Forum', |
|
|
contract: 'Forum', |
|
|
method: 'getUserDateOfRegister', |
|
|
method: 'getUserDateOfRegister', |
|
|
params: [this.state.userAddress] |
|
|
params: [this.state.userAddress] |
|
@ -47,6 +44,7 @@ class Profile extends Component { |
|
|
params: [this.state.userAddress] |
|
|
params: [this.state.userAddress] |
|
|
}]} |
|
|
}]} |
|
|
address={this.state.userAddress} |
|
|
address={this.state.userAddress} |
|
|
|
|
|
username={this.username} |
|
|
numberOfTopics={this.topicIDs && this.topicIDs.length} |
|
|
numberOfTopics={this.topicIDs && this.topicIDs.length} |
|
|
numberOfPosts={this.postIDs && this.postIDs.length} |
|
|
numberOfPosts={this.postIDs && this.postIDs.length} |
|
|
self={this.state.userAddress === this.props.user.address} |
|
|
self={this.state.userAddress === this.props.user.address} |
|
@ -102,6 +100,13 @@ class Profile extends Component { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
propsToView(){ |
|
|
propsToView(){ |
|
|
|
|
|
if (!this.username){ |
|
|
|
|
|
let transaction = this.props.blockchainData |
|
|
|
|
|
.find(transaction => transaction.callInfo.method === "getUsername"); |
|
|
|
|
|
if (transaction.returnData){ |
|
|
|
|
|
this.username = transaction.returnData; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
if (!this.topicIDs){ |
|
|
if (!this.topicIDs){ |
|
|
let transaction = this.props.blockchainData |
|
|
let transaction = this.props.blockchainData |
|
|
.find(transaction => transaction.callInfo.method === "getUserTopics"); |
|
|
.find(transaction => transaction.callInfo.method === "getUserTopics"); |
|
@ -117,6 +122,12 @@ class Profile extends Component { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(){ |
|
|
|
|
|
if (this.username){ |
|
|
|
|
|
this.props.store.dispatch(setNavBarTitle(this.username)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Profile.contextTypes = { |
|
|
Profile.contextTypes = { |
|
@ -145,6 +156,10 @@ class ProfileContainer extends Component { |
|
|
this.profile = <WithBlockchainData |
|
|
this.profile = <WithBlockchainData |
|
|
component={drizzleConnect(Profile, mapStateToProps)} |
|
|
component={drizzleConnect(Profile, mapStateToProps)} |
|
|
callsInfo={[{ |
|
|
callsInfo={[{ |
|
|
|
|
|
contract: 'Forum', |
|
|
|
|
|
method: 'getUsername', |
|
|
|
|
|
params: [userAddress] |
|
|
|
|
|
},{ |
|
|
contract: 'Forum', |
|
|
contract: 'Forum', |
|
|
method: 'getUserTopics', |
|
|
method: 'getUserTopics', |
|
|
params: [userAddress] |
|
|
params: [userAddress] |
|
|