diff --git a/src/components/sidebar.js b/src/components/sidebar.js
index 3d61b040..4fd4e2d0 100644
--- a/src/components/sidebar.js
+++ b/src/components/sidebar.js
@@ -23,6 +23,7 @@ import createSelector from '../selectors/createSelector';
import currentUserSelector from '../selectors/currentUser';
import SidebarMenu from './sidebar-menu';
+import TagsInform from './tags-inform';
class Sidebar extends React.Component {
static propTypes = {
@@ -56,6 +57,7 @@ class Sidebar extends React.Component {
return (
+
);
}
diff --git a/src/components/tags-inform/index.js b/src/components/tags-inform/index.js
new file mode 100644
index 00000000..d8149de3
--- /dev/null
+++ b/src/components/tags-inform/index.js
@@ -0,0 +1,83 @@
+/*
+ This file is a part of libertysoil.org website
+ Copyright (C) 2016 Loki Education (Social Enterprise)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+import React, { PropTypes } from 'react';
+import { omit } from 'lodash';
+
+import TagsInformNormal from './normal';
+
+/**
+ * Navigation-like block displaying number of unread posts
+ * per each group of tags (geotags, schools, hashtags)
+ */
+export default class TagsInform extends React.Component {
+ static propTypes = {
+ theme: PropTypes.string
+ };
+
+ static defaultProps = {
+ theme: 'normal'
+ };
+
+ /**
+ * An example of result:
+ {
+ className: 'navigation-item--color_green',
+ list: values(current_user.followed_geotags) || [],
+ icon: { icon: 'place', className: 'navigation-item__icon--remind_green' },
+ unreadPosts: 44,
+ url: '/geo/'
+ }
+ */
+ getUserPostTags = () => {
+ const { current_user } = this.props;
+
+ return {
+ geotags: {
+ className: 'navigation-item--color_green',
+ list: current_user.get('followed_geotags').toList(),
+ icon: { icon: 'place' },
+ url: '/geo/'
+ },
+ hashtags: {
+ className: 'navigation-item--color_blue',
+ list: current_user.get('followed_hashtags').toList(),
+ icon: { icon: 'hashtag' },
+ url: '/tag/'
+ },
+ schools: {
+ className: 'navigation-item--color_red',
+ list: current_user.get('followed_schools').toList(),
+ icon: { icon: 'school' },
+ url: '/s/'
+ }
+ };
+ }
+
+ render() {
+ const tags = this.getUserPostTags();
+ const childrenProps = {
+ tags,
+ ...omit(this.props, ['current_user', 'theme'])
+ };
+
+ switch (this.props.theme) {
+ case 'normal':
+ default: return ;
+ }
+ }
+}
diff --git a/src/components/tags-inform/normal.js b/src/components/tags-inform/normal.js
new file mode 100644
index 00000000..831f083d
--- /dev/null
+++ b/src/components/tags-inform/normal.js
@@ -0,0 +1,55 @@
+/*
+ This file is a part of libertysoil.org website
+ Copyright (C) 2016 Loki Education (Social Enterprise)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+import React from 'react';
+import { transform } from 'lodash';
+import { Map as ImmutableMap } from 'immutable';
+
+import Navigation from '../navigation';
+import NavigationItem from '../navigation-item';
+import TagCloud from '../tag-cloud';
+
+const TagsInformNormal = ({ tags, ...props }) => (
+
+ {transform(tags, (acc, tagType, tagTypeTitle) => {
+ if (tagType.list.size) {
+ let unread = tagType.unreadPosts;
+ if (tagType.unreadPosts > 99) {
+ unread = '99+';
+ }
+
+ acc.push(
+
+
+
+ );
+ }
+ }, [])}
+
+);
+
+export default TagsInformNormal;