import { drizzleConnect } from 'drizzle-react';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { Tab } from 'semantic-ui-react'
import WithBlockchainData from '../components/WithBlockchainData';
import ProfileInformation from '../components/ProfileInformation';
import TopicList from '../components/TopicList';
import PostList from '../components/PostList';
import LoadingSpinner from '../components/LoadingSpinner';
class Profile extends Component {
constructor(props, context) {
super(props);
this.propsToView = this.propsToView.bind(this);
this.drizzle = context.drizzle;
this.state = {
userAddress: this.props.params.address ? this.props.params.address : this.props.user.address
};
}
render() {
this.propsToView();
var infoTab =
();
var topicsTab =
(
{this.topicIDs
?
:
}
);
var postsTab =
();
const profilePanes = [
{
menuItem: 'INFORMATION',
pane: {
key: 'INFORMATION',
content: (infoTab),
},
},
{
menuItem: 'TOPICS',
pane: {
key: 'TOPICS',
content: (topicsTab),
},
},
{
menuItem: 'POSTS',
pane: {
key: 'POSTS',
content: (postsTab),
},
},
]
return (
);
}
propsToView(){
if (!this.topicIDs){
let transaction = this.props.blockchainData
.find(transaction => transaction.callInfo.method === "getUserTopics");
if (transaction.returnData){
this.topicIDs = transaction.returnData;
}
}
if (!this.postIDs){
let transaction = this.props.blockchainData
.find(transaction => transaction.callInfo.method === "getUserPosts");
if (transaction.returnData){
this.postIDs = transaction.returnData;
}
}
}
}
Profile.contextTypes = {
drizzle: PropTypes.object
};
const mapStateToProps = state => {
return {
user: state.user,
orbitDB: state.orbitDB
}
};
class ProfileContainer extends Component {
constructor(props){
super(props);
let userAddress;
if (this.props.params.address){
userAddress = this.props.params.address;
} else {
userAddress = this.props.user.address;
}
this.profile =
}
render() {
return(this.profile);
}
}
const containerProps = state => {
return {
user: state.user
}
};
export default drizzleConnect(ProfileContainer, containerProps);