diff --git a/src/assets/css/App.css b/src/assets/css/App.css
index 754fc3b..d45cb27 100644
--- a/src/assets/css/App.css
+++ b/src/assets/css/App.css
@@ -23,7 +23,7 @@ strong {
}
.view-container {
- width: 70%;
+ width: 60%;
margin: 10px auto;
}
@@ -77,6 +77,13 @@ strong {
background: #0c1a2b;
}
+.stick {
+ z-index: 2;
+ position: fixed;
+ top: 0;
+ width: 100%;
+}
+
/* TOPICS */
.topic {
@@ -142,6 +149,12 @@ strong {
margin-right: 11.25px;
}
+.user-avatar {
+ width: 52px;
+ height: 52px;
+ text-align: center;
+}
+
.stretch-space-between {
display: flex;
flex-flow: row nowrap;
@@ -190,6 +203,10 @@ a {
text-decoration: none;
}
+.post-content a{
+ color: #039be5;
+}
+
.center-in-parent {
width: 100%;
height: 100%;
diff --git a/src/components/NavBar.js b/src/components/NavBar.js
index f6b8b67..6e7c60d 100644
--- a/src/components/NavBar.js
+++ b/src/components/NavBar.js
@@ -1,25 +1,51 @@
-import React from 'react';
+import React, { Component } from 'react';
import { drizzleConnect } from 'drizzle-react';
import { Link } from 'react-router';
-const NavBar = (props) => {
- return (
-
+ );
+ }
+
+ componentDidMount(){
+ this.headerHeight = this.navRef.current.offsetTop;
+ window.addEventListener('scroll', this.handleScroll);
+ }
+
+ componentWillUnmount(){
+ window.removeEventListener('scroll', this.handleScroll);
+ }
+
+ handleScroll(){
+ if (window.pageYOffset >= this.headerHeight) {
+ this.navRef.current.classList.add("stick")
+ } else {
+ this.navRef.current.classList.remove("stick");
+ }
+ }
};
const mapStateToProps = state => {
diff --git a/src/components/NewPost.js b/src/components/NewPost.js
index 21d991d..fb0fb1a 100644
--- a/src/components/NewPost.js
+++ b/src/components/NewPost.js
@@ -3,6 +3,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import uuidv4 from 'uuid/v4';
+import TimeAgo from 'react-timeago';
import UserAvatar from 'react-user-avatar';
import ReactMarkdown from 'react-markdown';
@@ -18,6 +19,9 @@ class NewPost extends Component {
this.validateAndPost = this.validateAndPost.bind(this);
this.pushToDatabase = this.pushToDatabase.bind(this);
+ this.newPostOuterRef = React.createRef();
+ this.subjectInputRef = React.createRef();
+
this.transactionProgressText = [];
this.drizzle = context.drizzle;
@@ -67,8 +71,8 @@ class NewPost extends Component {
handlePreviewToggle() {
this.setState((prevState, props) => ({
- previewEnabled: !prevState.previewEnabled,
- previewDate: this.getDate()
+ previewEnabled: !prevState.previewEnabled,
+ previewDate: this.getDate()
}));
}
@@ -84,7 +88,7 @@ class NewPost extends Component {
render() {
return (
-
+
{this.state.creatingPost &&
@@ -93,58 +97,76 @@ class NewPost extends Component {
}
-
-
-
- {this.props.user.username}
Subject: {this.state.postSubjectInput}
-
-
-
-
#{this.props.postIndex}
+
+
+
+
+
+
+
+ {this.props.user.username}
+
+ {this.state.previewEnabled &&
+
+ }{this.state.previewEnabled && ","} #{this.props.postIndex}
+
+
+
+
+ {this.state.previewEnabled &&
+ ("Subject: " + this.state.postSubjectInput)
+ }
+
+
+
+
+
+
-
-
-
-
+
);
}
@@ -298,6 +320,16 @@ class NewPost extends Component {
}
}
}
+
+ componentDidUpdate(prevProps, prevState){
+ if (!this.state.previewEnabled && prevState.previewEnabled){
+ this.newPostOuterRef.current.scrollIntoView(true);
+ }
+ }
+
+ componentDidMount(){
+ this.newPostOuterRef.current.scrollIntoView(true);
+ }
}
NewPost.contextTypes = {
diff --git a/src/components/Post.js b/src/components/Post.js
index d27c246..d1ffb4a 100644
--- a/src/components/Post.js
+++ b/src/components/Post.js
@@ -4,7 +4,7 @@ import { drizzleConnect } from 'drizzle-react';
import PropTypes from 'prop-types';
import TimeAgo from 'react-timeago';
-import epochTimeConverter from '../helpers/EpochTimeConverter'
+import epochTimeConverter from '../helpers/EpochTimeConverter';
import UserAvatar from 'react-user-avatar';
import ReactMarkdown from 'react-markdown';
@@ -34,20 +34,17 @@ class Post extends Component {
render(){
let avatarView = (this.props.blockchainData[0].returnData
?
- :
+ :
);
return (
- { this.context.router.push("/topic/"
- + this.props.blockchainData[0].returnData[4] + "/"
- + this.props.postID)}}>
+
-
+
{this.props.blockchainData[0].returnData !== null
?
:avatarView
}
-
-
-
-
-
+
+
+
+
+
{this.props.blockchainData[0].returnData !== null
?this.props.blockchainData[0].returnData[2]
:"Username"
}
-
- {this.props.blockchainData[0].returnData !== null &&
-
- }, #{this.props.postIndex}
-
-
-
-
+
+ {this.props.blockchainData[0].returnData !== null &&
+
+ }{this.props.blockchainData[0].returnData !== null && ","} #{this.props.postIndex}
+
+
+
+
Subject: {this.orbitPostData.subject}
-
-
- {this.orbitPostData.content
- ?
- :
Post content...
- }
-
-
-
-
-
-
-
- keyboard_arrow_up
-
- 8
-
- keyboard_arrow_down
-
-
- link
-
-
-
-
+
+
+ {this.orbitPostData.content
+ ?
+ :
Post content...
+ }
+
+
+
+
+
+
+
+ keyboard_arrow_up
+
+ 8
+
+ keyboard_arrow_down
+
+ { this.context.router.push("/topic/"
+ + this.props.blockchainData[0].returnData[4] + "/"
+ + this.props.postID)}}>
+ link
+
+
+
+
);
}
diff --git a/src/components/Topic.js b/src/components/Topic.js
index 9bb30d9..5bea07d 100644
--- a/src/components/Topic.js
+++ b/src/components/Topic.js
@@ -45,7 +45,7 @@ class Topic extends Component {
- {topic.topicSubject !== null ? topic.topicSubject : "Subject"}
+ {this.topicSubject !== null ? this.topicSubject : "Subject"}
diff --git a/src/containers/ProfileContainer.js b/src/containers/ProfileContainer.js
index 264bb34..2a5a62f 100644
--- a/src/containers/ProfileContainer.js
+++ b/src/containers/ProfileContainer.js
@@ -26,7 +26,7 @@ class Profile extends Component {
this.state = {
viewSelected: "profile-info-tab",
- userAddress: this.profile.userAddress
+ userAddress: this.props.params.address ? this.props.params.address : this.props.user.address
};
}
diff --git a/src/containers/TopicContainer.js b/src/containers/TopicContainer.js
index eeae87a..59d910e 100644
--- a/src/containers/TopicContainer.js
+++ b/src/containers/TopicContainer.js
@@ -66,14 +66,15 @@ class Topic extends Component {
} else {
topicContents = (
(
+ {this.postList}
{this.state.posting &&
{this.handleClick()}}
onPostCreated={() => {this.postCreated()}}
/>
}
- {this.postList}
{!this.state.posting &&
}