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 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'vnext/src/components/Feeds.js') 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}
) :
; -- cgit v1.2.3