Frontend School

Interactive POI Map Markers

Machine Coding
easy

Interactive POI Map Markers

Easy
Machine Coding
React
Frontend
Map
Markers
State Management
UI

Overview

Imagine you're building an internal tool for a logistics company to manage pickup and delivery locations. A critical feature for operational planning is the ability to visualize these points of interest (POIs) on a map and interact with them. This problem focuses on building a core interactive component where users can select a POI from a list and see its corresponding marker highlighted on a simulated map, and vice-versa.

What you need to do / Task

Your goal is to build a React component that displays a list of Points of Interest (POIs) and their corresponding markers on a simulated map. The component should allow for single-selection interaction across both views.

  1. Render POI List: Display the name of each POI from the provided mockPOIs data in a scrollable list.
  2. Render Map Markers: For each POI, render a visual marker (e.g., an emoji) on the simulated map area at its specified x and y coordinates.
  3. Synchronized Selection: Implement logic such that:
    • Clicking a POI in the list highlights that list item and its corresponding marker on the map.
    • Clicking a marker on the map highlights that marker and its corresponding POI in the list.
  4. Single Selection: Ensure that only one POI (and its corresponding marker) can be selected at any given time. Selecting a new POI should deselect the previously active one.

UI/UX expectations

  • The application should have two main panels: one for the POI list and one for the map view.
  • When a POI list item is selected, it should have a clear visual indicator (e.g., a distinct background color or border).
  • When a map marker is selected, it should also have a clear visual indicator (e.g., larger size, different color, or a glow effect).
  • Interactions should feel responsive and provide immediate visual feedback.

Acceptance criteria

  • All POIs from mockPOIs are correctly displayed in the list panel.
  • All POIs have a corresponding marker rendered on the map-area at their respective x, y coordinates.
  • Clicking a POI in the list highlights that list item and its corresponding map marker.
  • Clicking a map marker highlights that marker and its corresponding POI in the list.
  • Only one POI and its associated marker are highlighted/selected at any given time.
  • The UI updates responsively to user interactions.

Constraints

Constraints & assumptions

  • You are not required to integrate with any actual map library (e.g., Google Maps, Leaflet). The map-area div should serve as a simulated map container.
  • Marker positioning (x, y coordinates) is provided directly in the mock data and represents pixel offsets relative to the top-left of the map-area container. You do not need to convert latitude/longitude.
  • The data is static and provided as a mock array; no API calls are necessary.
  • Focus on building the React component, managing its state, and handling user interactions.
  • The application should run in a standard browser environment.

Out of scope

  • Advanced map features like zooming, panning, routing, or geocoding.
  • Server-side logic or data persistence.
  • Extensive accessibility features beyond basic click handling.
  • Comprehensive error handling.

What interviewers evaluate

  • Correctness: Does the application meet all the functional requirements and acceptance criteria?
  • State Management: Is React state managed effectively to handle selection logic and UI updates?
  • Code Quality: Is the code clean, readable, well-structured, and does it follow React best practices?
  • Component Design: Are components appropriately separated and composed for clarity and maintainability?

Loading editor...