feat: add group address book and modal location pickers#108
Merged
Conversation
- Add GroupLocation Ash resource with CRUD actions and policies - Add SavedLocationPicker LiveComponent for huddl form integration - Add routed modal for creating new addresses via Google Places - Add group locations management page (/groups/:slug/locations) - Add ApplyProvidedCoordinates change to skip geocoding for saved locations - Add modal/1 component to core_components - Update huddl form to use saved locations instead of inline autocomplete - Wrap modal LocationAutocomplete in form element (fixes phx-change error) New files: - GroupLocation resource, SavedLocationPicker, Locations LiveView - ApplyProvidedCoordinates change, migration Tests: 608 passing (15 new covering locations page, modal, and resource)
- Show all saved locations immediately when clicking "Change location" - Add cancel button (X) to restore previous selection - Click-away also restores previous selection (safe default) - Hide "Add new address" link when a location is already selected
…bypass The geocode_if_changed function was checking changeset.attributes for existing coordinates, which includes ALL attributes (defaults, prior values) not just explicitly provided ones. This caused flaky test failures when concurrent tests set latitude/longitude. Now checks for :provided_latitude/:provided_longitude arguments, which are the explicit signal from ApplyProvidedCoordinates.
… flaky tests Root cause: provided_latitude/provided_longitude were public arguments on the huddl create/update actions. Ash.Generator auto-generates random float values for public arguments, so concurrent tests randomly populated these coordinates, causing ApplyProvidedCoordinates to bypass geocoding unexpectedly. - Mark provided_latitude/longitude as public?: false on both actions - Use before_submit + force_set_argument to pass coordinates from the LiveView form (private args can't be set via form params) - Add deterministic unit test for geocode_if_changed that catches the bug: constructs a changeset with pre-existing lat/lng attributes and verifies geocoding still runs when provided_* arguments are absent - Update existing tests to set private arguments before for_create
- Replace inline LocationAutocomplete with route-based modal pattern on both group create and edit forms - Modal filters to city/region types (locality, sublocality, administrative_area_level_2) for consistent UX - Add ApplyProvidedCoordinates change to bypass geocoding when coordinates are provided from the frontend - Add provided_latitude/longitude arguments to create_group and update_details actions - Use force_change_attribute in before_submit to set coordinates directly (before_submit runs after action changes) - Add tests verifying city picker UI, modal content, and clear/set/save flow on the edit page
…helpers - Extract ApplyProvidedCoordinates to shared Huddlz.Geocoding module, removing duplicate Group and Huddl versions - Move load_group_locations/2 to FormHelpers, removing duplicates from Edit, New, and Locations LiveViews - Add missing @impl true annotations on handle_event/handle_info callbacks - Extract reset_modal_state/1 helper in Locations LiveView - Skip redundant group reload in Locations handle_params when slug unchanged
…licate group helpers - Fix prepare_source_with_coordinates to use force_change_attribute instead of force_set_argument, since before_submit runs after for_create (Ash changes have already executed by that point) - Extract inject_group_location_param and apply_group_location_to_form to FormHelpers, removing duplicates from GroupLive.New and Edit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GroupLocationresource for saving reusable locations per group, with full CRUD management page at/groups/:slug/locationsSavedLocationPickerLiveComponent for selecting from a group's saved locations when creating/editing huddlz, with modal flow to add new addressesLocationAutocompletefiltered to city/region types (locality, sublocality, administrative_area_level_2)ApplyProvidedCoordinateschange skips geocoding API calls when frontend provides lat/lng directly from Google Places autocompleteSavedLocationPickerto choose from group address book, with modal to add new addresses that save to the groupKey changes
GroupLocationAsh resource with PostgreSQL migrationSavedLocationPickerandLocationAutocompleteLiveComponents with modal integrationApplyProvidedCoordinateschange for both Group and Huddl resourceslive_action: :new_location) for location selectionTest plan
mix precommitgreen)