Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2281: Standalone about page (#3951)

Jason Kent7e298843d713
diff --git a/config/default/common/brand/about/welcome.md b/config/default/common/brand/about/welcome.md
index bc866433f..ed9e5e43a 100644
--- a/config/default/common/brand/about/welcome.md
+++ b/config/default/common/brand/about/welcome.md
@@ -1,9 +1,9 @@
-<h1>Welcome to Worldview<span class="version"> Version @BUILD_VERSION@ (<a href="https://github.com/nasa-gibs/worldview/releases"
+<h1>About @OFFICIAL_NAME@<span class="version"> Version @BUILD_VERSION@ (<a href="https://github.com/nasa-gibs/worldview/releases"
target="_blank" rel="noopener noreferrer">Release
Notes</a>)</span></h1>
<div class="right">
<div class="caption"><a href="https://wiki.earthdata.nasa.gov/pages/viewrecentblogposts.action?key=GIBS"
- target="_blank" rel="noopener noreferrer"> What's new in Worldview! </a></div>
+ target="_blank" rel="noopener noreferrer"> What's new in @OFFICIAL_NAME@! </a></div>
</div>
<p>This <a href="https://github.com/nasa-gibs/worldview" target="_blank" rel="noopener noreferrer">open source
code</a> app from NASA's <a href="https://earthdata.nasa.gov/eosdis" target="_blank"
@@ -20,12 +20,12 @@
rel="noopener noreferrer"><img src="images/gibs.png"></a>
<div class="caption gibs-caption">Powered by GIBS</div>
</div>
-<p>Worldview uses the <a href="https://earthdata.nasa.gov/gibs" target="_blank" rel="noopener noreferrer">Global
+<p>@OFFICIAL_NAME@ uses the <a href="https://earthdata.nasa.gov/gibs" target="_blank" rel="noopener noreferrer">Global
Imagery Browse Services</a> to rapidly retrieve its imagery for an interactive browsing experience. While
- Worldview uses <a href="https://openlayers.org" target="_blank" rel="noopener noreferrer">OpenLayers</a> as its
+ @OFFICIAL_NAME@ uses <a href="https://openlayers.org" target="_blank" rel="noopener noreferrer">OpenLayers</a> as its
mapping library, GIBS imagery can also be accessed from Google Earth, NASA World Wind, and several other
clients. We encourage interested developers to build their own clients or integrate NASA imagery into their
existing ones using these services.</p>
<p><a href="https://earthdata.nasa.gov/faq/worldview-gibs-faq" target="_blank" rel="noopener noreferrer">Frequently
Asked Questions</a></p>
-<hr>
\ No newline at end of file
+<hr>
diff --git a/doc/url_parameters.md b/doc/url_parameters.md
index 281c24609..df9336c4d 100644
--- a/doc/url_parameters.md
+++ b/doc/url_parameters.md
@@ -37,6 +37,7 @@
| `df` | boolean | <i>`true`</i> or <i>`false`</i> | If `true` value is set, distraction free mode will be activated. Distraction free mode is disabled by default and can be toggled from the Information toolbar menu. |
| `em` | boolean | <i>`true`</i> or <i>`false`</i> | If `true` value is set, embed mode will be activated. Embed mode is disabled by default. |
| `tr` | string | *`tour_id`* | The id of the tour story to load. Stories will load from step 1. |
+| `abt` | string | *`on`* | Indicates whether the about modal is open or not. Allows for permalinks that have the about page open |
\* *1 = yearly, 2 = monthly, 3 = daily, 4 = hourly, and 5 = minutely. The subdaily zoom levels (4 & 5) will only be available when subdaily layers are active.*
diff --git a/e2e/features/modal/about-modal.js b/e2e/features/modal/about-modal.js
new file mode 100644
index 000000000..4aa4f76df
--- /dev/null
+++ b/e2e/features/modal/about-modal.js
@@ -0,0 +1,40 @@
+const reuseables = require('../../reuseables/skip-tour.js');
+const localSelectors = require('../../reuseables/selectors.js');
+
+const {
+ infoToolbarButton,
+} = localSelectors;
+
+const aboutOpenURL = 'http://localhost:3000/?abt=on';
+const aboutClosedURL = 'http://localhost:3000/';
+
+const TIME_LIMIT = 10000;
+
+module.exports = {
+ beforeEach: (c) => {
+ reuseables.loadAndSkipTour(c, TIME_LIMIT);
+ },
+
+ 'About modal not open when URL param not present': (c) => {
+ c.url(aboutClosedURL);
+ c.expect.element('.about-page').to.be.not.present;
+ },
+
+ 'Opening about modal from menu sets URL param': (c) => {
+ c.click(infoToolbarButton);
+ c.waitForElementVisible('#about_info_item', TIME_LIMIT);
+ c.click('#about_info_item');
+ c.waitForElementVisible('.about-page', TIME_LIMIT);
+ c.expect.element('.about-page').to.be.present;
+ c.assert.urlParameterEquals('abt', 'on');
+ },
+
+ 'About modal is open when URL param is present': (c) => {
+ c.url(aboutOpenURL);
+ c.expect.element('.about-page').to.be.present;
+ },
+
+ after: (c) => {
+ c.end();
+ },
+};
diff --git a/package-lock.json b/package-lock.json
index df34f5107..9bb26337d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2705,6 +2705,30 @@
"node": ">=6.0.0"
}
},
+ "node_modules/@jridgewell/source-map": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
+ "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
+ "dev": true,
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.0",
+ "@jridgewell/trace-mapping": "^0.3.9"
+ }
+ },
+ "node_modules/@jridgewell/source-map/node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
+ "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
+ "dev": true,
+ "dependencies": {
+ "@jridgewell/set-array": "^1.0.1",
+ "@jridgewell/sourcemap-codec": "^1.4.10",
+ "@jridgewell/trace-mapping": "^0.3.9"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.4.11",
"dev": true,
@@ -5063,13 +5087,13 @@
"dev": true,
"hasInstallScript": true,
"dependencies": {
- "@testim/chrome-version": "^1.1.2",
- "axios": "^0.27.2",
- "del": "^6.0.0",
- "extract-zip": "^2.0.1",
- "https-proxy-agent": "^5.0.0",
- "proxy-from-env": "^1.1.0",
- "tcp-port-used": "^1.0.1"
+ "@testim/chrome-version": "^1.1.2",
+ "axios": "^0.27.2",
+ "del": "^6.0.0",
+ "extract-zip": "^2.0.1",
+ "https-proxy-agent": "^5.0.0",
+ "proxy-from-env": "^1.1.0",
+ "tcp-port-used": "^1.0.1"
},
"bin": {
"chromedriver": "bin/chromedriver"
@@ -23926,8 +23950,9 @@
}
},
"node_modules/terser": {
- "version": "4.8.0",
- "license": "BSD-2-Clause",
+ "version": "4.8.1",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.1.tgz",
+ "integrity": "sha512-4GnLC0x667eJG0ewJTa6z/yXrbLGv80D9Ru6HIpCQmO+Q4PfEtBFi0ObSckqwL6VyQv/7ENJieXHo2ANmdQwgw==",
"dependencies": {
"commander": "^2.20.0",
"source-map": "~0.6.1",
@@ -23991,13 +24016,14 @@
}
},
"node_modules/terser-webpack-plugin/node_modules/terser": {
- "version": "5.13.0",
+ "version": "5.14.2",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz",
+ "integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==",
"dev": true,
- "license": "BSD-2-Clause",
"dependencies": {
+ "@jridgewell/source-map": "^0.3.2",
"acorn": "^8.5.0",
"commander": "^2.20.0",
- "source-map": "~0.8.0-beta.0",
"source-map-support": "~0.5.20"
},
"bin": {
@@ -24007,32 +24033,6 @@
"node": ">=10"
}
},
- "node_modules/terser-webpack-plugin/node_modules/terser/node_modules/source-map": {
- "version": "0.8.0-beta.0",
- "dev": true,
- "license": "BSD-3-Clause",
- "dependencies": {
- "whatwg-url": "^7.0.0"
- },
- "engines": {
- "node": ">= 8"
- }
- },
- "node_modules/terser-webpack-plugin/node_modules/webidl-conversions": {
- "version": "4.0.2",
- "dev": true,
- "license": "BSD-2-Clause"
- },
- "node_modules/terser-webpack-plugin/node_modules/whatwg-url": {
- "version": "7.1.0",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "lodash.sortby": "^4.7.0",
- "tr46": "^1.0.1",
- "webidl-conversions": "^4.0.2"
- }
- },
"node_modules/terser/node_modules/commander": {
"version": "2.20.3",
"license": "MIT"
@@ -28960,6 +28960,29 @@
"version": "1.1.0",
"dev": true
},
+ "@jridgewell/source-map": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
+ "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
+ "dev": true,
+ "requires": {
+ "@jridgewell/gen-mapping": "^0.3.0",
+ "@jridgewell/trace-mapping": "^0.3.9"
+ },
+ "dependencies": {
+ "@jridgewell/gen-mapping": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
+ "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
+ "dev": true,
+ "requires": {
+ "@jridgewell/set-array": "^1.0.1",
+ "@jridgewell/sourcemap-codec": "^1.4.10",
+ "@jridgewell/trace-mapping": "^0.3.9"
+ }
+ }
+ }
+ },
"@jridgewell/sourcemap-codec": {
"version": "1.4.11",
"dev": true
@@ -43078,7 +43101,9 @@
}
},
"terser": {
- "version": "4.8.0",
+ "version": "4.8.1",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.1.tgz",
+ "integrity": "sha512-4GnLC0x667eJG0ewJTa6z/yXrbLGv80D9Ru6HIpCQmO+Q4PfEtBFi0ObSckqwL6VyQv/7ENJieXHo2ANmdQwgw==",
"requires": {
"commander": "^2.20.0",
"source-map": "~0.6.1",
@@ -43121,35 +43146,15 @@
"dev": true
},
"terser": {
- "version": "5.13.0",
+ "version": "5.14.2",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz",
+ "integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==",
"dev": true,
"requires": {
+ "@jridgewell/source-map": "^0.3.2",
"acorn": "^8.5.0",
"commander": "^2.20.0",
- "source-map": "~0.8.0-beta.0",
"source-map-support": "~0.5.20"
- },
- "dependencies": {
- "source-map": {
- "version": "0.8.0-beta.0",
- "dev": true,
- "requires": {
- "whatwg-url": "^7.0.0"
- }
- }
- }
- },
- "webidl-conversions": {
- "version": "4.0.2",
- "dev": true
- },
- "whatwg-url": {
- "version": "7.1.0",
- "dev": true,
- "requires": {
- "lodash.sortby": "^4.7.0",
- "tr46": "^1.0.1",
- "webidl-conversions": "^4.0.2"
}
}
}
diff --git a/web/js/components/about/about-section.js b/web/js/components/about/about-section.js
index 0ee943df0..5b7a96d76 100644
--- a/web/js/components/about/about-section.js
+++ b/web/js/components/about/about-section.js
@@ -6,31 +6,31 @@ export default function AboutSection(props) {
const [sectionDescription, setSectionDescription] = useState();
- const fetchHTML = (sectionName, setFn) => {
+ const fetchHTML = () => {
let controller = new AbortController();
(async () => {
- if (!sectionName) {
- setFn('no section name provided');
+ if (!section) {
+ setSectionDescription('no section name provided');
return;
}
try {
- const data = await fetch(`brand/about/${sectionName}.html`);
+ const data = await fetch(`brand/about/${section}.html`);
const dataHTML = await data.text();
controller = null;
const setData = data.ok ? dataHTML : '';
- setFn(setData);
+ setSectionDescription(setData);
} catch (e) {
if (!controller.signal.aborted) {
// eslint-disable-next-line no-console
console.error(e);
- setFn('there was an error');
+ setSectionDescription('could not load metadata');
}
}
})();
return controller ? controller.abort() : null;
};
- fetchHTML(section, setSectionDescription);
+ fetchHTML();
return (
<div dangerouslySetInnerHTML={{ __html: sectionDescription }} />
);
diff --git a/web/js/components/about/about-page.js b/web/js/components/about/about.js
similarity index 85%
rename from web/js/components/about/about-page.js
rename to web/js/components/about/about.js
index 01d6ca50b..5ed7bec91 100644
--- a/web/js/components/about/about-page.js
+++ b/web/js/components/about/about.js
@@ -2,12 +2,10 @@ import React from 'react';
import Scrollbar from '../util/scrollbar';
import AboutSection from './about-section';
-export default function AboutPage() {
+export default function AboutModal() {
return (
<Scrollbar style={{ height: 'calc(var(--vh, 1vh) * 100 - 100px)' }}>
- <div
- className="about-page"
- >
+ <div className="about-page">
<AboutSection section="welcome" />
<AboutSection section="keyboard" />
<AboutSection section="imagery" />
diff --git a/web/js/containers/info.js b/web/js/containers/info.js
index af35c5276..7a326c989 100644
--- a/web/js/containers/info.js
+++ b/web/js/containers/info.js
@@ -4,9 +4,10 @@ import { connect } from 'react-redux';
import googleTagManager from 'googleTagManager';
import {
openCustomContent,
+ toggleAboutModal,
} from '../modules/modal/actions';
import toggleDistractionFreeModeAction from '../modules/ui/actions';
-import AboutPage from '../components/about/about-page';
+import AboutModal from '../components/about/about';
import IconList from '../components/util/icon-list';
import onClickFeedback from '../modules/feedback/util';
import { addToLocalStorage } from '../modules/notifications/util';
@@ -32,6 +33,7 @@ function InfoList (props) {
isDistractionFreeModeActive,
isTourActive,
isMobile,
+ openAboutModal,
toggleDistractionFreeMode,
notifications,
notificationClick,
@@ -121,6 +123,7 @@ function InfoList (props) {
id: 'about_info_item',
onClick: () => {
aboutClick();
+ openAboutModal();
},
},
{
@@ -225,13 +228,17 @@ const mapDispatchToProps = (dispatch) => ({
);
},
aboutClick: () => {
- // Create new functionality here that renders the about page
- // inside a modal window.
+ dispatch(toggleAboutModal(true));
+ },
+ openAboutModal: () => {
dispatch(
openCustomContent('ABOUT_MODAL', {
headerText: 'About',
- bodyComponent: AboutPage,
+ bodyComponent: AboutModal,
wrapClassName: 'about-page-modal',
+ onClose: () => {
+ dispatch(toggleAboutModal(false));
+ },
}),
);
},
@@ -253,6 +260,7 @@ InfoList.propTypes = {
isTourActive: PropTypes.bool,
notificationClick: PropTypes.func,
notifications: PropTypes.object,
+ openAboutModal: PropTypes.func,
sendFeedback: PropTypes.func,
startTour: PropTypes.func,
toggleDistractionFreeMode: PropTypes.func,
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index 515983053..8b2f8a797 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -10,7 +10,7 @@ import {
} from 'lodash';
import Promise from 'bluebird';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { openCustomContent, onToggle } from '../modules/modal/actions';
+import { openCustomContent, onToggle, toggleAboutModal } from '../modules/modal/actions';
import toggleDistractionFreeMode from '../modules/ui/actions';
import ImageDownload from './image-download';
import Projection from './projection';
@@ -35,6 +35,7 @@ import { toggleShowLocationSearch, toggleDialogVisible } from '../modules/locati
import { isLocationSearchFeatureEnabled } from '../modules/location-search/util';
import { getAllActiveLayers } from '../modules/layers/selectors';
import { hasNonDownloadableVisibleLayer, getNonDownloadableLayerWarning, getNonDownloadableLayers } from '../modules/image-download/util';
+import AboutModal from '../components/about/about';
Promise.config({ cancellation: true });
@@ -94,6 +95,13 @@ class toolbarContainer extends Component {
this.openImageDownload = this.openImageDownload.bind(this);
}
+ componentDidMount() {
+ const { isAboutOpen, openAboutModal } = this.props;
+ if (isAboutOpen) {
+ openAboutModal();
+ }
+ }
+
getPromise(bool, type, action, title) {
const { visibleLayersForProj } = this.props;
const { notify } = this.props;
@@ -365,7 +373,7 @@ class toolbarContainer extends Component {
const mapStateToProps = (state) => {
const {
- animation, sidebar, browser, notifications, palettes, compare, map, measure, modal, ui, locationSearch, events, proj,
+ animation, sidebar, browser, notifications, palettes, compare, map, measure, modal, modalAbout, ui, locationSearch, events, proj,
} = state;
const { isDistractionFreeModeActive } = ui;
const { number, type } = notifications;
@@ -401,6 +409,7 @@ const mapStateToProps = (state) => {
isCompareActive,
isLocationSearchExpanded,
isMobile,
+ isAboutOpen: modalAbout.isOpen,
shouldBeCollapsed,
hasCustomPalette: hasCustomPaletteInActiveProjection(
activeLayersForProj,
@@ -448,6 +457,18 @@ const mapDispatchToProps = (dispatch) => ({
customParams,
));
},
+ openAboutModal: () => {
+ dispatch(
+ openCustomContent('ABOUT_MODAL', {
+ headerText: 'About',
+ bodyComponent: AboutModal,
+ wrapClassName: 'about-page-modal',
+ onClose: () => {
+ dispatch(toggleAboutModal(false));
+ },
+ }),
+ );
+ },
notify: (type, action, visibleLayersForProj) => new Promise((resolve, reject, cancel) => {
const nonDownloadableLayers = type !== 'layers' ? null : getNonDownloadableLayers(visibleLayersForProj);
const bodyComponentProps = {
@@ -498,6 +519,7 @@ toolbarContainer.propTypes = {
hasCustomPalette: PropTypes.bool,
hasGraticule: PropTypes.bool,
isAnimatingToEvent: PropTypes.bool,
+ isAboutOpen: PropTypes.bool,
isCompareActive: PropTypes.bool,
isDistractionFreeModeActive: PropTypes.bool,
isLocationSearchExpanded: PropTypes.bool,
@@ -508,6 +530,7 @@ toolbarContainer.propTypes = {
notificationType: PropTypes.string,
notify: PropTypes.func,
openModal: PropTypes.func,
+ openAboutModal: PropTypes.func,
refreshStateAfterImageDownload: PropTypes.func,
requestNotifications: PropTypes.func,
rotation: PropTypes.number,
diff --git a/web/js/location.js b/web/js/location.js
index f53486532..c2a5aaeb9 100644
--- a/web/js/location.js
+++ b/web/js/location.js
@@ -468,6 +468,14 @@ const getParameters = function(config, parameters) {
parse: (str) => str === 'on',
},
},
+ abt: {
+ stateKey: 'modalAbout.isOpen',
+ initialState: false,
+ options: {
+ serialize: (boo) => (boo ? 'on' : undefined),
+ parse: (str) => str === 'on',
+ },
+ },
sh: {
stateKey: 'smartHandoffs',
initialState: '',
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 6e0622eed..911432c41 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -1099,14 +1099,15 @@ export default function mapui(models, config, store) {
function createMap(proj, dateSelected) {
const state = store.getState();
dateSelected = dateSelected || getSelectedDate(state);
- const id = `wv-map-${proj.id}`;
+ const mapContainerEl = document.getElementById('wv-map');
const mapEl = document.createElement('div');
+ const id = `wv-map-${proj.id}`;
+
mapEl.setAttribute('id', id);
mapEl.setAttribute('data-proj', proj.id);
mapEl.classList.add('wv-map');
mapEl.style.display = 'none';
-
- document.getElementById('wv-map').insertAdjacentElement('afterbegin', mapEl);
+ mapContainerEl.insertAdjacentElement('afterbegin', mapEl);
// Create two specific controls
const scaleMetric = new OlControlScaleLine({
@@ -1280,6 +1281,9 @@ export default function mapui(models, config, store) {
});
}
- init();
+ if (document.getElementById('app')) {
+ init();
+ }
+
return self;
}
diff --git a/web/js/modules/combine-reducers.js b/web/js/modules/combine-reducers.js
index 3bfdd15c5..17afb0c03 100644
--- a/web/js/modules/combine-reducers.js
+++ b/web/js/modules/combine-reducers.js
@@ -1,7 +1,7 @@
import { combineReducers } from 'redux';
import { createResponsiveStateReducer } from 'redux-responsive';
import { assign as lodashAssign } from 'lodash';
-import { modalReducer, modalAboutPage } from './modal/reducers';
+import { modalReducer, modalAboutReducer } from './modal/reducers';
import feedbackReducer from './feedback/reducers';
import projectionReducer from './projection/reducer';
import { locationSearchReducer } from './location-search/reducers';
@@ -120,7 +120,7 @@ const reducers = {
map: mapReducer,
measure: measureReducer,
modal: modalReducer,
- modalAboutPage,
+ modalAbout: modalAboutReducer,
models: defaultReducer,
notifications: notificationsReducer,
notificationsRequest,
diff --git a/web/js/modules/modal/actions.js b/web/js/modules/modal/actions.js
index 607d98038..38b4817f2 100644
--- a/web/js/modules/modal/actions.js
+++ b/web/js/modules/modal/actions.js
@@ -5,9 +5,17 @@ import {
TOGGLE,
RENDER_TEMPLATE,
CLOSE,
+ OPEN_ABOUT,
+ CLOSE_ABOUT,
} from './constants';
import { requestAction } from '../core/actions';
+export function toggleAboutModal(isOpen) {
+ return {
+ type: isOpen ? OPEN_ABOUT : CLOSE_ABOUT,
+ };
+}
+
export function openBasicContent(modalHeader, bodyText) {
return {
type: OPEN_BASIC,
diff --git a/web/js/modules/modal/actions.test.js b/web/js/modules/modal/actions.test.js
index a7135fd87..71c2fd924 100644
--- a/web/js/modules/modal/actions.test.js
+++ b/web/js/modules/modal/actions.test.js
@@ -95,34 +95,34 @@ describe('Template fetching', () => {
},
});
const expectedActions = [
- { type: constants.ABOUT_PAGE_REQUEST_START },
+ { type: constants.TEMPLATE_REQUEST_START },
{
- type: constants.ABOUT_PAGE_REQUEST_SUCCESS,
+ type: constants.TEMPLATE_REQUEST_SUCCESS,
response: constants.ABOUT_MOCK_RESPONSE,
},
];
const store = mockStore({ modal: {} });
return store
- .dispatch(requestTemplate(constants.ABOUT_PAGE_REQUEST, loc, 'text/html'))
+ .dispatch(requestTemplate(constants.TEMPLATE_REQUEST, loc, 'text/html'))
.then(() => {
expect(store.getActions()).toEqual(expectedActions);
});
});
- test(`creates ${constants.ABOUT_PAGE_REQUEST_FAILURE} Action`, () => {
+ test(`creates ${constants.TEMPLATE_REQUEST_FAILURE} Action`, () => {
const loc = 'mock/';
fetchMock.mock(loc, {
throws: ERROR_MESSAGE,
});
const expectedActions = [
- { type: constants.ABOUT_PAGE_REQUEST_START },
+ { type: constants.TEMPLATE_REQUEST_START },
{
- type: constants.ABOUT_PAGE_REQUEST_FAILURE,
+ type: constants.TEMPLATE_REQUEST_FAILURE,
error: ERROR_MESSAGE,
},
];
const store = mockStore({ modal: {} });
return store
- .dispatch(requestTemplate(constants.ABOUT_PAGE_REQUEST, loc, 'text/html'))
+ .dispatch(requestTemplate(constants.TEMPLATE_REQUEST, loc, 'text/html'))
.catch(() => {
expect(store.getActions()).toEqual(expectedActions);
});
diff --git a/web/js/modules/modal/constants.js b/web/js/modules/modal/constants.js
index ef042dbca..a07d16303 100644
--- a/web/js/modules/modal/constants.js
+++ b/web/js/modules/modal/constants.js
@@ -3,10 +3,12 @@ export const OPEN_CUSTOM = 'MODAL/OPEN_MODAL_WITH_CUSTOM_CONTENT';
export const OPEN_BASIC = 'MODAL/OPEN_MODAL_WITH_BASIC_CONTENT';
export const RENDER_TEMPLATE = 'MODAL/OPEN_MODAL_CONTAINING_LOADED_PAGE';
export const CLOSE = 'MODAL/CLOSE_MODAL';
-export const ABOUT_PAGE_REQUEST = 'MODAL/MODAL_ABOUT_PAGE_REQUEST';
-export const ABOUT_PAGE_REQUEST_START = 'MODAL/MODAL_ABOUT_PAGE_REQUEST_START';
-export const ABOUT_PAGE_REQUEST_FAILURE = 'MODAL/MODAL_ABOUT_PAGE_REQUEST_FAILURE';
-export const ABOUT_PAGE_REQUEST_SUCCESS = 'MODAL/MODAL_ABOUT_PAGE_REQUEST_SUCCESS';
+export const OPEN_ABOUT = 'MODAL/OPEN_ABOUT';
+export const CLOSE_ABOUT = 'MODAL/CLOSE_ABOUT';
+export const TEMPLATE_REQUEST = 'MODAL/MODAL_TEMPLATE_REQUEST';
+export const TEMPLATE_REQUEST_START = 'MODAL/MODAL_TEMPLATE_REQUEST_START';
+export const TEMPLATE_REQUEST_FAILURE = 'MODAL/MODAL_TEMPLATE_REQUEST_FAILURE';
+export const TEMPLATE_REQUEST_SUCCESS = 'MODAL/MODAL_TEMPLATE_REQUEST_SUCCESS';
export const ABOUT_MOCK_RESPONSE = '<html>MOCK</html>';
export const TEST_KEY = 'some-key-0000';
diff --git a/web/js/modules/modal/reducers.js b/web/js/modules/modal/reducers.js
index 3e3870afd..a318c655c 100644
--- a/web/js/modules/modal/reducers.js
+++ b/web/js/modules/modal/reducers.js
@@ -4,10 +4,10 @@ import {
OPEN_CUSTOM,
OPEN_BASIC,
RENDER_TEMPLATE,
- ABOUT_PAGE_REQUEST,
+ OPEN_ABOUT,
+ CLOSE_ABOUT,
CLOSE,
} from './constants';
-import { requestReducer } from '../core/reducers';
export const modalState = {
headerText: '',
@@ -23,8 +23,18 @@ export const modalState = {
customProps: {},
template: null,
};
-export function modalAboutPage(state = {}, action) {
- return requestReducer(ABOUT_PAGE_REQUEST, state, action);
+const aboutModalState = {
+ isOpen: false,
+};
+export function modalAboutReducer(state = aboutModalState, action) {
+ switch (action.type) {
+ case OPEN_ABOUT:
+ return { ...state, isOpen: true };
+ case CLOSE_ABOUT:
+ return { ...state, isOpen: false };
+ default:
+ return state;
+ }
}
export function modalReducer(state = modalState, action) {
switch (action.type) {
diff --git a/web/js/modules/modal/reducers.test.js b/web/js/modules/modal/reducers.test.js
index 6ee6833f5..6088bbac1 100644
--- a/web/js/modules/modal/reducers.test.js
+++ b/web/js/modules/modal/reducers.test.js
@@ -1,39 +1,8 @@
import { assign as lodashAssign } from 'lodash';
-import { defaultRequestState } from '../core/reducers';
import * as constants from './constants';
-import { modalAboutPage, modalReducer, modalState } from './reducers';
+import { modalReducer, modalState } from './reducers';
import util from '../../util/util';
-describe('modalAboutPage request reducer', () => {
- test('should return the initial state', () => {
- expect(modalAboutPage([], {})).toEqual(defaultRequestState);
- });
- test('Should set isLoading to true on Request Start', () => {
- expect(
- modalAboutPage([], {
- type: constants.ABOUT_PAGE_REQUEST_START,
- }),
- ).toEqual({
- isLoading: true,
- error: null,
- response: null,
- type: null,
- });
- });
- test('Should return response upon request success ', () => {
- expect(
- modalAboutPage([], {
- type: constants.ABOUT_PAGE_REQUEST_SUCCESS,
- response: constants.MOCK_RESPONSE_BODY,
- }),
- ).toEqual({
- isLoading: false,
- error: null,
- response: constants.MOCK_RESPONSE_BODY,
- type: null,
- });
- });
-});
describe('main modalReducer', () => {
test('should return the initial state', () => {
expect(modalReducer(undefined, {})).toEqual(modalState);
diff --git a/web/scss/features/about.scss b/web/scss/features/about.scss
index 274e5c680..6e765e1ba 100644
--- a/web/scss/features/about.scss
+++ b/web/scss/features/about.scss
@@ -1,162 +1,146 @@
.about-page {
background-color: #282828;
- padding: 5px;
-}
-
-.about-page div,
-.about-page h1,
-.about-page h2,
-.about-page li,
-.about-page p {
- color: #eee;
- font-weight: 100;
- font-family: "Open Sans", sans-serif;
-}
+ padding: 10px 15px 0 10px;
+ max-width: 600px;
+ margin: auto;
+
+ div,
+ h1,
+ h2,
+ li,
+ p {
+ color: #eee;
+ font-weight: 100;
+ font-family: "Open Sans", sans-serif;
+ }
-.about-page div,
-.about-page li,
-.about-page p {
- font-size: 14px;
- line-height: 22px;
-}
+ div,
+ li,
+ p {
+ font-size: 14px;
+ line-height: 22px;
+ }
-.about-page .version {
- margin-top: 10px;
- font-size: 12px;
- font-weight: 100;
- float: right;
-}
+ .version {
+ margin-top: 10px;
+ font-size: 12px;
+ font-weight: 100;
+ float: right;
+ }
-.about-page h1 {
- font-size: 20px;
- font-weight: 600;
- line-height: 1em;
-}
+ h1 {
+ font-size: 20px;
+ font-weight: 600;
+ line-height: 1em;
+ }
-.about-page h2 {
- font-size: 18px;
- margin: 0.75em 0;
- font-weight: 600;
-}
+ h2 {
+ font-size: 18px;
+ margin: 0.75em 0;
+ font-weight: 600;
+ }
-.about-page p {
- margin: 1.12em 0;
+ p {
+ margin: 1.12em 0;
- &:first-of-type {
- display: inline-block;
- margin-bottom: 0;
+ &:first-of-type {
+ display: inline-block;
+ margin-bottom: 0;
+ }
}
-}
-.about-page hr {
- display: block;
- height: 1px;
- border: 0;
- border-top: 1px solid #404040;
- margin: 1em 0;
- padding: 0;
-}
-
-.about-page ul {
- margin-left: 2em;
-}
+ hr {
+ display: block;
+ height: 1px;
+ border: 0;
+ border-top: 1px solid #404040;
+ margin: 1em 0;
+ padding: 0;
+ }
-.about-page li {
- display: list-item;
-}
+ ul { margin-left: 2em; }
-.about-page a {
- color: #7bf;
- text-decoration: none;
+ li { display: list-item; }
- &:hover {
- color: #7df;
+ a {
+ color: #7bf;
text-decoration: none;
- }
-}
-.about-page .right {
- float: right;
- margin: 0.4em 0.2em 0;
-
- &:first-of-type {
- width: 100%;
-
- a {
- float: right;
+ &:hover {
+ color: #7df;
+ text-decoration: none;
}
}
- &:last-of-type {
- margin: 1.4em 0.2em 0;
- }
-}
+ .right {
+ float: right;
+ margin: 0.4em 0.2em 0;
-.about-page .caption {
- font-size: 12px;
- line-height: 18px;
-}
-
-.about-page .gibs-caption {
- margin-top: 3px;
- width: 64px;
- font-style: italic;
- text-align: center;
-}
+ &:first-of-type {
+ width: 100%;
-/* Override default modal CSS */
+ a {
+ float: right;
+ }
+ }
-.about-page-modal .modal-dialog {
- border: none;
-}
+ &:last-of-type {
+ margin: 1.4em 0.2em 0;
+ }
+ }
-.about-page-modal .modal-body {
- padding: 0;
-}
+ .caption {
+ font-size: 12px;
+ line-height: 18px;
+ }
-.about-page-modal .about-page {
- padding: 10px 15px 0 10px;
-}
+ .gibs-caption {
+ margin-top: 3px;
+ width: 64px;
+ font-style: italic;
+ text-align: center;
+ }
-/* Keyboard shortcuts section */
+ .keyboard-shortcuts-table {
+ width: 100%;
+ margin-top: 20px;
-.about-page .keyboard-shortcuts-section {
- display: none;
-}
+ thead tr th {
+ padding-bottom: 8px;
+ }
-.about-page .keyboard-shortcuts-table {
- width: 100%;
- margin-top: 20px;
+ tr {
+ &:not(:last-of-type) {
+ border-bottom: 1px solid #404040;
+ }
- thead tr th {
- padding-bottom: 8px;
- }
+ :first-child {
+ text-align: left;
+ }
- tr {
- &:not(:last-of-type) {
- border-bottom: 1px solid #404040;
+ :last-child {
+ text-align: right;
+ }
}
- :first-child {
- text-align: left;
+ td {
+ padding: 11px 0;
}
- :last-child {
- text-align: right;
+ code {
+ color: #f60;
+ padding: 1px 8px;
+ border: thin solid;
}
}
+}
- td {
- padding: 11px 0;
- }
-
- code {
- color: #f60;
- padding: 1px 8px;
- border: thin solid;
- }
+/* Override default modal CSS */
+.about-page-modal .modal-body {
+ padding: 0;
}
+/* Keyboard shortcuts section */
@media (min-width: $tablet-min-width) {
.about-page .keyboard-shortcuts-section {
display: block;
diff --git a/web/scss/features/tour.scss b/web/scss/features/tour.scss
index 285ef0725..da268f117 100644
--- a/web/scss/features/tour.scss
+++ b/web/scss/features/tour.scss
@@ -19,40 +19,36 @@
}
}
-.about-page-modal .modal-dialog .modal-header .close,
-.tour-start .modal-dialog .modal-header .close,
-.tour-complete .modal-dialog .modal-header .close {
- font-size: 30px;
- padding: 12px 14px;
- color: #ddd;
- text-shadow: 1px 1px 0 #333;
-
- &:hover {
- color: #fff;
- }
-}
+.about-page-modal,
+.tour-start,
+.tour-complete {
+ .modal-header {
+ position: relative;
+ background-color: rgb(0 69 123);
+ padding: 6px 8px;
-.about-page-modal .modal-header,
-.tour-complete .modal-header,
-.tour-start .modal-header {
- position: relative;
- background-color: rgb(0 69 123);
- padding: 6px 8px;
-}
+ .close {
+ font-size: 30px;
+ padding: 12px 14px;
+ color: #ddd;
+ text-shadow: 1px 1px 0 #333;
-.about-page-modal .modal-title,
-.tour-start .modal-title,
-.tour-complete .modal-title {
- color: #fff;
- font-size: 24px;
- line-height: 22px;
- font-weight: 300;
-}
+ &:hover {
+ color: #fff;
+ }
+ }
+ }
-.about-page-modal .modal-body,
-.tour-complete .modal-body,
-.tour-start .modal-body {
- border-radius: 0;
+ .modal-title {
+ color: #fff;
+ font-size: 24px;
+ line-height: 22px;
+ font-weight: 300;
+ }
+
+ .modal-body {
+ border-radius: 0;
+ }
}
/* TOUR START */