Refresh Button for Map Positions with Notification Pop-Ups#506
Open
Refresh Button for Map Positions with Notification Pop-Ups#506
Conversation
…, elapsed time in tooltip Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
Author
|
@jimjeffers - This is ready for your review. Please read the note to make sure you don't disagree with how this was implemented (follows current deployment map implementation). |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Refresh button on maps
RefreshButtoninpackages/react-uithat matches existing map control styling.onRequestRefresh,refreshLoading,refreshLastRefreshed, etc.) and renders the refresh button next to the existing buttons not the mapuseRefreshPositionshookapps/lrauv-dash2/lib/useRefreshPositions.tsxthat:lastRefreshed, and exposesmarkInitialLoadDoneso the “next refresh” countdown can start after the first position load.vehiclePosquery keys so refresh updates the same data the map/paths use.formatElapsedTimehelperpackages/utilsto format a duration in ms as a short string (e.g.45s,23m,5h:30m,2d:12h,6M,2y).Deployment map and overview map
DeploymentMapand the overview map on the index page useuseRefreshPositionsand passrefreshAll,refreshLoading,lastRefreshed, and related props into the shared Map component so the new refresh button appears and works on both maps.preferredParams(e.g. deployment time range) can be passed so the hook aligns with the map’s time window.VehiclePath and “first load” timing
VehiclePathnow accepts anonPositionDataLoadedcallback and calls it once when position data (e.g. GPS fixes) is first available.markInitialLoadDoneso the refresh tooltip’s “last reload” / “next auto-refresh” countdown starts when the path data has loaded (with a 30s fallback if no path ever loads).Default “from” for position queries
fromof 24 hours ago instead of0.VehicleListandVehiclePathso the map can show recent positions even without deployment bounds.Vehicle path tooltip
formatElapsedTimefor the “time since” part so it matches the refresh button’s compact format.Styling
packages/react-ui/src/css/base.cssupdated with styles for the refresh button and the refresh-position toast.Exports
formatElapsedTimeis exported from@mbari/utils.Refresh button
NOTE: In dash4, the map only shows the positions of the vehicle for the last 24 hours, whereas, dash5 shows either the positions since the beginning of an active deployment or it shows the entirety of the vehicle path for a recent previous deployment. The notifications for each reflect what is shown on the map (ie the number of GPS fixes will be much higher on dash5 since it is showing more positions).