@@ -6,6 +6,7 @@ var PlanetNavigator = React.createClass({
66 name : React . PropTypes . string ,
77 Users : React . PropTypes . array
88 } ) ,
9+ search : React . PropTypes . string ,
910 openLaunchModal : React . PropTypes . func ,
1011 openAddUserModal : React . PropTypes . func ,
1112 showAll : React . PropTypes . func ,
@@ -30,19 +31,29 @@ var PlanetNavigator = React.createClass({
3031 )
3132 } )
3233
34+ var keywords = this . props . search . split ( ' ' )
35+ var usingSnippetFilter = keywords . some ( function ( keyword ) {
36+ if ( keyword === '$s' ) return true
37+ return false
38+ } )
39+ var usingBlueprintFilter = keywords . some ( function ( keyword ) {
40+ if ( keyword === '$b' ) return true
41+ return false
42+ } )
43+
3344 return (
3445 < div className = 'PlanetNavigator' >
3546 < button onClick = { this . props . openLaunchModal } className = 'launchButton btn-primary btn-block' >
3647 < i className = 'fa fa-rocket fa-fw' /> Launch
3748 </ button >
3849 < nav >
39- < a onClick = { this . props . showAll } >
50+ < a className = { usingSnippetFilter === usingBlueprintFilter ? 'active' : '' } onClick = { this . props . showAll } >
4051 < i className = 'fa fa-home fa-fw' /> Home
4152 </ a >
42- < a onClick = { this . props . showOnlySnippets } >
53+ < a className = { usingSnippetFilter && ! usingBlueprintFilter ? 'active' : '' } onClick = { this . props . showOnlySnippets } >
4354 < i className = 'fa fa-code fa-fw' /> Snippets
4455 </ a >
45- < a onClick = { this . props . showOnlyBlueprints } >
56+ < a className = { ! usingSnippetFilter && usingBlueprintFilter ? 'active' : '' } onClick = { this . props . showOnlyBlueprints } >
4657 < i className = 'fa fa-file-text-o fa-fw' /> Blueprints
4758 </ a >
4859 </ nav >
0 commit comments