Skip to content

Conversation

timDeHof
Copy link
Owner

@timDeHof timDeHof commented Aug 2, 2025

closes #29

  • Added popup component with point name and description
  • Implemented dark mode styling for map popups
  • Added hover effects and selected point state management
  • Improved map marker interactions and visual feedback

BREAKING CHANGE: MapPoint type properties changed (label -> name, added description)

Summary by CodeRabbit

  • New Features

    • Map popups now display a point’s name and description, with improved appearance in dark mode.
    • Sidebar and dashboard items highlight and synchronize with the selected map point on hover for better visual feedback.
    • Marker tooltips and icons dynamically reflect selection state for enhanced interactivity.
  • Enhancements

    • Added support for dynamic icon colors in sidebar buttons.
    • Improved map navigation by separating fly-to animations from simple selection.
  • Style

    • Updated map popup styles for better readability and consistency, especially in dark mode.

- Added popup component with point name and description
- Implemented dark mode styling for map popups
- Added hover effects and selected point state management
- Improved map marker interactions and visual feedback

BREAKING CHANGE: MapPoint type properties changed (label -> name, added description)
@timDeHof timDeHof linked an issue Aug 2, 2025 that may be closed by this pull request
3 tasks
Copy link

vercel bot commented Aug 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nuxt-travel-log ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 2, 2025 1:55am

Copy link

coderabbitai bot commented Aug 2, 2025

Walkthrough

This update enhances the map and sidebar interactivity by synchronizing hover and selection states between map markers, sidebar items, and dashboard cards. It introduces map popups that display location names and descriptions, adds dynamic styling for dark mode, and refines store types and logic to support these features and interactions.

Changes

