Interactive interface for browsing global, full-resolution satellite imagery
import PropTypes from 'prop-types';
import {
Modal, ModalHeader, ModalBody, ModalFooter,
} from 'reactstrap';
import { Close } from '@edsc/earthdata-react-icons/horizon-design-system/hds/ui';
function ModalComplete(props) {
const {
currentStory, modalComplete, resetTour, endTour,
} = props;
const { readMoreLinks } = currentStory;
const closeBtn = (
<button className="tour-close-btn" onClick={endTour} type="button">
<Close className="add-plus" size="14px" />
</button>
);
let list;
if (
readMoreLinks &&
(Array.isArray(readMoreLinks) && readMoreLinks.length)
) {
list = (
<>
<p>Read more about this story at the links below:</p>
<ul>
{readMoreLinks.map((linkObj) => (
<li key={`${linkObj.link || 'link'}-${linkObj.title || 'title'}`}>
<a href={linkObj.link} target="_blank" rel="noopener noreferrer">
{linkObj.title}
</a>
</li>
))}
</ul>
</>
);
}
return (
<div>
<Modal
isOpen={modalComplete}
toggle={endTour}
wrapClassName="tour tour-complete"
backdrop="static"
fade={false}
keyboard
>
<ModalHeader close={closeBtn}>
Story Complete
</ModalHeader>
<ModalBody>
<p>
You have now completed a story in @NAME@. To view more stories,
click the “More Stories” button below to explore more events
within the app. Click the “Exit Tutorial” button or close this
window to start using @NAME@ on your own.
</p>
{list}
</ModalBody>
<ModalFooter>
<button
type="button"
className="btn btn-primary"
onClick={resetTour}
>
More Stories
</button>
<button
type="button"
className="btn btn-secondary"
onClick={endTour}
>
Exit Tutorial
</button>
</ModalFooter>
</Modal>
</div>
);
}
ModalComplete.propTypes = {
currentStory: PropTypes.oneOfType([PropTypes.object, PropTypes.oneOf(['null'])]),
endTour: PropTypes.func.isRequired,
modalComplete: PropTypes.bool.isRequired,
resetTour: PropTypes.func.isRequired,
};
export default ModalComplete;