WordPress.org

Making WordPress.org


Ignore:
Timestamp:
07/24/2016 09:40:56 PM (3 years ago)
Author:
obenland
Message:

Plugin Directory: WordCamp Boston Contributor Day updates.

  • Separate store creation.
  • Pass SiteHeader component to React Router for navigation links to rerender.
  • Pass default plugins from container component to PluginSection.
  • Basic 404 and no-content handling.

Props sirbrillig.
See #1719.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/router.jsx

    r3716 r3717  
     1/* global add_data:object */
    12import React from 'react';
    23import { connect } from 'react-redux';
    3 import { Route, IndexRoute } from 'react-router';
     4import { Router, Route, IndexRoute, useRouterHistory } from 'react-router';
     5import createBrowserHistory from 'history/lib/createBrowserHistory';
    46
    57/**
     
    911import FrontPage from 'components/front-page';
    1012import PluginDirectory from 'components/plugin-directory';
     13import SiteHeader from 'components/site-header';
     14import SiteMain from 'components/site-main';
    1115import ArchiveBrowse from 'components/archive-browse';
     16import NotFound from 'components/404';
     17
     18const history = useRouterHistory( createBrowserHistory )( {
     19    basename: app_data.base
     20} );
    1221
    1322export default (
    14     <Route path="/" component={ PluginDirectory } >
    15         <IndexRoute component={ FrontPage } />
    16         <Route path="browse/favorites/:username" component={ ArchiveBrowse } />
    17         <Route path="browse/:type" component={ ArchiveBrowse } />
    18         <Route path="developers" component={ Page } />
    19         <Route path=":plugin" component={ FrontPage } />
    20         <Route path="search/:searchTerm" component={ FrontPage } />
    21     </Route>
     23    <Router history={ history }>
     24        <Route name="root" component={ PluginDirectory }>
     25            <Route path="/" components={ { header: SiteHeader, main: SiteMain } }>
     26                <IndexRoute component={ FrontPage } />
     27                <Route path="browse/favorites/:username" component={ ArchiveBrowse } />
     28                <Route path="browse/:type" component={ ArchiveBrowse } />
     29                <Route path="developers" component={ Page } />
     30                <Route path=":plugin" component={ FrontPage } />
     31                <Route path="search/:searchTerm" component={ FrontPage } />
     32                <Route path="*" component={ NotFound } />
     33            </Route>
     34        </Route>
     35    </Router>
    2236);
Note: See TracChangeset for help on using the changeset viewer.