Cohort / File(s) Change Summary
Map Marker & Popup Enhancements
components/app/map.client.vue
Enhanced marker tooltips with pointer styling, dynamic content, selection highlighting, and added popups displaying location name and description.
Sidebar & Dashboard Interactivity
pages/dashboard.vue, pages/dashboard/index.vue, components/sidebar-button.vue
Sidebar buttons and dashboard cards now highlight and update map selection on hover; icon color is dynamic; new iconColor prop added to sidebar buttons.
Map & Sidebar Store Updates
stores/map.ts, stores/sidebar.ts, stores/locations.ts
Map store tracks selected point and controls fly-to behavior; sidebar items can reference a map point; location data structure updated for full object mapping.
Type Updates
lib/types.ts
MapPoint type updated: label renamed to name, added description property.
Map Popup Styling
assets/css/main.css
Added and adjusted CSS rules for map popups, including dark theme support and improved popup appearance.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Sidebar
  participant DashboardCard
  participant MapClient
  participant MapStore

  User->>Sidebar: Hover/click sidebar item
  Sidebar->>MapStore: Set selectedPoint
  MapStore->>MapClient: Notify selectedPoint change
  MapClient->>Map: Highlight marker, show popup

  User->>DashboardCard: Hover/click card
  DashboardCard->>MapStore: Set selectedPoint
  MapStore->>MapClient: Notify selectedPoint change
  MapClient->>Map: Highlight marker, show popup

  User->>MapClient: Hover/click marker
  MapClient->>MapStore: Set selectedPoint
  MapClient->>Map: Show popup, highlight marker
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Markers respond to hover and click events (#29)
Popups show location name and preview (#29)
Hovering a location in the sidebar or on a card zooms into that location on the map (#29)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes detected.

Possibly related PRs

Poem

A hop on the map, a click on a spot,
Now popups appear, revealing a lot.
Hover the sidebar, the dashboard, the pin—
The map leaps to action, let journeys begin!
With colors that shimmer in dark or in light,
The traveler’s quest is a visual delight.
🗺️🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ntl-29

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
assets/css/main.css (1)

11-37: Consider consolidating repetitive tip styling.

The dark theme popup styling is comprehensive and handles all anchor positions correctly. However, the tip styling could be optimized.

Consider consolidating the repetitive border color assignments:

  .maplibregl-popup-tip {
-    @apply border-t-gray-800;
+    @apply border-gray-800;
  }
-  .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
-  .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip,
-  .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip {
-    @apply border-t-gray-800;
-  }
-
-  .maplibregl-popup-anchor-top .maplibregl-popup-tip,
-  .maplibregl-popup-anchor-top-right .maplibregl-popup-tip,
-  .maplibregl-popup-anchor-top-left .maplibregl-popup-tip {
-    @apply border-b-gray-800;
-  }
-
-  .maplibregl-popup-anchor-left .maplibregl-popup-tip {
-    @apply border-r-gray-800;
-  }
-
-  .maplibregl-popup-anchor-right .maplibregl-popup-tip {
-    @apply border-l-gray-800;
-  }

This approach sets a base border color and relies on MapLibre's default tip styling for directional borders.

stores/map.ts (1)

32-46: LGTM! Well-designed animation control logic.

The selected point navigation logic effectively manages fly-to animations and provides appropriate fallback behavior. The separation of concerns between bounds fitting and point selection is well-implemented.

The TODO comment at line 34 indicates a future enhancement for configurable animations. Would you like me to help implement a user preference system for controlling map animations, or should this be tracked in a separate issue?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 594e1ba and 8f89fcd.

📒 Files selected for processing (9)
  • assets/css/main.css (1 hunks)
  • components/app/map.client.vue (1 hunks)
  • components/sidebar-button.vue (2 hunks)
  • lib/types.ts (1 hunks)
  • pages/dashboard.vue (2 hunks)
  • pages/dashboard/index.vue (2 hunks)
  • stores/locations.ts (1 hunks)
  • stores/map.ts (1 hunks)
  • stores/sidebar.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
stores/sidebar.ts (1)
lib/types.ts (1)
  • MapPoint (14-18)
stores/map.ts (1)
lib/types.ts (1)
  • MapPoint (14-18)
🔇 Additional comments (16)
stores/sidebar.ts (2)

1-1: LGTM: Clean import for MapPoint type.

The import is properly structured and necessary for the new location property in SidebarItem.


8-8: LGTM: Well-designed optional location property.

The optional location property with MapPoint | null type provides the necessary link between sidebar items and map points while maintaining backward compatibility.

lib/types.ts (1)

16-17: LGTM: Breaking change properly implemented.

The property rename from "label" to "name" and the addition of "description" are well-designed for the popup enhancement. The nullable description type provides appropriate flexibility.

assets/css/main.css (1)

8-10: LGTM: Appropriate close button styling.

The padding utility class provides better visual spacing for the popup close button.

components/sidebar-button.vue (2)

7-7: LGTM: Well-typed iconColor prop.

The optional prop with specific string literal types provides type safety while maintaining backward compatibility.


24-28: LGTM: Clean implementation of dynamic icon styling.

The CSS class binding properly applies the iconColor prop to provide visual feedback for selected states.

stores/locations.ts (2)

17-17: LGTM: Enhanced sidebar item with location association.

Adding the full location object to sidebar items properly supports the new map integration functionality.


19-19: Verify external /api/locations response matches updated MapPoint type

I wasn’t able to locate a local handler for /api/locations in this repo, which suggests you’re calling an external service or a backend not checked in here. Before assigning the full data.value array to mapStore.mapPoints, please confirm that the endpoint returns objects shaped like:

  • id: number|string
  • name: string
  • description: string
  • lat: number
  • long: number

Recommended steps:

  • Review the API contract or OpenAPI/OpenAPI-like spec for /api/locations.
  • Manually test or write an integration test (e.g. with a curl call or via your test suite) to ensure name and description are always present.
  • (Optional) Add runtime schema validation (e.g. Zod, io-ts) around your useFetch call to catch mismatches early.
components/app/map.client.vue (3)

32-40: LGTM! Well-implemented interactive marker behavior.

The tooltip implementation correctly handles the breaking change from point.label to point.name, adds appropriate cursor styling, and properly manages hover states without triggering unwanted map animations through the selectedPointWithoutFlyTo method.


44-44: LGTM! Clear visual feedback for selected markers.

The dynamic icon color implementation provides excellent visual feedback by highlighting selected markers with the accent color.


48-55: LGTM! Well-structured popup component.

The popup implementation effectively displays location information with proper semantic HTML structure and conditional rendering for optional descriptions. The styling classes are appropriate for the content hierarchy.

pages/dashboard/index.vue (1)

4-4: LGTM! Excellent integration of map store selection state.

The dynamic card styling provides clear visual feedback when locations are selected, and the border colors appropriately highlight the connection between dashboard cards and map markers.

Also applies to: 22-26

pages/dashboard.vue (1)

5-5: LGTM! Clean store integration.

stores/map.ts (3)

1-2: LGTM! Well-structured state additions.

The new state variables and imports are properly typed and support the enhanced map interaction functionality.

Also applies to: 7-8


10-13: LGTM! Essential method for controlling map animations.

The selectedPointWithoutFlyTo method provides necessary control over map animations during hover interactions, properly setting the flag before updating the selected point.


19-30: LGTM! Proper bounds calculation with good separation of concerns.

The bounds calculation correctly handles multiple map points and applies consistent padding. The scoping of the bounds variable outside the reactive effect enables its use in the second effect for coordinated map navigation.

Comment on lines +68 to +70
:icon-color="mapStore.selectedPoint === item.location ? 'text-accent' : undefined"
@mouseenter="mapStore.selectedPoint = item.location ?? null"
@mouseleave="mapStore.selectedPoint = null"
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use selectedPointWithoutFlyTo for consistent hover behavior.

The dynamic icon color implementation is excellent, but the mouse event handlers should use selectedPointWithoutFlyTo instead of direct assignment to avoid unwanted map animations during hover interactions.

-            @mouseenter="mapStore.selectedPoint = item.location ?? null"
-            @mouseleave="mapStore.selectedPoint = null"
+            @mouseenter="mapStore.selectedPointWithoutFlyTo(item.location ?? null)"
+            @mouseleave="mapStore.selectedPointWithoutFlyTo(null)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:icon-color="mapStore.selectedPoint === item.location ? 'text-accent' : undefined"
@mouseenter="mapStore.selectedPoint = item.location ?? null"
@mouseleave="mapStore.selectedPoint = null"
:icon-color="mapStore.selectedPoint === item.location ? 'text-accent' : undefined"
@mouseenter="mapStore.selectedPointWithoutFlyTo(item.location ?? null)"
@mouseleave="mapStore.selectedPointWithoutFlyTo(null)"
🤖 Prompt for AI Agents
In pages/dashboard.vue around lines 68 to 70, the mouse event handlers currently
assign directly to mapStore.selectedPoint, causing unwanted map animations on
hover. Update the @mouseenter and @mouseleave handlers to assign to
mapStore.selectedPointWithoutFlyTo instead, ensuring consistent hover behavior
without triggering map fly-to animations.

Comment on lines +27 to +28
@mouseenter="mapStore.selectedPoint = location"
@mouseleave="mapStore.selectedPoint = null"
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use selectedPointWithoutFlyTo for consistency with hover interactions.

The direct assignment to mapStore.selectedPoint may trigger unwanted fly-to animations during hover. For consistency with the map marker hover behavior, consider using the selectedPointWithoutFlyTo method.

-        @mouseenter="mapStore.selectedPoint = location"
-        @mouseleave="mapStore.selectedPoint = null"
+        @mouseenter="mapStore.selectedPointWithoutFlyTo(location)"
+        @mouseleave="mapStore.selectedPointWithoutFlyTo(null)"
🤖 Prompt for AI Agents
In pages/dashboard/index.vue around lines 27 to 28, replace the direct
assignment to mapStore.selectedPoint in the mouseenter and mouseleave event
handlers with calls to the selectedPointWithoutFlyTo method to prevent unwanted
fly-to animations during hover and maintain consistency with other map marker
hover interactions.

@timDeHof timDeHof merged commit 65bc060 into main Aug 2, 2025
7 checks passed
@timDeHof timDeHof deleted the ntl-29 branch August 4, 2025 22:41
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.

As a traveler, I want to click markers to view location details
1 participant