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

Add a optional tour on startup. [#31] #57

Merged
merged 16 commits into from
Jun 11, 2024
Merged

Add a optional tour on startup. [#31] #57

merged 16 commits into from
Jun 11, 2024

Conversation

eti7075
Copy link
Collaborator

@eti7075 eti7075 commented May 30, 2024

  • added a startup modal whenever the site os opened or refreshed.
  • stores a "tour" value to localStorage to enable permanently skipping this tour and popup.
  • added a tour that addresses each button or display on the site

Each part of a tour is called a step. I did my best to cover what item does in each step, but if someone has a more succinct description, please let me know. Below is a quick demo of the tour.

Screen.Recording.2024-05-30.at.11.15.46.AM.mov

@eti7075 eti7075 linked an issue May 30, 2024 that may be closed by this pull request
const [run, setRun] = useState(false);
const [tour, setTour] = useState(!(localStorage.getItem("tour") === "true"));
const [open, setOpen] = useState(tour);
const [mapEntity, setMapEntity] = useState({});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracting the mapEntity state allows for an easy implementation of the inspector panel demo.

site/src/Map.jsx Outdated
const [pmTilesReady, setPmTilesReady] = useState(false)
const [cursor, setCursor] = useState('auto');
const [mapEntity, setMapEntity] = useState({});
export default function Map({ mode, mapEntity, setMapEntity }) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only contentful change: extracting the mapEntity state. All else is formatting changes

interactiveLayers(layers);
}, [buildings, places, transportation, interactiveLayers]);

return (
<div className="dropdown dropdown--hoverable theme-selector">
<div className="dropdown dropdown--hoverable theme-selector tour-layers">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only contentful change. This was added so the tour has a 'target'. All else is formatting changes.

if ([EVENTS.STEP_AFTER, EVENTS.TARGET_NOT_FOUND].includes(event.type)) {
const nextStepIndex =
event.index + (event.action === ACTIONS.PREV ? -1 : 1);
if (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching from step 4 to 5 means we need to open the inspector panel. This also requires a slight delay of the tour so that the target exists when the tour attempts to advance.

setTimeout(() => {
setStepIndex(nextStepIndex);
}, 100);
} else if (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing the inspector panel. If other steps are added, it should be noted that the constants 4 and 5 might have to be updated, depending on where the steps are placed.

@@ -87,7 +87,7 @@ function DownloadButton() {
className={`button button--primary ${loading ? "disabled" : ""}`}
onClick={handleDownloadClick}
>
<div className="wrapper">
<div className="wrapper tour-download">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as tour target

</div>
<b className="navbar__title">Overture Maps</b>
<b className="navbar__title tour-homepage">Overture Maps</b>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as tour target. All other changes are formatting

site/src/App.css Outdated
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are a result of prettier formatting.

site/package.json Show resolved Hide resolved
site/src/App.css Outdated Show resolved Hide resolved
site/src/nav/DarkModeToggle.jsx Show resolved Hide resolved
site/src/nav/DarkModeToggle.jsx Show resolved Hide resolved
@eti7075 eti7075 requested a review from Bonkles June 6, 2024 20:36
@Bonkles Bonkles merged commit 7532592 into main Jun 11, 2024
1 check passed
@Bonkles Bonkles deleted the tour branch June 11, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create tour / walkthrough to bring new users up to speed
2 participants