Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

mobile layout and styles for faceted filtering

Jason Kent9674e6a4bc19
diff --git a/web/css/layers.css b/web/css/layers.css
index 4c691d30a..622649d42 100644
--- a/web/css/layers.css
+++ b/web/css/layers.css
@@ -830,6 +830,16 @@
margin-right: 10px;
}
+.facet-container {
+ flex: 1;
+ max-width: 270px;
+ & .inner-container {
+ padding: 10px 8px 10px 10px;
+ margin: 3px 10px 2px 2px;
+ background-color: #333;
+ }
+}
+
@media (min-width: 1024px) {
.search-layers-container {
& div.layer-list-detail-container {
@@ -859,18 +869,19 @@
background-image: linear-gradient(360deg, #aaa, #ddd 15%);
}
.layer-list-container.search {
- height: 40%;
+ height: 35%;
}
.layer-detail-container.search {
- height: 60%;
- border-top: 5px solid #d54e21;
- padding-left: 2px;
+ height: 65%;
+ border-top: 2px solid #d54e21;
+ padding: 4px 0 0 2px;
background-image: linear-gradient(#aaa, #ddd 15%);
}
}
/* Small Desktop Styles Begin Here */
@media (max-width: 992px) {
+
/* .custom-layer-dialog {
&.browse-search-width {
width: 95%;
@@ -926,6 +937,25 @@
width: 30px;
}
}
+ .facet-container {
+ max-width: 100%;
+ display: flex;
+ flex-direction: column;
+ & .apply-facets {
+ height: 50px;
+ background: #d54f21;
+ font-size: 16px;
+ border: 1px solid #aa3c16;
+ margin: 4px auto;
+ width: 165px;
+ }
+ }
+ .layer-detail-container.search {
+ height: 65%;
+ border-top: 5px solid #d54e21;
+ padding-left: 2px;
+ background-image: linear-gradient(#aaa, #ddd 15%);
+ }
}
.search-layers-container {
@@ -1164,3 +1194,18 @@
top: 2px;
}
}
+
+@media (max-width: 768px) {
+ .facet-container .facet-wrapper {
+ margin-bottom: 12px;
+ & .facet-tooltip {
+ top: 1px;
+ height: 20px;
+ width: 16px;
+ }
+ & .facet-collapse-toggle {
+ height: 28px;
+ width: 24px;
+ }
+ }
+}
diff --git a/web/css/mobile.css b/web/css/mobile.css
index e3707a72a..0bf59c983 100644
--- a/web/css/mobile.css
+++ b/web/css/mobile.css
@@ -115,6 +115,8 @@
width: 100%;
position: relative;
left: 0;
+ height: 50px;
+ font-size: 16px;
}
#selected-category .ui-tabs-panel {
diff --git a/web/css/search-ui-override.css b/web/css/search-ui-override.css
index c5b587cd7..5451ca9bb 100644
--- a/web/css/search-ui-override.css
+++ b/web/css/search-ui-override.css
@@ -3,75 +3,86 @@
margin-top: 16px;
}
-.facet-container {
- flex-grow: 1;
- max-width: 270px;
+.facet-container .inner-container {
- & .inner-container {
- padding: 10px 8px 10px 10px;
- margin: 3px 10px 2px 2px;
- background-color: #333;
+ div.sui-layout-sidebar {
+ width: 30%;
+ }
- div.sui-layout-sidebar {
- width: 30%;
- }
+ div.sui-layout-body, div.sui-layout-header {
+ background: #333;
+ }
- div.sui-layout-body, div.sui-layout-header {
- background: #333;
- }
+ legend.sui-facet__title {
+ font-weight: 600;
+ color: #eee;
+ border-bottom: 1px solid #aaa;
+ padding-left: 18px;
+ }
- legend.sui-facet__title {
- font-weight: 600;
- color: #eee;
- border-bottom: 1px solid #aaa;
- padding-left: 18px;
- }
+ div.sui-boolean-facet,
+ a.sui-single-option-facet__link,
+ div.sui-paging-info,
+ div.sui-results-per-page__label {
+ color: #eee;
+ }
- div.sui-boolean-facet,
- a.sui-single-option-facet__link,
- div.sui-paging-info,
- div.sui-results-per-page__label {
+ .sui-multi-checkbox-facet label {
+ margin-bottom: 4px;
+ & .sui-multi-checkbox-facet__input-text {
color: #eee;
}
+ }
- .sui-multi-checkbox-facet label {
- margin-bottom: 4px;
- & .sui-multi-checkbox-facet__input-text {
- color: #eee;
- }
- }
+ span.sui-facet__count,
+ span.sui-boolean-facet__option-count,
+ span.sui-multi-checkbox-facet__option-count {
+ color: #ccc;
+ }
- span.sui-facet__count,
- span.sui-boolean-facet__option-count,
- span.sui-multi-checkbox-facet__option-count {
- color: #ccc;
+ button.sui-facet-view-more {
+ color: #a8b6fa;
+ &:hover {
+ background-color: #666;
+ outline: 4px solid #666;
+ color: #eff2ff;
}
+ }
- button.sui-facet-view-more {
- color: #a8b6fa;
- &:hover {
- background-color: #666;
- outline: 4px solid #666;
- color: #eff2ff;
- }
- }
+ div.sui-layout-body::after {
+ background: #333;
+ }
- div.sui-layout-body::after {
- background: #333;
- }
+ li.sui-result {
+ padding: 5px;
+ border: 1px solid #333;
+ background: #ccc;
+ }
- li.sui-result {
- padding: 5px;
- border: 1px solid #333;
- background: #ccc;
- }
+ ul.sui-paging .rc-pagination-item-active a {
+ color: #eee;
+ }
- ul.sui-paging .rc-pagination-item-active a {
- color: #eee;
- }
+ h1, h2, h3, h4, h5 {
+ margin: 8px 12px;
+ }
+}
- h1, h2, h3, h4, h5 {
- margin: 8px 12px;
+@media (max-width: 768px) {
+ .facet-container .inner-container {
+ & legend.sui-facet__title {
+ font-size: 14px;
+ padding: 0 0 2px 22px;
+ }
+ & .sui-multi-checkbox-facet {
+ margin: 12px 0;
+ & label {
+ font-size: 18px;
+ margin-bottom: 20px;
+ }
+ }
+ & .sui-multi-checkbox-facet__option-input-wrapper {
+ font-size: 18px;
}
}
}
diff --git a/web/js/components/layer/product-picker/header.js b/web/js/components/layer/product-picker/header.js
index be6db4710..3b31dc296 100644
--- a/web/js/components/layer/product-picker/header.js
+++ b/web/js/components/layer/product-picker/header.js
@@ -11,20 +11,15 @@ import {
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faFilter, faArrowLeft } from '@fortawesome/free-solid-svg-icons';
import { withSearch } from '@elastic/react-search-ui';
-// import LayerFilters from './layer-filters';
import {
selectLayer as selectLayerAction,
toggleCategoryMode as toggleCategoryModeAction,
toggleSearchMode as toggleSearchModeAction,
+ toggleMobileFacets as toggleMobileFacetsAction,
} from '../../../modules/product-picker/actions';
-import FilterUnavailable from './filterUnavailable';
+import { getLayersForProjection } from '../../../modules/product-picker/selectors';
-/*
- * A scrollable list of layers
- * @class LayerList
- * @extends React.Component
- */
class ProductPickerHeader extends React.Component {
constructor(props) {
super(props);
@@ -97,16 +92,19 @@ class ProductPickerHeader extends React.Component {
render() {
const {
+ category,
+ filters,
isMobile,
- selectedProjection,
+ layerCount,
mode,
- filters,
- category,
- width,
+ showMobileFacets,
+ toggleMobileFacets,
results,
searchTerm,
selectedLayer,
+ selectedProjection,
toggleSearchMode,
+ width,
} = this.props;
const isSearching = mode === 'search';
const categoryId = category && category.id;
@@ -117,6 +115,11 @@ class ProductPickerHeader extends React.Component {
const isBreadCrumb = showBackButton && !isSearching && width > 650;
const showReset = !!(filters.length || searchTerm.length);
+ const showFilterBtnMobile = mode === 'search' ? !showMobileFacets : !selectedLayer;
+ const showFilterBnDesktop = mode !== 'search' && !selectedLayer;
+ const showFilterBn = isMobile ? showFilterBtnMobile : showFilterBnDesktop;
+ const filterBtnFn = mode !== 'search' ? toggleSearchMode : toggleMobileFacets;
+
return (
<>
<InputGroup id="layer-search" className="layer-search">
@@ -133,16 +136,6 @@ class ProductPickerHeader extends React.Component {
</>
)}
- {(mode !== 'search' && !selectedLayer)
- && (
- <Button
- className="filter-button"
- onClick={toggleSearchMode}
- >
- <FontAwesomeIcon icon={faFilter} />
- </Button>
- )}
-
{showReset && (
<Button
className="clear-filters"
@@ -152,6 +145,16 @@ class ProductPickerHeader extends React.Component {
</Button>
)}
+ {showFilterBn && (
+ <Button
+ className="filter-button"
+ onClick={filterBtnFn}
+ >
+ <FontAwesomeIcon icon={faFilter} />
+ </Button>
+ )}
+
+
<Input
onChange={this.handleChange}
id="layers-search-input"
@@ -161,22 +164,13 @@ class ProductPickerHeader extends React.Component {
onFocus={(e) => this.onSearchInputFocus(e)}
/>
</InputGroup>
- {(mode === 'search' && !isMobile) && (
+
+ {mode === 'search' && (
<div className="header-filter-container">
- <div className="header-filters">
- <FilterUnavailable
- // selectedDate={selectedDate}
- filterByAvailable
- toggleFilterByAvailable={this.toggleFilterByAvailable}
- />
- </div>
<div className="results-text">
- { `Showing ${results.length} results`}
- {/* {numRowsFilteredOut > 0 && (
- <span>
- {`(${numRowsFilteredOut} hidden by filters)`}
- </span>
- )} */}
+ {results.length === layerCount
+ ? `Showing ${results.length} layers`
+ : `Showing ${results.length} out of ${layerCount}`}
</div>
</div>
)}
@@ -190,12 +184,15 @@ ProductPickerHeader.propTypes = {
clearFilters: PropTypes.func,
filters: PropTypes.array,
isMobile: PropTypes.bool,
+ layerCount: PropTypes.number,
mode: PropTypes.string,
results: PropTypes.array,
setSearchTerm: PropTypes.func,
selectedLayer: PropTypes.object,
selectedProjection: PropTypes.string,
searchTerm: PropTypes.string,
+ showMobileFacets: PropTypes.bool,
+ toggleMobileFacets: PropTypes.func,
toggleCategoryMode: PropTypes.func,
toggleSearchMode: PropTypes.func,
unselectLayer: PropTypes.func,
@@ -212,6 +209,9 @@ const mapDispatchToProps = (dispatch) => ({
toggleSearchMode: () => {
dispatch(toggleSearchModeAction());
},
+ toggleMobileFacets: () => {
+ dispatch(toggleMobileFacetsAction());
+ },
});
const mapStateToProps = (state, ownProps) => {
@@ -219,20 +219,22 @@ const mapStateToProps = (state, ownProps) => {
const {
mode,
category,
+ showMobileFacets,
selectedDate,
selectedLayer,
- filterByAvailable,
} = productPicker;
const isMobile = browser.lessThan.medium;
+ const layers = getLayersForProjection(state);
return {
+ layerCount: layers.length,
+ category,
isMobile,
+ showMobileFacets,
mode,
- category,
selectedDate,
selectedLayer,
selectedProjection: proj.id,
- filterByAvailable,
};
};
diff --git a/web/js/components/layer/product-picker/layer-filters.js b/web/js/components/layer/product-picker/layer-filters.js
deleted file mode 100644
index 3e9ac5bfd..000000000
--- a/web/js/components/layer/product-picker/layer-filters.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-import FilterUnavailable from './filterUnavailable';
-
-/*
- * A scrollable list of layers
- * @class LayerList
- * @extends React.Component
- */
-const LayerFilters = (props) => {
- const {
- selectedDate,
- filterByAvailable,
- toggleFilterByAvailable,
- } = props;
-
- return (
- <div className="layer-filters-container">
- <div className="filter-controls">
- <h3>Filters</h3>
- <FilterUnavailable
- selectedDate={selectedDate}
- filterByAvailable={filterByAvailable}
- toggleFilterByAvailable={toggleFilterByAvailable}
- />
- </div>
- </div>
- );
-};
-
-LayerFilters.propTypes = {
- filterByAvailable: PropTypes.bool,
- selectedDate: PropTypes.object,
- toggleFilterByAvailable: PropTypes.func,
-};
-
-export default LayerFilters;
diff --git a/web/js/components/layer/product-picker/product-picker.js b/web/js/components/layer/product-picker/product-picker.js
index da7daedf8..6949431e7 100644
--- a/web/js/components/layer/product-picker/product-picker.js
+++ b/web/js/components/layer/product-picker/product-picker.js
@@ -74,10 +74,10 @@ class ProductPicker extends React.Component {
const { screenHeight } = browser;
const dialogMargin = 12;
const tabOffset = mode === 'category' || category === 'featured' ? 38 : 0;
- let headerHeight = mode === 'search' ? 70 : 48;
+ const headerHeight = mode === 'search' ? 70 : 48;
let bodyHeight = screenHeight - headerHeight - tabOffset - 100 - dialogMargin;
+
if (browser.lessThan.medium) {
- headerHeight = 48;
bodyHeight = screenHeight - headerHeight - tabOffset;
}
diff --git a/web/js/components/layer/product-picker/search/search-layers-list.js b/web/js/components/layer/product-picker/search/search-layers-list.js
index bcf53f7f4..6de963501 100644
--- a/web/js/components/layer/product-picker/search/search-layers-list.js
+++ b/web/js/components/layer/product-picker/search/search-layers-list.js
@@ -132,16 +132,6 @@ class SearchLayerList extends React.Component {
<div className="no-results">
<FontAwesomeIcon icon={faMeteor} size="5x" />
<h3> No layers found! </h3>
- {/* {numRowsFilteredOut > 0 && (
- <p>
- {`${numRowsFilteredOut} result(s) are being filtered out.`}
- <a
- className="remove-filters"
- >
- Remove filters?
- </a>
- </p>
- )} */}
</div>
)
: (
diff --git a/web/js/components/layer/product-picker/search/search-layers.js b/web/js/components/layer/product-picker/search/search-layers.js
index 6fe602091..474599d2a 100644
--- a/web/js/components/layer/product-picker/search/search-layers.js
+++ b/web/js/components/layer/product-picker/search/search-layers.js
@@ -1,6 +1,7 @@
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
+import { Button } from 'reactstrap';
import { withSearch } from '@elastic/react-search-ui';
import SearchLayerList from './search-layers-list';
import ProductFacet from './product-facet';
@@ -8,27 +9,35 @@ import Scrollbars from '../../../util/scrollbar';
import LayerMetadataDetail from './layer-metadata-detail';
import {
updateListScrollTop,
+ toggleMobileFacets as toggleMobileFacetsAction,
} from '../../../../modules/product-picker/actions';
import facetConfig from '../../../../modules/product-picker/facetConfig';
function SearchLayers(props) {
const {
+ isMobile,
browser,
selectedLayer,
bodyHeight,
facets,
+ showMobileFacets,
+ toggleMobileFacets,
} = props;
const listDetailContainerClass = selectedLayer
? 'layer-list-detail-container show-details'
: 'layer-list-detail-container';
+ const showFacets = browser.greaterThan.small || showMobileFacets;
+ const showListAndDetails = isMobile ? !showFacets : true;
+ const facetHeight = isMobile ? 'calc(100vh - 125px)' : '100%';
+
return (
- <div className="search-layers-container" style={{ maxHeight: bodyHeight }}>
+ <div className="search-layers-container" style={{ height: bodyHeight }}>
- {browser.greaterThan.small && (
+ {showFacets && (
<div className="facet-container">
- <Scrollbars style={{ height: '100%' }}>
+ <Scrollbars style={{ height: facetHeight }}>
<div className="inner-container">
{facetConfig.map((config) => {
const facet = facets[config.field];
@@ -46,26 +55,39 @@ function SearchLayers(props) {
})}
</div>
</Scrollbars>
+
+ {isMobile && showMobileFacets && (
+ <Button
+ className="apply-facets"
+ onClick={toggleMobileFacets}
+ >
+ Apply
+ </Button>
+ )}
</div>
)}
- <div className={listDetailContainerClass}>
- <div className="layer-list-container search">
- <Scrollbars style={{ height: '100%' }}>
- <SearchLayerList />
- </Scrollbars>
- </div>
+ {showListAndDetails && (
+ <div className={listDetailContainerClass}>
- { !selectedLayer && browser.lessThan.large ? null : (
- <div className="layer-detail-container layers-all search">
+ <div className="layer-list-container search">
<Scrollbars style={{ height: '100%' }}>
- <LayerMetadataDetail />
+ <SearchLayerList />
</Scrollbars>
</div>
- )}
- </div>
+ { !selectedLayer && browser.lessThan.large ? null : (
+ <div className="layer-detail-container layers-all search">
+ <Scrollbars style={{ height: '100%' }}>
+ <LayerMetadataDetail />
+ </Scrollbars>
+ </div>
+ )}
+
+ </div>
+ )}
+
</div>
);
}
@@ -74,21 +96,28 @@ SearchLayers.propTypes = {
browser: PropTypes.object,
bodyHeight: PropTypes.number,
facets: PropTypes.object,
+ isMobile: PropTypes.bool,
selectedLayer: PropTypes.object,
+ showMobileFacets: PropTypes.bool,
+ toggleMobileFacets: PropTypes.func,
};
const mapDispatchToProps = (dispatch) => ({
updateScrollPosition: (scrollTop) => {
dispatch(updateListScrollTop(scrollTop));
},
+ toggleMobileFacets: () => {
+ dispatch(toggleMobileFacetsAction());
+ },
});
function mapStateToProps(state, ownProps) {
const { browser, productPicker } = state;
- const { numRowsFilteredOut, selectedLayer } = productPicker;
+ const { selectedLayer, showMobileFacets } = productPicker;
return {
- numRowsFilteredOut,
+ isMobile: browser.lessThan.medium,
+ showMobileFacets,
selectedLayer,
browser,
};
diff --git a/web/js/modules/product-picker/actions.js b/web/js/modules/product-picker/actions.js
index 143f09e95..ccea3915e 100644
--- a/web/js/modules/product-picker/actions.js
+++ b/web/js/modules/product-picker/actions.js
@@ -10,6 +10,7 @@ import {
TOGGLE_FEATURED_TAB,
TOGGLE_SEARCH_MODE,
TOGGLE_CATEGORY_MODE,
+ TOGGLE_MOBILE_FACETS,
UPDATE_LIST_SCROLL_TOP,
RESET_STATE,
} from './constants';
@@ -77,6 +78,11 @@ export function toggleCategoryMode() {
type: TOGGLE_CATEGORY_MODE,
};
}
+export function toggleMobileFacets() {
+ return {
+ type: TOGGLE_MOBILE_FACETS,
+ };
+}
export function updateListScrollTop(value) {
return {
type: UPDATE_LIST_SCROLL_TOP,
diff --git a/web/js/modules/product-picker/constants.js b/web/js/modules/product-picker/constants.js
index b9d7e2856..8a9d2a581 100644
--- a/web/js/modules/product-picker/constants.js
+++ b/web/js/modules/product-picker/constants.js
@@ -8,5 +8,6 @@ export const SHOW_MEASUREMENTS = 'PRODUCT_PICKER/SHOW_MEASUREMENTS';
export const TOGGLE_SEARCH_MODE = 'PRODUCT_PICKER/TOGGLE_SEARCH_MODE';
export const TOGGLE_CATEGORY_MODE = 'PRODUCT_PICKER/TOGGLE_CATEGORY_MODE';
export const TOGGLE_FEATURED_TAB = 'PRODUCT_PICKER/TOGGLE_FEATURED_TAB';
+export const TOGGLE_MOBILE_FACETS = 'PRODUCT_PICKE/TOGGLE_MOBILE_FACETS';
export const UPDATE_LIST_SCROLL_TOP = 'PRODUCT_PICKER/UPDATE_LIST_SCROLL_TOP';
export const RESET_STATE = 'PRODUCT_PICKER/RESET_STATE';
diff --git a/web/js/modules/product-picker/facetConfig.js b/web/js/modules/product-picker/facetConfig.js
index 98f9c04f2..42faa4684 100644
--- a/web/js/modules/product-picker/facetConfig.js
+++ b/web/js/modules/product-picker/facetConfig.js
@@ -1,4 +1,9 @@
const facetConfig = [
+ // {
+ // field: 'available',
+ // label: 'Available',
+ // tooltip: 'Layer has available imagery at currently selected date/time',
+ // },
{
field: 'categories',
label: 'Category',
@@ -24,11 +29,6 @@ const facetConfig = [
tooltip: 'Temporal Resolution',
hideZeroCount: true,
},
- {
- field: 'active',
- label: 'Currently Active?',
- tooltip: 'Is this layer derived from a currently ongoing mission?',
- },
{
field: 'track',
label: 'Track Asc/Desc',
@@ -42,7 +42,7 @@ const facetConfig = [
{
field: 'processingLevelId',
label: 'Processing Level',
- tooltip: 'Level of data processing. <a href="https://earthdata.nasa.gov/collaborate/open-data-services-and-software/data-information-policy/data-levels" target="_blank"> Read more. </a> ',
+ tooltip: 'Level of data processing. For more information see: https://earthdata.nasa.gov/collaborate/open-data-services-and-software/data-information-policy/data-levels',
show: 15,
hideZeroCount: true,
},
diff --git a/web/js/modules/product-picker/reducers.js b/web/js/modules/product-picker/reducers.js
index 042b5fed7..7d6526c6c 100644
--- a/web/js/modules/product-picker/reducers.js
+++ b/web/js/modules/product-picker/reducers.js
@@ -10,6 +10,7 @@ import {
TOGGLE_FEATURED_TAB,
TOGGLE_SEARCH_MODE,
TOGGLE_CATEGORY_MODE,
+ TOGGLE_MOBILE_FACETS,
UPDATE_LIST_SCROLL_TOP,
RESET_STATE,
INIT_SEARCH_STATE,
@@ -21,14 +22,12 @@ export const productPickerState = {
category: undefined,
categoryType: 'hazards and disasters',
filters: [],
+ showMobileFacets: true,
searchTerm: '',
selectedLayer: undefined,
selectedMeasurement: undefined,
selectedMeasurementSourceIndex: 0,
searchConfig: undefined,
- // searchResultRows: undefined,
- // numRowsFilteredOut: undefined,
- // filterByAvailable: true,
// listScrollTop: 0,
};
@@ -114,6 +113,7 @@ export function productPickerReducer(state = productPickerState, action) {
...state,
mode: 'search',
selectedLayer: null,
+ showMobileFacets: true,
};
}
@@ -135,6 +135,14 @@ export function productPickerReducer(state = productPickerState, action) {
return {
...state,
mode: 'category',
+ selectedLayer: null,
+ };
+ }
+
+ case TOGGLE_MOBILE_FACETS: {
+ return {
+ ...state,
+ showMobileFacets: !state.showMobileFacets,
};
}
@@ -162,6 +170,7 @@ export function productPickerReducer(state = productPickerState, action) {
mode: prevMode === 'search' ? prevMode : modeForProj,
filters: [],
searchTerm: '',
+ selectedLayer: null,
};
return { ...state, ...newState };
}
diff --git a/web/js/modules/product-picker/selectors.js b/web/js/modules/product-picker/selectors.js
index 716c39759..c2b1a1b0f 100644
--- a/web/js/modules/product-picker/selectors.js
+++ b/web/js/modules/product-picker/selectors.js
@@ -19,7 +19,7 @@ const getProductPicker = ({ productPicker }) => productPicker;
const getFilters = ({ productPicker }) => productPicker.filters;
const getSearchTerm = ({ productPicker }) => productPicker.searchTerm;
-const getLayersForProjection = createSelector(
+export const getLayersForProjection = createSelector(
[getConfig, getProjection],
(config, projection) => {
const filteredRows = buildLayerFacetProps(config)