Skip to content

Add apartment comparison feature (frontend)#422

Open
NigelTatem wants to merge 2 commits into
cornell-dti:mainfrom
NigelTatem:comparison-feature-frontend
Open

Add apartment comparison feature (frontend)#422
NigelTatem wants to merge 2 commits into
cornell-dti:mainfrom
NigelTatem:comparison-feature-frontend

Conversation

@NigelTatem
Copy link
Copy Markdown

@NigelTatem NigelTatem commented Apr 12, 2026

Summary

  • Adds a new Comparison Page (/compare) that lets users compare up to 4 apartments side-by-side across price, rating, location, amenities, and more.
  • Includes an Add Apartment Modal with two tabs - "Saved Properties" (grid of saved apartments) and "Search Properties" (debounced search with result cards).
  • Adds a "Compare" button on ApartmentPage so users can add the current apartment to the comparison from its detail page.
  • New components: ComparisonPage, AddApartmentModal, SearchResultCard, SavedAptCard, AmenityIcon.

Files Changed

File Description
frontend/src/pages/ComparisonPage.tsx Main comparison page with 4-slot layout, sticky row labels, horizontascroll
frontend/src/components/Comparison/AddApartmentModal.tsx Modal with Saved/Search tabs for adding apartments to compare
frontend/src/components/Comparison/SearchResultCard.tsx Search result card with photo, metadata, rating, selected state
frontend/src/components/Comparison/SavedAptCard.tsx Saved property card for the grid view in the modal
frontend/src/components/Comparison/AmenityIcon.tsx Renders check/X/dash icons for amenity availability
frontend/src/App.tsx Added /compare route
frontend/src/pages/ApartmentPage.tsx Added "Compare" button linking to comparison page
common/types/db-types.ts Added Tag and TagWithId types

What's Done (Frontend)

  • 4-slot comparison layout matching Figma designs
  • Empty state with "Add an Apartment" placeholder cards
  • Sticky row labels that stay visible during horizontal scroll
  • Add Apartment modal with Saved Properties tab (grid layout)
  • Add Apartment modal with Search Properties tab (debounced search)
  • Search result cards with selected/unselected states
  • Remove apartment from comparison (X button)
  • "Compare" button on individual apartment pages
  • URL sync via ?ids= query parameter
  • Amenity icons (check / X / dash for unknown)

Still Needs To Be Done

Backend

  • Room size field - not currently in the data model; comparison page shows "—" placeholder
  • Year built field - not in the data model; shows "—" placeholder
  • Amenity boolean fields (laundry, gym, parking, pool, pet-friendly) - not in the data model; all show dash icons currently
  • Saved properties endpoint - modal's "Saved Properties" tab needs an API to fetch the user's saved/favorited apartments

Frontend (follow-up)

  • Wire up "Saved Properties" tab to real saved-apartments API once backend is ready
  • Populate amenity rows with real data once backend fields exist
  • Add room size and year built once backend provides them
  • Mobilelayout adjustments
  • Unit tests for comparison components

Test Plan

  • Navigate to /compare - empty state renders 4 placeholder cards
  • Click "Add an Apartment" - modal opens with Search tab
  • Type in search - results appear after debounce
  • Select a result and confirm - apartment populates in the slot
  • Add up to 4 apartments - all slots fill correctly
  • Click X on an apartment - slot returns to empty state
  • Horizontal scroll - row labels stay pinned on the left

Implements the comparison feature frontend allowing users to compare
up to 4 apartments side-by-side with details like price, location,
travel times, and amenity placeholders.

- New /compare route with ?ids= query param support
- 4-slot layout with sticky row labels and scrollable columns
- "Add Apartment" modal with Saved Properties and Search tabs
- Reusable components: AmenityIcon, SearchResultCard, SavedAptCard
- Tag/TagWithId types added to support ApartmentPage tags UI
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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