Changeset 5024 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/content-none/index.jsx
- Timestamp:
- 03/01/2017 06:08:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/content-none/index.jsx
r4223 r5024 1 import React from 'react'; 1 /** 2 * External dependencies. 3 */ 4 import React, { PropTypes } from 'react'; 5 import { connect } from 'react-redux'; 6 import { identity } from 'lodash'; 7 import { localize } from 'i18n-calypso'; 2 8 3 9 /** 4 10 * Internal dependencies. 5 11 */ 12 import { getParams, getPath } from 'state/selectors'; 6 13 import SearchForm from 'components/search-form'; 7 14 8 export default React.createClass({9 displayName: 'ContentNone',15 export const ContentNone = ( { params, path, translate } ) => { 16 let helpText, userHelp; 10 17 11 render() { 12 let helpText, userHelp; 18 if ( -1 !== path.indexOf( 'search' ) ) { 19 helpText = ( 20 <div className="page-content"> 21 <p>{ translate( 'Sorry, but nothing matched your search terms.' ) }</p> 22 <p>{ translate( 'Please try again with some different keywords.' ) }</p> 23 <SearchForm /> 24 </div> 25 ); 26 } else if ( -1 !== path.indexOf( 'browse/favorites' ) ) { 27 if ( pluginDirectory.userId > 0 ) { 28 helpText = <p>{ translate( 'No favorites have been added, yet.' ) }</p>; 13 29 14 if ( -1 !== this.props.location.pathname.indexOf( 'search' ) ) { 15 helpText = ( 16 <div className="page-content"> 17 <p>Sorry, but nothing matched your search terms.</p> 18 <p>Please try again with some different keywords.</p> 19 <SearchForm searchTerm={ this.props.params.searchTerm } /> 20 </div> 21 ); 22 23 } else if ( -1 !== this.props.location.pathname.indexOf( 'browse/favorites' ) ) { 24 if ( true /*user_logged_in*/ ) { 25 helpText = <p>No favorites have been added, yet.</p>; 26 27 if ( -1 !== this.props.location.pathname.indexOf( 'browse/favorites/' + this.props.params.username ) ) { 28 userHelp = ( 29 <div> 30 <p>Find a plugin and mark it as a favorite to see it here.</p> 31 <p>Your favorite plugins are also shared on <a href={ 'https://profile.wordpress.org/' + this.props.params.username }>your profile</a></p> 32 </div> 33 ); 34 } 35 36 helpText = <div className="page-content">{ helpText }{ userHelp }</div>; 37 } else { 38 helpText = ( 39 <div className="page-content"> 40 <p><a href="https://login.wordpress.org/">Loginto WordPress.org</a> to mark plugins as favorites.</p> 30 if ( -1 !== path.indexOf( 'browse/favorites/' + params.username ) ) { 31 userHelp = ( 32 <div> 33 <p>{ translate( 'Find a plugin and mark it as a favorite to see it here.' ) }</p> 34 <p> 35 { translate( 'Your favorite plugins are also shared on {{a}}your profile{{/a}}', { 36 components: { a: <a href={ 'https://profile.wordpress.org/' + params.username } /> }, 37 } ) } 38 </p> 41 39 </div> 42 40 ); 43 41 } 42 43 helpText = <div className="page-content">{ helpText }{ userHelp }</div>; 44 44 } else { 45 45 helpText = ( 46 46 <div className="page-content"> 47 <p>It seems we can’t find what you’re looking for. Perhaps searching can help.</p> 47 <p> 48 { translate( '{{a}}Log into WordPress.org{{/a}} to mark plugins as favorites.', { 49 components: { a: <a href="https://login.wordpress.org/" /> }, 50 } ) } 51 </p> 48 52 </div> 49 53 ); 54 } 55 } else { 56 helpText = ( 57 <div className="page-content"> 58 <div className="page-content"> 59 <p> 60 { translate( 61 'It seems we can’t find what you’re looking for. Perhaps searching can help.' 62 ) } 63 </p> 64 </div> 65 <SearchForm /> 66 </div> 67 ); 68 } 50 69 51 helpText = ( 52 <div className="page-content"> 53 { helpText } 54 <SearchForm searchTerm={ this.props.params.searchTerm } /> 55 </div> 56 ); 70 return ( 71 <section className="no-results not-found"> 72 <header className="page-header"> 73 <h1 className="page-title">{ translate( 'Nothing Found' ) }</h1> 74 </header> 75 { helpText } 76 </section> 77 ); 78 }; 57 79 58 } 80 ContentNone.propTypes = { 81 params: PropTypes.object, 82 path: PropTypes.string, 83 translate: PropTypes.func, 84 }; 59 85 60 return ( 61 <section className="no-results not-found"> 62 <header className="page-header"> 63 <h1 className="page-title">Nothing Found</h1> 64 </header> 65 { helpText } 66 </section> 67 ) 68 } 69 } ); 86 ContentNone.defaultProps = { 87 params: {}, 88 path: '', 89 translate: identity, 90 }; 91 92 export default connect( 93 ( state ) => ( { 94 params: getParams( state ), 95 path: getPath( state ), 96 } ), 97 )( localize( ContentNone ) );
Note: See TracChangeset
for help on using the changeset viewer.