Skip to content

Commit

Permalink
Feature/swodlr UI 75 - interactive tutorial (#78)
Browse files Browse the repository at this point in the history
* feature/swodlr-ui-75: interactive tutorial

* feature/swodlr-ui-75: add my data page to tutorial

* feature/swodlr-ui-75: add tutorial start button

* feature/swodlr-ui-75: optimized abotu page images and fixed input parsing error

* feature/swodlr-ui-75: cleaned up tutorial and fixed spatial resulution overselection

* feature/swodlr-ui-75

* feature/swodlr-ui-75

* feature/swodlr-ui-75: cleaned up spatial seach errors

* feature/swodlr-ui-75: remove extra if statement

* feature/swodlr-ui-75: fixed infinite loop bug with polygon edit when no edit change

---------

Co-authored-by: jbyrne <[email protected]>
  • Loading branch information
jbyrne6 and jbyrne authored Jan 23, 2024
1 parent e080a7a commit 7a2c675
Show file tree
Hide file tree
Showing 34 changed files with 677 additions and 1,255 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"mgrs"
"mgrs",
"Podaac"
]
}
156 changes: 156 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"react-bootstrap-icons": "^1.10.3",
"react-datepicker": "^4.24.0",
"react-dom": "^18.2.0",
"react-joyride": "^2.7.2",
"react-leaflet": "^4.2.1",
"react-leaflet-draw": "^0.20.4",
"react-redux": "^8.0.5",
Expand Down
Binary file modified src/assets/SWOT-YUKON.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/comparing-images.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/swot-go-up-resolution.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/swotPosterCropped.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/swot_mainlogo_portrait.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/about/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const About = () => {
<Row className="align-items-center"><h5>Q: How do I find cycle, pass, and scene?</h5></Row>
</ListGroup.Item>
<ListGroup.Item className='howToListItem' style={{marginRight: '0%', marginLeft: '0%'}}>
<Row><h5>A: The cycle, pass, and scene IDs can be found in the file name of the standard raster product. The files can be explored within {<a href="https://search.earthdata.nasa.gov/search" target="_">Earthdata Search</a>}. The file naming convention is like so: {`SWOT_L2_HR_Raster_<DescriptorString>_<CycleID>_<PassID>_<SceneID>
<Row><h5>A: The cycle, pass, and scene IDs can be found in the file name of the standard raster product. The files can be explored within {<a href="https://search.earthdata.nasa.gov/search/granules?p=C2799438271-POCLOUD&pg[0][v]=f&pg[0][gsk]=-start_date&q=SWOT_L2_HR_RASTER_2.0&tl=1705536407!3!!&lat=65.390625&zoom=1" target="_">Earthdata Search</a>}. The file naming convention is like so: {`SWOT_L2_HR_Raster_<DescriptorString>_<CycleID>_<PassID>_<SceneID>
_<RangeBeginningDateTime>_<RangeEndingDateTime>_<CRID>_<ProductCounter>.nc`}</h5></Row>
</ListGroup.Item>
</ListGroup>
Expand Down
6 changes: 5 additions & 1 deletion src/components/app/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -629,4 +629,8 @@ TABS
.sidebar-breadcrumb-item:active {
color: 'black' !important;
font-size: '24px' !important;
}
}

/**************************************************
WALKTHROUGH
**************************************************/
9 changes: 0 additions & 9 deletions src/components/app/App.test.tsx

This file was deleted.

85 changes: 66 additions & 19 deletions src/components/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,79 @@ import { useAppSelector, useAppDispatch } from '../../redux/hooks'
import { setResizeInactive, setResizeEndLocation, setResizeStartLocation } from '../sidebar/actions/sidebarSlice';
import Welcome from '../welcome/Welcome'
import AuthorizationCodeHandler from '../edl/AuthorizationCodeHandler';
import CustomizeProductsSidebar from '../sidebar/CustomizeProductsSidebar';
import GeneratedProductHistory from '../history/GeneratedProductHistory';
import About from '../about/About';
import NavbarContainer from '../navbar/NavbarContainer';
import PodaacFooter from '../navbar/PodaacFooter';
import NotFound from '../error/NotFound';
import { Route, Routes, useNavigate } from 'react-router-dom';
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
import { Session } from '../../authentication/session';
import { getCurrentUser } from './appSlice';
import { useEffect } from 'react';
import { getCurrentUser, setStartTutorial } from './appSlice';
import { useEffect, useState } from 'react';
import GranuleSelectionAndConfigurationView from '../sidebar/GranuleSelectionAndConfigurationView';
import Joyride from 'react-joyride';
import { deleteProduct } from '../sidebar/actions/productSlice';
import { tutorialSteps } from '../tutorial/tutorialConstants';

const App = () => {
const dispatch = useAppDispatch()
const footerResizeActive = useAppSelector((state) => state.sidebar.footerResizeActive)
const previousResizeEndLocation = useAppSelector((state) => state.sidebar.resizeEndLocation)
const userAuthenticated = useAppSelector((state) => state.app.userAuthenticated)
const colorModeClass = useAppSelector((state) => state.navbar.colorModeClass)
const currentUser = useAppSelector((state) => state.app.currentUser);
const currentUser = useAppSelector((state) => state.app.currentUser)
const startTutorial = useAppSelector((state) => state.app.startTutorial)
const addedProducts = useAppSelector((state) => state.product.addedProducts)
const navigate = useNavigate();
const { search } = useLocation();

useEffect(() => {
// If a session was found
Session.getCurrent().then((session) => {
if (session !== null) {
if (currentUser === null) {
dispatch(getCurrentUser());
}
} else {
// navigate to welcome page if user isn't authenticated
navigate('/')
const [joyride, setState] = useState({
run: startTutorial,
steps: tutorialSteps
})

useEffect(() => {
setState({...joyride, run: startTutorial })

}, [startTutorial]);

const handleJoyrideCallback = (data: { action: any; index: any; status: any; type: any; step: any; lifecycle: any; }) => {
const { action, step, type, lifecycle } = data;
const stepTarget = step.target
if (stepTarget === '#configure-options-breadcrumb' && action === 'update') {
navigate(`/customizeProduct/configureOptions${search}`)
} else if (stepTarget === '#configure-options-breadcrumb' && action === 'prev') {
navigate(`/customizeProduct/selectScenes${search}`)
} else if (stepTarget === '#my-data-page' && action === 'prev') {
navigate(`/customizeProduct/configureOptions${search}`)
} else if (stepTarget === '#added-scenes' && action === 'update') {
navigate(`/customizeProduct/selectScenes?cyclePassScene=1_413_120&showUTMAdvancedOptions=true`)
} else if (stepTarget === '#customization-tab' && action === 'start') {
navigate('/customizeProduct/selectScenes')
} else if ((stepTarget === '#generate-products-button' && action === 'close' && lifecycle === 'complete') || (stepTarget === '#my-data-page' && action === 'next')) {
navigate(`/generatedProductHistory${search}`)
} else if (type === 'tour:end') {
dispatch(deleteProduct(addedProducts.map(product => product.granuleId)))
dispatch(setStartTutorial(false))
navigate(`/customizeProduct/selectScenes`)
}
};

useEffect(() => {
// If a session was found
Session.getCurrent().then((session) => {
if (session !== null) {
if (currentUser === null) {
dispatch(getCurrentUser());
}
});
}, [dispatch, navigate, currentUser]);
} else {
// navigate to welcome page if user isn't authenticated
navigate('/')
}
});
}, [dispatch, navigate, currentUser]);

const handleFooterResize = (event: any) => {
const handleSidebarResize = (event: any) => {
if (footerResizeActive) {
if (event.type === 'mouseup') {
dispatch(setResizeInactive())
Expand All @@ -61,7 +98,17 @@ const App = () => {
}

return (
<div className={`App ${userAuthenticated ? 'user-authenticated' : ''} ${colorModeClass}-background`} style={{cursor: footerResizeActive ? 'grabbing' : ''}} onMouseUp={(event) => handleFooterResize(event)} onMouseMove={(event) => handleFooterResize(event)}>
<div className={`App ${userAuthenticated ? 'user-authenticated' : ''} ${colorModeClass}-background`} style={{cursor: footerResizeActive ? 'grabbing' : ''}} onMouseUp={(event) => handleSidebarResize(event)} onMouseMove={(event) => handleSidebarResize(event)}>
<Joyride
callback={(data) => handleJoyrideCallback(data)}
run={joyride.run}
steps={joyride.steps}
showProgress
showSkipButton
hideCloseButton
continuous
scrollToFirstStep
/>
<Routes>
<Route path="/" element={ getPageWithFormatting(<Welcome />, false) } />
<Route path="/edl/code" element={ getPageWithFormatting(<AuthorizationCodeHandler/>, false) } />
Expand Down
Loading

0 comments on commit 7a2c675

Please sign in to comment.