Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Apply onClick responses to Info buttons #1553

Benjamin King26b9af2e6e05
diff --git a/web/css/list.css b/web/css/list.css
index 202e91c75..e3728b653 100644
--- a/web/css/list.css
+++ b/web/css/list.css
@@ -12,7 +12,7 @@
color: #282828;
}
.list-group-item i {
- margin-right: 4px;
+ margin-right: 6px;
line-height: 1.5;
}
button.list-group-item {
diff --git a/web/js/components/util/list.js b/web/js/components/util/list.js
index 1f3cde8f3..4bf9d53b8 100644
--- a/web/js/components/util/list.js
+++ b/web/js/components/util/list.js
@@ -20,11 +20,13 @@ export default class List extends React.Component {
item.key && disabled ? item.key === disabled : false;
const badge = item.badge;
const className = item.className ? item.className : '';
+ const tagType = item.href ? 'a' : 'button';
return (
<ListGroupItem
- tag="button"
+ tag={tagType}
active={isActive}
className={className + ' ' + size + '-item'}
+ href={item.href ? item.href : 'false'}
onClick={
item.onClick
? item.onClick
diff --git a/web/js/containers/info.js b/web/js/containers/info.js
index 7804389ef..8ccdcff54 100644
--- a/web/js/containers/info.js
+++ b/web/js/containers/info.js
@@ -1,57 +1,81 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
-import { openCustomContent } from '../modules/modal/actions';
+import { requestLoadedPage, renderTemplate } from '../modules/modal/actions';
import IconList from '../components/util/list';
-
-const infoArray = [
- {
- text: 'Send feedback',
- iconClass: 'ui-icon fa fa-envelope fa-fw',
- id: 'send_feedback_info_item'
- },
- {
- text: 'Start Tour',
- iconClass: 'ui-icon fa fa-truck fa-fw',
- id: 'start_tour_info_item'
- },
- {
- text: 'Source Code',
- iconClass: 'ui-icon fa fa-code fa-fw',
- id: 'source_code_info_item'
- },
- {
- text: 'Whats new',
- iconClass: 'ui-icon fa fa-flag fa-fw',
- id: 'source_code_info_item'
- },
- {
- text: 'Notifications',
- iconClass: 'ui-icon fa fa-file fa-fw',
- id: 'source_code_info_item'
- }
-];
+import { onClickFeedback } from '../modules/feedback/util';
+import { initFeedback } from '../modules/feedback/actions';
+import util from '../util/util';
class InfoList extends Component {
render() {
+ const { sendFeedback, feedbackIsInitiated, aboutClick } = this.props;
+ const infoArray = [
+ {
+ text: 'Send feedback',
+ iconClass: 'ui-icon fa fa-envelope fa-fw',
+ id: 'send_feedback_info_item',
+ onClick: () => {
+ sendFeedback(feedbackIsInitiated);
+ }
+ },
+ {
+ text: 'Start Tour',
+ iconClass: 'ui-icon fa fa-truck fa-fw',
+ id: 'start_tour_info_item'
+ },
+ {
+ text: 'Source Code',
+ iconClass: 'ui-icon fa fa-code fa-fw',
+ id: 'source_code_info_item',
+ href: 'https://github.com/nasa-gibs/worldview'
+ },
+ {
+ text: 'Whats new',
+ iconClass: 'ui-icon fa fa-flag fa-fw',
+ id: 'whats_new_info_item',
+ href: 'https://github.com/nasa-gibs/worldview/releases'
+ },
+ {
+ text: 'About',
+ iconClass: 'ui-icon fa fa-file fa-fw',
+ id: 'about_info_item',
+ onClick: () => {
+ aboutClick();
+ }
+ }
+ ];
return <IconList list={infoArray} size="small" />;
}
}
function mapStateToProps(state) {
- const { isOpen, bodyText, headerText, isCustom, key } = state;
- const id = key;
+ const { isInitiated } = state.feedback;
return {
- isOpen,
- bodyText,
- headerText,
- isCustom,
- id
+ feedbackIsInitiated: isInitiated
};
}
const mapDispatchToProps = dispatch => ({
- openModal: text => {
- dispatch(openCustomContent(text));
+ sendFeedback: isInitiated => {
+ onClickFeedback(isInitiated);
+ if (!isInitiated) {
+ dispatch(initFeedback());
+ }
+ },
+ startTour: () => {},
+ aboutClick: () => {
+ if (util.browser.small) {
+ window.open('pages/about.html?v=@BUILD_NONCE@', '_blank');
+ } else {
+ dispatch(
+ requestLoadedPage(
+ 'MODAL_ABOUT_PAGE_REQUEST',
+ 'pages/about.html?v=@BUILD_NONCE@',
+ 'html'
+ )
+ );
+ dispatch(renderTemplate('About', 'modalAboutPage'));
+ }
}
});