Skip to content

Add and remove itinerary days from the hotspot modal - #60

Open
nleiby wants to merge 3 commits into
rawcomposition:mainfrom
nleiby:up/hotspot-modal-itinerary
Open

Add and remove itinerary days from the hotspot modal#60
nleiby wants to merge 3 commits into
rawcomposition:mainfrom
nleiby:up/hotspot-modal-itinerary

Conversation

@nleiby

@nleiby nleiby commented Aug 25, 2026

Copy link
Copy Markdown

Locations can currently only be scheduled from the itinerary page, and it can be hard to remember which hotspots are geographically close when you're on the itinerary page and can't see the map.

This PR adds a day picker to the hotspot modal, so when you find a hotspot on the map you can put it on a day without navigating away.

The trigger sits with Save / Directions / eBird, and reads "Itinerary" or "On 2 days" depending on state. Inside is a DropdownMenuCheckboxItem per day, labelled Day 2 · Tue, Sep 8. Checking schedules the hotspot, unchecking removes it — one control for both, which also means the menu doubles as an at-a-glance view of where the hotspot already sits, and the menu stays open so you can set several days in one go.

The control only appears for a saved hotspot on a trip that has dates. Unsaved hotspots are excluded because the itinerary references trip.hotspots by id, so scheduling one would render as "Unknown Location"; a trip with no date range has no days to offer.

Notes:

  • Days are derived from the trip's date range rather than stored, so I pulled that derivation out of pages/[tripId]/itinerary.tsx into getTripDays() in lib/itinerary.ts and used it in both places. The modal needs it to build the virtual day ids, to send dayIds so the server can densify, and to apply the optimistic cache update against a day that may not be persisted yet.
  • Verified against a trip with a date range and an empty itinerary array — the case where every day id is virtual. Adding to <tripId>-d1 correctly densifies all three days server-side and lands the location on day 2; removing clears it.
  • Both mutations go through useTripMutation with optimistic updateCache plus reconcile on the server's returned itinerary. Because the URL contains the day id, each day renders a small component with its own mutations rather than one mutation with a computed URL — happy to restructure if you'd rather see that done differently.

Locations could only be scheduled from the itinerary page. The hotspot
modal now has a day picker, with a checkbox per day so the same control
schedules and unschedules.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@rawcomposition

Copy link
Copy Markdown
Owner

Thanks! I like this idea, though I think we need to put a little more thought into the best way to implement it. Currently, it's causing the eBird and kebab menu buttons to become condensed, and the Itinerary button wraps when day(s) are selected.

It may also be nice to see at a glance which day(s) the hotspot is assigned to instead of just "One 1 day".

Screenshot 2026-08-25 at 1 31 08 PM Screenshot 2026-08-25 at 1 33 30 PM

I'll put some thought into this and see if I can think of a better solution.

nickleiby and others added 2 commits August 25, 2026 22:21
Frees room in the action row, which no longer fits once the itinerary
control is present, and puts the source link with the numbers it sourced.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A day count says nothing useful; the date the hotspot is scheduled for
is the thing worth seeing without opening the menu.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@nleiby

nleiby commented Aug 26, 2026

Copy link
Copy Markdown
Author

Good comments. I suggested two changes in the new commits:

  • Move the eBird link button out of the kebab row down into the hotspot info row- it's not a button about a trip action, it's a link information about the hotspot, analogous to species count, checklist count, etc.

  • Render the "itinerary" text if the hotspot is not added to a date, the date if it is, a "+x" text if it's added to multiple dates.

image image image image

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.

3 participants