Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDSC-4162: Create a Guided Tour For Users of Earthdata Search #1800

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
266 changes: 263 additions & 3 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
"react-helmet": "^6.1.0",
"react-icons": "^4.3.1",
"react-input-range": "^1.3.0",
"react-joyride": "^2.8.2",
"react-leaflet": "^4.2.0",
"react-leaflet-custom-control": "^1.3.5",
"react-leaflet-draw": "^0.20.4",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 24 additions & 2 deletions static/src/js/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import MetricsEventsContainer from './containers/MetricsEventsContainer/MetricsEventsContainer'
import NotFound from './components/Errors/NotFound'
import PortalContainer from './containers/PortalContainer/PortalContainer'
import SearchTour from './components/Tour/SearchTour'
import ShapefileDropzoneContainer from './containers/ShapefileDropzoneContainer/ShapefileDropzoneContainer'
import ShapefileUploadModalContainer from './containers/ShapefileUploadModalContainer/ShapefileUploadModalContainer'
import Spinner from './components/Spinner/Spinner'
Expand Down Expand Up @@ -72,12 +73,32 @@
class App extends Component {
constructor(props) {
super(props)
this.state = {}
this.state = {
runTour: false
}

this.store = configureStore()
const { edscHost } = getEnvironmentConfig()
const { env } = getApplicationConfig()
this.edscHost = edscHost
this.env = env
this.startTour = this.startTour.bind(this)
this.setRunTour = this.setRunTour.bind(this)
}

componentDidMount() {
const dontShowTour = localStorage.getItem('dontShowTour') !== 'true'
this.setState({
runTour: dontShowTour
})
}

setRunTour(value) {
this.setState({ runTour: value })
}

startTour() {
this.setState({ runTour: true })
}

// Portal paths have been removed, but this needs to stay in order to redirect users using
Expand Down Expand Up @@ -119,7 +140,7 @@
<ErrorBannerContainer />
<AuthTokenContainer>
<UrlQueryContainer>
<AppHeader />
<AppHeader onStartTour={this.startTour} />
<Switch>
<Route
path="/admin"
Expand Down Expand Up @@ -210,6 +231,7 @@
render={
() => (
<>
<SearchTour runTour={this.state.runTour} setRunTour={this.setRunTour} />

Check failure on line 234 in static/src/js/App.jsx

View workflow job for this annotation

GitHub Actions / eslint (lts/hydrogen)

Must use destructuring state assignment
<Search />
<Suspense fallback={<Spinner type="dots" className="root__spinner spinner spinner--dots spinner--white spinner--small" />}>
<EdscMapContainer />
Expand Down
9 changes: 7 additions & 2 deletions static/src/js/components/AppHeader/AppHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import React from 'react'
import PropTypes from 'prop-types'

import SecondaryToolbarContainer
from '../../containers/SecondaryToolbarContainer/SecondaryToolbarContainer'
import AppLogoContainer from '../../containers/AppLogoContainer/AppLogoContainer'

import './AppHeader.scss'

const AppHeader = () => (
const AppHeader = ({ onStartTour }) => (
<header className="app-header">
<AppLogoContainer />
<SecondaryToolbarContainer />
<SecondaryToolbarContainer onStartTour={onStartTour} />
</header>
)

AppHeader.propTypes = {
onStartTour: PropTypes.func.isRequired
}

export default AppHeader
1 change: 1 addition & 0 deletions static/src/js/components/Panels/Panels.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ export class Panels extends PureComponent {
<div className="panels__focused-meta">
{focusedMeta}
</div>
<div className="right-overlay" />
</section>
)
}
Expand Down
12 changes: 12 additions & 0 deletions static/src/js/components/Panels/Panels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,15 @@
pointer-events: none;
}
}

.right-overlay {
position: absolute;
top: 0;
bottom: 0;
right: 0;
z-index: 1000;
background-color: rgba(255, 255, 255, 0);
width: 4000px;
left: calc(100%);
pointer-events: none;
}
16 changes: 15 additions & 1 deletion static/src/js/components/SecondaryToolbar/SecondaryToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ class SecondaryToolbar extends Component {
location,
retrieval = {},
secondaryToolbarEnabled,
ursProfile
ursProfile,
onStartTour
} = this.props

const { first_name: firstName = '' } = ursProfile
Expand Down Expand Up @@ -321,6 +322,18 @@ class SecondaryToolbar extends Component {
onToggle={this.onToggleProjectDropdown}
alignRight
>
{
location.pathname === '/search' && (
<Dropdown.Toggle
className="secondary-toolbar__begin-tour-button"
as={Button}
onClick={onStartTour}
label="Want to learn more? Click here to take a tour of our site."
>
Start Tour
</Dropdown.Toggle>
)
}
<Dropdown.Toggle
className="secondary-toolbar__project-name-dropdown-toggle"
as={Button}
Expand Down Expand Up @@ -389,6 +402,7 @@ SecondaryToolbar.propTypes = {
earthdataEnvironment: PropTypes.string.isRequired,
location: locationPropType.isRequired,
onLogout: PropTypes.func.isRequired,
onStartTour: PropTypes.bool.isRequired,
onUpdateProjectName: PropTypes.func.isRequired,
projectCollectionIds: PropTypes.arrayOf(PropTypes.string).isRequired,
retrieval: PropTypes.shape({}).isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
}
}

&__begin-tour-button,
&__project-name-dropdown-toggle {
&:after {
display: none;
Expand All @@ -43,6 +44,7 @@
&__project,
&__login,
&__project-name-dropdown-toggle,
&__begin-tour-button,
&__user-dropdown-toggle {
position: relative;
padding: 0 1rem;
Expand Down Expand Up @@ -71,6 +73,7 @@
margin-right: 0.5rem;
}

&__begin-tour-button,
&__project-name-dropdown-toggle {
&:after {
display: none;
Expand Down
Loading
Loading