/*
 This file is a part of libertysoil.org website
 Copyright (C) 2015  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 <http://www.gnu.org/licenses/>.
 */
import React, { Component } from 'react';
import { connect } from 'react-redux';

import ApiClient from '../api/client'
import { API_HOST } from '../config';
import { getStore, setTagPosts } from '../store';

import Header from '../components/header';
import Footer from '../components/footer';
import Sidebar from '../components/sidebar';
import TagCloud from '../components/tag-cloud';
import {  } from '../triggers';
import { defaultSelector } from '../selectors';

let SidebarTagCloud = ({ tags, title, ...props }) => {
  if (tags.length == 0) {
    return <script/>;
  }

  return (
    <div {...props}>
      <div className="layout__row">
        <h4 className="head head-sub">{title}</h4>
      </div>
      <div className="layout__row">
        <TagCloud tags={tags}/>
      </div>
    </div>
  );
};

class TagCloudPage extends Component {
  static displayName = 'TagCloudPage'

  render() {
    const {
      is_logged_in,
      current_user
    } = this.props;
    const tags = [

    ];

    return (
      <div>
        <Header is_logged_in={is_logged_in} current_user={current_user} />

        <div className="page__container">
          <div className="page__body">
            <Sidebar current_user={current_user} />
            <div className="page__body_content">
              <div className="page__content page__content-spacing">
                <div className="layout__row">
                  <div className="head">Tags cloud</div>
                </div>
                <div className="layout__row">
                  <TagCloud tags={this.props.current_user_tags}/>
                </div>
              </div>
            </div>
          </div>
        </div>

        <Footer/>
      </div>
    )
  }
}

export default connect(defaultSelector)(TagCloudPage);

@@ -834,46 +834,8 @@
 ';%0A%0A
-import ApiClient from '../api/client'%0A
 impo
@@ -889,21 +889,8 @@
 tore
-, setTagPosts
  %7D f
@@ -1094,16 +1094,28 @@
 mport %7B 
+loadTagCloud
  %7D from 
@@ -1597,16 +1597,162 @@
 dPage'%0A%0A
+  static async fetchData(params, state, client) %7B%0A    try %7B%0A      await loadTagCloud();%0A    %7D catch (e) %7B%0A      console.log(e.stack);%0A    %7D%0A%0A  %7D%0A%0A
   render
@@ -1830,35 +1830,8 @@
 ops;
-%0A    const tags = %5B%0A%0A    %5D;
 %0A%0A  
@@ -2268,17 +2268,16 @@
 ead%22%3ETag
-s
  cloud%3C/
@@ -2399,25 +2399,17 @@
 ops.
-current_user_tags
+tag_cloud
 %7D/%3E%0A

Add fetchData to TagCloudPage