Making WordPress.org


Ignore:
Timestamp:
03/01/2017 06:08:54 PM (8 years ago)
Author:
obenland
Message:

Plugin Directory: Update React client with latest changes.

This is largely a cleanup commit with some WIP around switching to node-wpapi.

File:
1 edited

Legend:

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

    r4409 r5024  
     1/**
     2 * External dependencies.
     3 */
    14import React from 'react';
    25import { render } from 'react-dom';
     6import { Provider } from 'react-redux';
     7import { setLocale } from 'i18n-calypso';
    38
    4 import Screenshots from 'components/plugin/sections/screenshots';
     9/**
     10 * Internal dependencies.
     11 */
     12import Router from 'modules/router';
     13import getStore from 'modules/store';
    514
    6 // Temporary hack to use the srceenshot viewer without the full React client
    7 var elements = document.querySelectorAll( '#screenshots figure' );
    8 var images = [];
    9 for ( var i=0; i < elements.length; i++ ) {
    10     var caption = elements[i].querySelector('figcaption');
    11     var item = {
    12         src: elements[i].querySelector('img.screenshot').src,
    13         caption: caption ? caption.textContent : '',
    14     }
    15     images.push( item );
    16 }
     15//setLocale( localeData );
    1716
    18 if ( images.length > 0 ) {
    19     render(
    20         <Screenshots screenshots={images}>
    21         </Screenshots>,
    22         document.getElementById( 'screenshots' )
    23     );
    24 }
     17render(
     18    <Provider store={ getStore() }>
     19        { Router }
     20    </Provider>,
     21    document.getElementById( 'content' )
     22);
Note: See TracChangeset for help on using the changeset viewer.