- {postData !== null
- ? (
- { event.stopPropagation(); }}
- >
- {avatarView}
-
- )
- : avatarView
- }
+ { event.stopPropagation(); }} >
+
+
-
+
- {postData !== null
- ? postData.value[2]
- : 'Username'
- }
+ {postData.userName}
- {postData !== null
- && (
-
- )
- }
+
-
+
{postSubject === ''
? (
@@ -209,9 +169,8 @@ class Post extends Component {
/>
)
- : `Subject: ${
- postSubject}`
- }
+ : `Subject: ${postSubject}`
+ }
@@ -243,8 +202,7 @@ class Post extends Component {
height="4.0"
/>
- )
- }
+ )}
@@ -270,7 +228,7 @@ class Post extends Component {
onClick={postData
? () => {
navigateTo(`/topic/${
- postData.value[4]}/${
+ postData.topicID}/${
postID}`);
}
: () => {}}
@@ -293,7 +251,7 @@ Post.propTypes = {
avatarUrl: PropTypes.string,
postIndex: PropTypes.number.isRequired,
navigateTo: PropTypes.func.isRequired,
- postData: PropTypes.object,
+ postData: GetPostResult.isRequired,
postID: PropTypes.string.isRequired
};
diff --git a/app/src/containers/PostList.js b/app/src/containers/PostList.js
index 22a1024..6de283f 100644
--- a/app/src/containers/PostList.js
+++ b/app/src/containers/PostList.js
@@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import { drizzle } from '../index';
import Post from './Post';
+import PlaceholderContainer from './PlaceholderContainer';
const contract = 'Forum';
const getPostMethod = 'getPost';
@@ -56,19 +57,34 @@ class PostList extends Component {
const { dataKeys } = this.state;
const { postIDs, contracts, focusOnPost, recentToTheTop } = this.props;
- const posts = postIDs.map((postID, index) => (
-
- ));
+ const posts = postIDs.map((postID, index) => {
+ let fetchedPostData;
+ if(dataKeys[postID])
+ fetchedPostData = contracts[contract][getPostMethod][dataKeys[postID]];
+
+ if(fetchedPostData) {
+ const postData = {
+ userAddress: fetchedPostData.value[1],
+ fullOrbitAddress: `/orbitdb/${fetchedPostData.value[0]}/posts`,
+ userName: fetchedPostData.value[2],
+ timestamp: fetchedPostData.value[3]*1000,
+ topicID: fetchedPostData.value[4]
+ };
+ return(
+
+ )
+ }
+
+ return ();
+ });
return (
@@ -84,7 +100,7 @@ class PostList extends Component {
PostList.propTypes = {
drizzleStatus: PropTypes.object.isRequired,
postIDs: PropTypes.array.isRequired,
- contracts: PropTypes.array.isRequired,
+ contracts: PropTypes.PropTypes.objectOf(PropTypes.object).isRequired,
focusOnPost: PropTypes.number,
recentToTheTop: PropTypes.bool
};
diff --git a/app/src/containers/ProfileContainer.js b/app/src/containers/ProfileContainer.js
index 0c6da08..cc2bdf5 100644
--- a/app/src/containers/ProfileContainer.js
+++ b/app/src/containers/ProfileContainer.js
@@ -136,8 +136,8 @@ class ProfileContainer extends Component {
@@ -200,7 +200,7 @@ class ProfileContainer extends Component {
ProfileContainer.propTypes = {
match: PropTypes.object.isRequired,
drizzleStatus: PropTypes.object.isRequired,
- contracts: PropTypes.array.isRequired,
+ contracts: PropTypes.PropTypes.objectOf(PropTypes.object).isRequired,
navigateTo: PropTypes.func.isRequired,
user: PropTypes.object.isRequired,
setNavBarTitle: PropTypes.func.isRequired
diff --git a/app/src/containers/ProfileInformation.js b/app/src/containers/ProfileInformation.js
index 92267e3..fd35a3f 100644
--- a/app/src/containers/ProfileInformation.js
+++ b/app/src/containers/ProfileInformation.js
@@ -6,7 +6,9 @@ import { drizzle } from '../index';
import epochTimeConverter from '../helpers/EpochTimeConverter';
+import ContentLoader from 'react-content-loader';
import UsernameFormContainer from './UsernameFormContainer';
+import { Table } from 'semantic-ui-react'
const callsInfo = [
{
@@ -130,46 +132,76 @@ class ProfileInformation extends Component {
name={username}
/>
)}
-
-
-
- Username: |
- {username} |
-
-
- Account address: |
- {address} |
-
-
- OrbitDB: |
- {orbitDBId} |
-
-
- TopicsDB: |
- {topicsDBId} |
-
-
- PostsDB: |
- {postsDBId} |
-
-
- Number of topics created: |
- {numberOfTopics} |
-
-
- Number of posts: |
- {numberOfPosts} |
-
+
+
+
+ Username:
+ {username}
+
+
+ Account address:
+ {address}
+
+
+ OrbitDB:
+ {orbitDBId ? orbitDBId
+ :
+
+
+ }
+
+
+ TopicsDB:
+ {topicsDBId ? topicsDBId
+ :
+
+
+ }
+
+
+ PostsDB:
+ {postsDBId ? postsDBId
+ :
+
+
+ }
+
+
+ Number of topics created:
+ {numberOfTopics !== -1 ? numberOfTopics
+ :
+
+
+ }
+
+
+ Number of posts:
+ {numberOfPosts !== -1 ? numberOfPosts
+ :
+
+
+ }
+
{dateOfRegister
&& (
-
- Member since: |
- {epochTimeConverter(dateOfRegister)} |
-
+
+ Member since:
+ {epochTimeConverter(dateOfRegister)}
+
)
}
-
-
+
+
{self &&
}
);
@@ -178,7 +210,7 @@ class ProfileInformation extends Component {
ProfileInformation.propTypes = {
drizzleStatus: PropTypes.object.isRequired,
- contracts: PropTypes.array.isRequired,
+ contracts: PropTypes.PropTypes.objectOf(PropTypes.object).isRequired,
avatarUrl: PropTypes.string,
username: PropTypes.string.isRequired,
address: PropTypes.string.isRequired,
diff --git a/app/src/containers/Topic.js b/app/src/containers/Topic.js
index caa7a9c..0cee538 100644
--- a/app/src/containers/Topic.js
+++ b/app/src/containers/Topic.js
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
+import { GetTopicResult } from '../CustomPropTypes'
import ContentLoader from 'react-content-loader';
import { Card } from 'semantic-ui-react';
@@ -54,7 +55,7 @@ class Topic extends Component {
{topicData.userName}
- Number of Replies: {topicData.nReplies}
+ Number of Replies: {topicData.numberOfReplies}
@@ -69,7 +70,7 @@ class Topic extends Component {
Topic.propTypes = {
userAddress: PropTypes.string.isRequired,
history: PropTypes.object.isRequired,
- //TODO: topicData: GetTopicResult.isRequired,
+ topicData: GetTopicResult.isRequired,
orbitDB: PropTypes.object.isRequired,
topicID: PropTypes.number.isRequired
};
diff --git a/app/src/containers/TopicContainer.js b/app/src/containers/TopicContainer.js
index ead4599..9c6bdbf 100644
--- a/app/src/containers/TopicContainer.js
+++ b/app/src/containers/TopicContainer.js
@@ -191,7 +191,7 @@ TopicContainer.propTypes = {
drizzleStatus: PropTypes.object.isRequired,
orbitDB: PropTypes.object.isRequired,
setNavBarTitle: PropTypes.func.isRequired,
- contracts: PropTypes.array.isRequired,
+ contracts: PropTypes.PropTypes.objectOf(PropTypes.object).isRequired,
user: PropTypes.object.isRequired,
match: PropTypes.object.isRequired,
navigateTo: PropTypes.func.isRequired
diff --git a/app/src/containers/TopicList.js b/app/src/containers/TopicList.js
index de41297..dbab22a 100644
--- a/app/src/containers/TopicList.js
+++ b/app/src/containers/TopicList.js
@@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import { drizzle } from '../index';
import Topic from './Topic';
+import PlaceholderContainer from './PlaceholderContainer';
const contract = 'Forum';
const getTopicMethod = 'getTopic';
@@ -62,11 +63,11 @@ class TopicList extends Component {
if(fetchedTopicData) {
const topicData = {
- userAddress: fetchedTopicData.value[0],
+ userAddress: fetchedTopicData.value[1],
fullOrbitAddress: `/orbitdb/${fetchedTopicData.value[0]}/topics`,
userName: fetchedTopicData.value[2],
timestamp: fetchedTopicData.value[3]*1000,
- nReplies: fetchedTopicData.value[4].length
+ numberOfReplies: fetchedTopicData.value[4].length
};
return(
TODO: Loading UI/fetching needs to be changed (?));
+ return ();
});
//TODO: Return loading indicator instead of topics when not fully loaded (?)
diff --git a/app/src/containers/UsernameFormContainer.js b/app/src/containers/UsernameFormContainer.js
index e4d209e..a32c260 100644
--- a/app/src/containers/UsernameFormContainer.js
+++ b/app/src/containers/UsernameFormContainer.js
@@ -213,8 +213,8 @@ UsernameFormContainer.propTypes = {
dispatch: PropTypes.func.isRequired,
account: PropTypes.string.isRequired,
transactionStack: PropTypes.array.isRequired,
- transactions: PropTypes.array.isRequired,
- contracts: PropTypes.array.isRequired,
+ transactions: PropTypes.PropTypes.objectOf(PropTypes.object).isRequired,
+ contracts: PropTypes.PropTypes.objectOf(PropTypes.object).isRequired,
user: PropTypes.object.isRequired
};