Skip to content

Conversation

@raphael-stefan
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings August 30, 2025 00:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the map responsiveness by adding Airbnb-like anchored popups for spaces and properties, along with viewport-based filtering. The changes improve the user experience by showing interactive popups on desktop while maintaining mobile-friendly bottom sheets, and implementing dynamic content filtering based on the visible map region.

Key Changes

  • Added anchored popup components for spaces and properties with MapOverlayPortal system
  • Implemented viewport-based filtering to show only spaces visible in current map bounds
  • Enhanced mobile responsiveness with conditional popup behavior

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
frontend/src/pages/browse/components/GoogleMap.tsx Adds MapOverlayPortal, SpaceAnchoredPopup, PropertyAnchoredPopup components and enhanced marker interaction logic
frontend/src/pages/browse/BrowsePage.jsx Implements viewport-based filtering, fallback logic for empty regions, and integrates new map features

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

useEffect(() => {
return () => {
propertyMarkersRef.current = cleanupMarkers(propertyMarkersRef.current);
areaMarkersRef.current = cleanupMarkers(areaMarkersRef.current);
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

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

Missing space after 'cleanupMarkers(areaMarkersRef.current);' - the line should be properly indented to match the surrounding code structure.

Suggested change
areaMarkersRef.current = cleanupMarkers(areaMarkersRef.current);
areaMarkersRef.current = cleanupMarkers(areaMarkersRef.current);

Copilot uses AI. Check for mistakes.
// ✅ CLEAN: Simple marker design with Deep Teal
const markerElement = document.createElement('div');
markerElement.className = 'flex items-center justify-center w-8 h-8 bg-teal-500 text-white rounded-full border-2 border-white shadow-soft cursor-pointer hover:bg-teal-600 transition-all duration-200 hover:scale-110';
markerElement.className = 'flex items-center justify-center w-8 h-8 bg-[#4668AB] text-white rounded-full border-2 border-white shadow-soft cursor-pointer hover:bg-[#3c5997] transition-all duration-200 hover:scale-110';
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

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

The color values '#4668AB' and '#3c5997' are hardcoded magic values that appear multiple times throughout the file. Consider extracting these into named constants or CSS variables for better maintainability.

Copilot uses AI. Check for mistakes.
Comment on lines +345 to +346
const price = space.baseRate
? `$${space.baseRate}${space.rateType ? '/' + space.rateType.toLowerCase().replace('ly','').replace('y','y') : ''}`
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

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

The string manipulation logic .replace('ly','').replace('y','y') is flawed - it removes 'ly' but then adds 'y' back, which would result in incorrect transformations. For example, 'yearly' would become 'yeary' instead of 'year'.

Suggested change
const price = space.baseRate
? `$${space.baseRate}${space.rateType ? '/' + space.rateType.toLowerCase().replace('ly','').replace('y','y') : ''}`
// Map rateType to singular form for display
const rateTypeMap: { [key: string]: string } = {
daily: 'day',
weekly: 'week',
monthly: 'month',
yearly: 'year',
};
const price = space.baseRate
? `$${space.baseRate}${space.rateType ? '/' + (rateTypeMap[space.rateType.toLowerCase()] || space.rateType.toLowerCase()) : ''}`

Copilot uses AI. Check for mistakes.
Comment on lines +464 to +466
const lngOk = east >= west
? c.lng <= east && c.lng >= west
: (c.lng <= east || c.lng >= west); // antimeridian wraparound
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

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

The antimeridian wraparound logic is incorrect. When east < west (crossing 180°/-180°), a longitude is valid if it's either >= west OR <= east, but the current condition uses AND which would never be true when crossing the antimeridian.

Copilot uses AI. Check for mistakes.

mapInstanceRef.current = map;

// No need for a persistent projection overlay; MapOverlayPortal manages its own
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

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

This comment appears to be incomplete or refers to removed code. It should either be removed or expanded to clearly explain what MapOverlayPortal manages and why no persistent overlay is needed.

Suggested change
// No need for a persistent projection overlay; MapOverlayPortal manages its own
// No need for a persistent projection overlay here.
// MapOverlayPortal is responsible for rendering overlays that require map projection.
// It creates and manages its own overlay instances as needed, so a persistent overlay is unnecessary in this component.

Copilot uses AI. Check for mistakes.
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.

2 participants