Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Add date spans to disabled layer titles #1324

Benjamin Kingc74444c456c0
diff --git a/web/css/sidebar-panel.css b/web/css/sidebar-panel.css
index f22834e59..7964858d0 100644
--- a/web/css/sidebar-panel.css
+++ b/web/css/sidebar-panel.css
@@ -277,34 +277,6 @@ li.item.productsitem.inmotion,
.productsitem .hdanchor:hover .layer-eye-icon {
color: #000;
}
-.productsitem.disabled .hdanchor {
- pointer-events: none;
-}
-
-/* .productsitem a.hdanchor.hideReg i {
- width: 21px;
- height: 12px;
- background: url("../images/wv.layers/show-hide.png?v=@BUILD_NONCE@") no-repeat
- 0 0 transparent;
- position: absolute;
- top: 50%;
- margin-top: -6px;
- left: 50%;
- margin-left: -10.5px;
- pointer-events: none;
-}
-
-.productsitem.layer-visible a.hdanchor.hideReg i {
- background-position: 0 0;
-}
-
-.productsitem.layer-hidden a.hdanchor.hideReg i {
- background-position: -42px 0;
-}
-
-.productsitem.layer-hidden a.hdanchor.hideReg:hover i {
- background-position: -63px 0;
-} */
.productsitem a.wv-layers-info,
.productsitem a.wv-layers-options {
@@ -472,23 +444,11 @@ i.wv-layers-options-icon {
border-color: transparent;
}
-/* .sidebar-panel li.item.productsitem .layer-main:hover a.hdanchor i {
- background-position: 5px -36px;
-} */
-
-/* .disabled.layer-hidden a.hdanchor.hideReg i {
- width: 15px;
- height: 15px;
- margin-top: -7.5px;
- margin-left: -7.5px;
- background-position: 0 -54px;
-} */
-
-/* .disabled.layer-hidden a.hdanchor:hover {
+.disabled.layer-hidden a.hdanchor:hover {
background: rgba(255, 255, 255, 0.2);
cursor: default;
}
.productsitem.disabled.layer-hidden a.hdanchor:hover i {
- background-position: 0 -54px;
-} */
+ color: #c5c5c8;
+}
diff --git a/web/js/components/sidebar/products/layer.js b/web/js/components/sidebar/products/layer.js
index dc4398ff4..32791a8f1 100644
--- a/web/js/components/sidebar/products/layer.js
+++ b/web/js/components/sidebar/products/layer.js
@@ -69,7 +69,41 @@ class Layer extends React.Component {
);
}
}
-
+ getDisabledTitle(layer) {
+ var startDate, endDate;
+ if (layer.startDate && layer.endDate) {
+ startDate = util.parseDate(layer.startDate);
+ endDate = util.parseDate(layer.endDate);
+ if (layer.period !== 'subdaily') {
+ startDate =
+ startDate.getDate() +
+ ' ' +
+ util.giveMonth(startDate) +
+ ' ' +
+ startDate.getFullYear();
+ endDate =
+ endDate.getDate() +
+ ' ' +
+ util.giveMonth(endDate) +
+ ' ' +
+ endDate.getFullYear();
+ }
+ return 'Data available between ' + startDate + ' - ' + endDate;
+ } else if (layer.startDate) {
+ startDate = util.parseDate(layer.startDate);
+ if (layer.period !== 'subdaily') {
+ startDate =
+ startDate.getDate() +
+ ' ' +
+ util.giveMonth(startDate) +
+ ' ' +
+ startDate.getFullYear();
+ }
+ return 'Data available between ' + startDate + ' - Present';
+ } else {
+ return 'No data on selected date for this layer';
+ }
+ }
onLayerHover() {}
getPalette() {}
render() {
@@ -84,6 +118,7 @@ class Layer extends React.Component {
isMobile,
index
} = this.props;
+
return (
<Draggable
draggableId={util.encodeId(layer.id) + '-' + layerGroupName}
@@ -127,7 +162,7 @@ class Layer extends React.Component {
!isVisible && !isDisabled
? 'Show Layer'
: isDisabled
- ? 'No data on selected date for this layer'
+ ? this.getDisabledTitle(layer)
: 'Hide Layer'
}
>