// import logo from './logo.svg';
import './App.css';
import React from 'react';
import { Router, Route, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import { store } from './components/redux/index';
import createHistory from "history/createBrowserHistory";

// импорт страниц
import { CUser } from './components/user';
import { ReduxFeed } from './components/feed';
import { CComments } from './components/post';
import { CreatePost } from './components/create_post';
import Authorization from './components/auth_reg';
import Header from './components/structure/header';
import Footer from './components/structure/footer';

// url проекта
export const url = 'http://hipstagram.node.ed.asmer.org.ua/graphql'


const history = createHistory()

// const Autorization = () =>
//     <div>
//         Авторизация
//     </div>

const Registration = () =>
    <div>
        Регистрация
    </div>

const PageAbout = () =>
    <div>
        Страница "О нас"
    </div>

const Page404 = () =>
    <div>
        NOT FOUND
    </div>


function App() {
    return (
        <Provider store={store}>
            <Router history={history}>
                <div className="wrapper">
                    <Header />
                    <main style={{ flexGrow: '1' }}>
                        <Switch>
                            {/* <Route path="/" component={ReduxFeed} exact /> */}
                            <Route path="/feed" component={ReduxFeed} />
                            <Route path="/authorization" component={Authorization} />
                            <Route path="/registration" component={Registration} />
                            <Route path="/post/:postId" component={CComments} />
                            <Route path="/user/:userId" component={CUser} />
                            <Route path="/createpost" component={CreatePost} />
                            {/* <Route path="/about" component={PageAbout} /> */}
                            <Route path="*" component={Page404} />
                            {/* <Page404 /> - это аналог записи выше */}
                        </Switch>
                    </main>
                    <Footer />
                </div>
            </Router >
        </Provider >
    );
}

export default App;


//прописывание редиректа
//<Redirect from='/direct' to='/profile' />
