Skip to content

Nearby-in-time location suggestions - #59

Merged
Majorfi merged 4 commits into
Majorfi:mainfrom
prostmich:nearby-in-time-suggestions
Jul 22, 2026
Merged

Nearby-in-time location suggestions#59
Majorfi merged 4 commits into
Majorfi:mainfrom
prostmich:nearby-in-time-suggestions

Conversation

@prostmich

Copy link
Copy Markdown
Contributor

Adds a "Nearby in time" suggestion category: the geolocated photos closest in time to the selected photo, shown as individual points ordered by proximity and labeled with their time distance (for example, "2 min before").

Changes

Backend:

  • getNeighborAssets query, neighborClusters list in the suggestions response, with a positive or negative secondsFromRef per point
  • Time window configurable via SUGGESTIONS_NEIGHBOR_WINDOW_HOURS (default 6)

Frontend:

  • New "Suggestions" tab rendering time-ranked points
image

Closes #58

Suggest locations from the closest photos in time (before/after) within
a 6h window, ranked by proximity.
Add SUGGESTIONS_NEIGHBOR_WINDOW_HOURS environment variable (default 6)
to tune the
"Nearby in time" search window

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “Nearby in time” suggestion category that surfaces geolocated photos closest (before/after) to a selected asset’s timestamp, with a configurable search window, and renders these points in the UI labeled by time offset.

Changes:

  • Backend: adds neighborClusters to suggestions response, with per-point secondsFromRef, plus SUGGESTIONS_NEIGHBOR_WINDOW_HOURS configuration and DB query support.
  • Frontend: introduces the neighbor category (labels/colors/max items), renders neighbor points, and formats signed offsets (e.g., “2 min before”).
  • Docs/ops: updates README, env example, and compose files to document and pass through the new configuration.

Reviewed changes

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

Show a summary per file
File Description
src/utils/suggestions.ts Adds neighbor category metadata and formatNeighborOffset formatter.
src/shared/types/suggestion.ts Extends suggestion types to include neighborClusters and optional secondsFromRef.
src/shared/services/backendApi.ts Normalizes neighborClusters in fetchSuggestions.
src/shared/services/backendApi.guards.ts Updates type guards to validate neighborClusters and optional secondsFromRef.
src/features/suggestions/useSuggestionState.ts Adds neighbor color, stable key includes offset, and per-category max item cap.
src/features/suggestions/useSuggestions.ts Adds “Nearby in time” category construction from API response.
src/features/suggestions/SuggestionsPill.tsx Displays time-offset label for neighbor items instead of count.
src/features/suggestions/Readme.md Documents the new neighbor suggestion category behavior.
README.md Documents the feature and new env var.
docker-compose.yml Passes SUGGESTIONS_NEIGHBOR_WINDOW_HOURS to backend container.
docker-compose.prod.yml Passes SUGGESTIONS_NEIGHBOR_WINDOW_HOURS to backend container (prod).
backend/types.go Adds SecondsFromRef to LocationCluster and NeighborClusters to suggestions response.
backend/suggestionService.go Wires neighbor query into suggestion generation and builds per-asset neighbor points.
backend/suggestionService_test.go Adds tests covering neighbor clusters ordering/window behavior; updates service constructor usage.
backend/main.go Passes configured neighbor window hours into suggestion service construction.
backend/interfaces.go Extends SuggestionStore with getNeighborAssets.
backend/handlers.go Defines neighborLimit constant used for neighbor suggestions.
backend/handlers_test.go Updates tests to use new suggestion service constructor; asserts non-nil neighbor clusters.
backend/database.go Implements getNeighborAssets with window filtering and closest-first ordering.
backend/database_test.go Adds test for neighbor window filtering, ordering, and limit behavior.
backend/config.go Adds NeighborWindowHours config/env var with validation.
backend/config_test.go Adds test for neighbor window env override.
.env.example Documents SUGGESTIONS_NEIGHBOR_WINDOW_HOURS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/suggestionService.go Outdated
Comment on lines +81 to +85
if neighborAssets, err := s.db.getNeighborAssets(ctx, userID, *dateRef, s.neighborWindow, neighborLimit); err != nil {
log.Printf("[Suggest] Failed to get neighbor assets: %v", err)
} else if parseErr == nil {
response.NeighborClusters = buildNeighborPoints(neighborAssets, refTime)
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread backend/database.go
@Majorfi

Majorfi commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Thank you for the PR!
I have a busy week but I will try to do a proper review before thursday. If not it will be next week!

@Majorfi Majorfi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM! Great job, thank you for the contribution!

@Majorfi
Majorfi merged commit 7f9bdd3 into Majorfi:main Jul 22, 2026
1 of 3 checks passed
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.

[Feature request] Suggest location from photos taken just before/after

3 participants