feature: add view query param to visit satellite view#1631
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@sunilsabatp, we have a third option "Vegetation Change". Check the project with the slug |
I'll look into it |
📝 Changed routes:
Commit dd7cd51 (https://planet-webapp-c0k9o76nu-planetapp.vercel.app). |
WalkthroughThis update modifies the routing and tab selection logic for a project details interface. The main changes involve synchronizing the selected view mode with the URL's Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ProjectTabs
participant Router
User->>ProjectTabs: Clicks a tab
ProjectTabs->>Router: push(new URL with updated site and view params)
Router-->>ProjectTabs: Updates query params
ProjectTabs->>ProjectTabs: useEffect detects query.view change
ProjectTabs->>ProjectTabs: Sets selectedMode based on query.view
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/features/projects/components/maps/ProjectTabs.tsx (1)
27-39: Consider standardizing URL parameter values and internal mode namesThere's a discrepancy between URL parameter values and internal mode names:
field-datamaps tolocationtime-travelmaps toimageryvegetationmaps tovegetationsite-datain the redirect URL (in[p].tsx) isn't explicitly handledConsider standardizing these naming conventions in a future refactoring for better code clarity.
Also applies to: 52-56, 73-77, 98-102
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
pages/[p].tsx(1 hunks)src/features/projects/components/maps/ProjectTabs.tsx(4 hunks)src/features/projects/screens/SingleProjectDetails.tsx(0 hunks)
💤 Files with no reviewable changes (1)
- src/features/projects/screens/SingleProjectDetails.tsx
🧰 Additional context used
🧠 Learnings (1)
src/features/projects/components/maps/ProjectTabs.tsx (1)
Learnt from: mohitb35
PR: Plant-for-the-Planet-org/planet-webapp#2329
File: src/features/projectsV2/ProjectsMap/ProjectMapTabs/index.tsx:29-37
Timestamp: 2025-01-23T04:33:49.974Z
Learning: The commented-out code in `src/features/projectsV2/ProjectsMap/ProjectMapTabs/index.tsx` is for a delayed satellite tab feature, including `allTabsList` array and `setSeparatorVisibility` function.
🧬 Code Graph Analysis (1)
src/features/projects/components/maps/ProjectTabs.tsx (1)
src/features/common/Layout/ProjectPropsContext.tsx (1)
ProjectPropsContext(6-84)
🔇 Additional comments (7)
pages/[p].tsx (1)
118-126: URL parameter enhancement adds better navigation supportThe addition of
view=site-dataparameter to the redirection URL implements the new feature for visiting different satellite views via URL parameters. The optional chaining forproject?.slugis also a good defensive programming practice to prevent potential null reference errors.src/features/projects/components/maps/ProjectTabs.tsx (6)
15-15: Properly expanded router object destructuringGood addition of
queryandpushfrom the router object to support the new URL parameter functionality.
17-25: Appropriately expanded context consumptionThe additional context values (
selectedSite,project,geoJson, andplantLocations) are necessary to implement the URL parameter-based navigation system.
27-39: Well-implemented URL parameter to mode mappingThis useEffect hook correctly synchronizes the UI state with URL parameters, mapping the view query parameter to the appropriate internal mode. The conditional check for
plantLocationsensures the component doesn't attempt to set the mode before data is available.
52-56: Field Data tab now updates URLThe onClick handler now properly updates the URL with the
view=field-dataparameter when the tab is clicked.
73-77: Time Travel tab now updates URLThe onClick handler now properly updates the URL with the
view=time-travelparameter when the tab is clicked.
98-102: Vegetation Change tab now updates URLThe onClick handler now properly updates the URL with the
view=vegetationparameter when the tab is clicked, which fulfills the requirement mentioned by mariahosfeld in the PR comments.
|
Closing this as outdated. @mariahosfeld in case this is a desired feature, could you update the backlog? |
![Screenshot of /[p]](https://images.weserv.nl?url=https://sjc.microlink.io/fTjSIfD4ITzUN7pBZRM1VdXOVGxmFO8e0B-Uw9--syMLgfo7PTkSIHwcW44E8AaaeJ7Ix7Gwg1EgP_dBhL5LQg.png&w=600)
feature ->
viewquery param to visittime-travelorsite-dataviewvisit to get result ->
yucatan?site=site_1P7gSIcbHILfsi3&view=time-traveltwo possible value for
viewquery param (i.e time-travel, site-data, vegetation)site-data is the default view