From 3aee462b5ca9640c43609b288da16eec5394b382 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Mon, 18 Jun 2018 23:27:23 +0300
Subject: fix tags navigation
---
vnext/src/components/Feeds.js | 29 ++++++++++++++++++++++-------
vnext/src/components/Message.js | 6 ++++--
2 files changed, 26 insertions(+), 9 deletions(-)
(limited to 'vnext')
diff --git a/vnext/src/components/Feeds.js b/vnext/src/components/Feeds.js
index b8367de4..0216a1b4 100644
--- a/vnext/src/components/Feeds.js
+++ b/vnext/src/components/Feeds.js
@@ -1,21 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
+import { Link } from 'react-router-dom';
import * as qs from 'query-string';
import Message from './Message';
import Spinner from './Spinner';
export function Discover(props) {
- return ()
+ return ()
}
export function Discussions(props) {
- return ()
+ return ()
}
export function Blog(props) {
const { user } = props.match.params;
- return ()
+ return ()
}
export function Tag(props) {
@@ -34,7 +35,7 @@ class Feed extends React.Component {
componentDidMount() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
- this.loadMessages(this.props.visitor.hash);
+ this.loadMessages(this.props.visitor.hash, this.props.location.search);
}
componentWillReceiveProps(nextProps) {
if (this.props.location.search != nextProps.location.search
@@ -67,9 +68,23 @@ class Feed extends React.Component {
}
render() {
- var nodes = this.state.msgs.map(msg => {
- return ();
- });
+ const { tag } = qs.parse(this.props.location.search || {});
+ const nodes = (
+
+ {
+ tag && (
+
+
+ ← All posts with tag {tag}
+
+
+ )
+ }
+ {this.state.msgs.map(msg =>
+ )
+ }
+
+ );
return this.state.msgs.length > 0 ? (
{nodes}
) :
;
diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js
index 5667047c..9a15d512 100644
--- a/vnext/src/components/Message.js
+++ b/vnext/src/components/Message.js
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
+import { Link } from 'react-router-dom';
import moment from 'moment';
import { UserType } from './Types';
@@ -27,7 +28,7 @@ export default function Message(props) {
-
+
@@ -96,7 +97,7 @@ export default function Message(props) {
function Tags(props) {
return props.data && props.data.map(tag => {
- return (
{tag})
+ return (
{tag})
})
}
@@ -111,6 +112,7 @@ Message.propTypes = {
};
Tags.propTypes = {
+ user: UserType.isRequired,
data: PropTypes.array
}
--
cgit v1.2.3