Updte map view

This commit is contained in:
Eugene Burmakin 2025-10-30 19:16:38 +01:00
parent 8c9fc5a5e0
commit 6787273713
11 changed files with 107 additions and 55 deletions

View file

@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
# [0.34.1] - 2025-10-30
## Fixed
- Broken Stats page for users with no reverse geocoding enabled. #1877
## Changed
- Date navigation on the map page is no longer shown as floating panel. It is now part of the top navigation bar to prevent overlapping with other map controls. #1894 #1881
# [0.34.0] - 2025-10-10
## The Family release

View file

@ -49,7 +49,7 @@ gem 'sprockets-rails'
gem 'stackprof'
gem 'stimulus-rails'
gem 'strong_migrations', '>= 2.4.0'
gem 'tailwindcss-rails', '>= 3.3.2'
gem 'tailwindcss-rails', '= 3.3.2'
gem 'turbo-rails', '>= 2.0.17'
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

View file

@ -491,14 +491,15 @@ GEM
attr_extras (>= 6.2.4)
diff-lcs
patience_diff
tailwindcss-rails (4.3.0)
tailwindcss-rails (3.3.2)
railties (>= 7.0.0)
tailwindcss-ruby (~> 4.0)
tailwindcss-ruby (4.1.13)
tailwindcss-ruby (4.1.13-aarch64-linux-gnu)
tailwindcss-ruby (4.1.13-arm64-darwin)
tailwindcss-ruby (4.1.13-x86_64-darwin)
tailwindcss-ruby (4.1.13-x86_64-linux-gnu)
tailwindcss-ruby (~> 3.0)
tailwindcss-ruby (3.4.17)
tailwindcss-ruby (3.4.17-aarch64-linux)
tailwindcss-ruby (3.4.17-arm-linux)
tailwindcss-ruby (3.4.17-arm64-darwin)
tailwindcss-ruby (3.4.17-x86_64-darwin)
tailwindcss-ruby (3.4.17-x86_64-linux)
thor (1.4.0)
timeout (0.4.3)
tsort (0.2.0)
@ -600,7 +601,7 @@ DEPENDENCIES
stimulus-rails
strong_migrations (>= 2.4.0)
super_diff
tailwindcss-rails (>= 3.3.2)
tailwindcss-rails (= 3.3.2)
turbo-rails (>= 2.0.17)
tzinfo-data
webmock

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,7 @@
class Users::RegistrationsController < Devise::RegistrationsController
before_action :set_invitation, only: %i[new create]
before_action :check_registration_allowed, only: %i[new create]
before_action :store_utm_params, only: %i[new]
def new
build_resource({})
@ -16,8 +17,9 @@ class Users::RegistrationsController < Devise::RegistrationsController
def create
super do |resource|
if resource.persisted? && @invitation
accept_invitation_for_user(resource)
if resource.persisted?
assign_utm_params(resource)
accept_invitation_for_user(resource) if @invitation
end
end
end
@ -90,4 +92,23 @@ class Users::RegistrationsController < Devise::RegistrationsController
def sign_up_params
super
end
def store_utm_params
utm_params = %w[utm_source utm_medium utm_campaign utm_term utm_content]
utm_params.each do |param|
session[param] = params[param] if params[param].present?
end
end
def assign_utm_params(user)
utm_params = %w[utm_source utm_medium utm_campaign utm_term utm_content]
utm_data = {}
utm_params.each do |param|
utm_data[param] = session[param] if session[param].present?
session.delete(param) # Clean up session after assignment
end
user.update_columns(utm_data) if utm_data.any?
end
end

View file

@ -122,9 +122,8 @@ export default class extends BaseController {
});
});
// Add markers and route
// Add route (no markers on trip forms)
if (this.coordinates?.length > 0) {
this.addMarkers()
this.addPolyline()
this.fitMapToBounds()
}
@ -246,9 +245,8 @@ export default class extends BaseController {
this.polylinesLayer.clearLayers()
this.photoMarkers.clearLayers()
// Add new markers and route if coordinates exist
// Add only polyline (no markers) when coordinates exist
if (this.coordinates?.length > 0) {
this.addMarkers()
this.addPolyline()
this.fitMapToBounds()
}

View file

@ -38,7 +38,7 @@
</div>
<!-- Full Screen Map Container -->
<div class='absolute top-16 left-0 right-0 w-full z-20' style='height: calc(100vh - 4rem);'>
<div class='absolute top-16 left-0 right-0 bottom-0 w-full z-20 flex flex-col'>
<%= yield %>
</div>

View file

@ -1,10 +1,9 @@
<% content_for :title, 'Map' %>
<!-- Floating Date Navigation Controls -->
<div class="fixed top-20 left-0 right-0 flex justify-center" style="z-index: 9999; margin-left: 80px; margin-right: 80px;">
<div style="width: 1500px; max-width: 100%;" data-controller="map-controls">
<!-- Date Navigation Controls - Native Page Element -->
<div class="w-full px-4 py-3 bg-base-100" data-controller="map-controls">
<!-- Mobile: Compact Toggle Button -->
<div class="lg:hidden justify-center flex">
<div class="lg:hidden flex justify-center">
<button
type="button"
data-action="click->map-controls#toggle"
@ -19,7 +18,7 @@
<!-- Expandable Panel (hidden on mobile by default, always visible on desktop) -->
<div
data-map-controls-target="panel"
class="hidden lg:!block bg-base-100 bg-opacity-95 rounded-lg shadow-lg p-4 mt-2 lg:mt-0 scale-80">
class="hidden lg:!block bg-base-100 rounded-lg shadow-lg p-4 mt-2 lg:mt-0">
<%= form_with url: map_path(import_id: params[:import_id]), method: :get do |f| %>
<div class="flex flex-col space-y-4 lg:flex-row lg:space-y-0 lg:space-x-4 lg:items-end">
<div class="w-full lg:w-1/12">
@ -71,29 +70,30 @@
</div>
<% end %>
</div>
</div>
</div>
<!-- Full Screen Map -->
<div
id='map'
class="absolute inset-0 w-full h-full z-0"
data-controller="maps points add-visit family-members"
data-points-target="map"
data-api_key="<%= current_user.api_key %>"
data-self_hosted="<%= @self_hosted %>"
data-user_settings='<%= current_user.safe_settings.settings.to_json %>'
data-user_theme="<%= current_user&.theme || 'dark' %>"
data-coordinates='<%= @coordinates.to_json.html_safe %>'
data-tracks='<%= @tracks.to_json.html_safe %>'
data-distance="<%= @distance %>"
data-points_number="<%= @points_number %>"
data-timezone="<%= Rails.configuration.time_zone %>"
data-features='<%= @features.to_json.html_safe %>'
data-family-members-features-value='<%= @features.to_json.html_safe %>'
data-family-members-user-theme-value="<%= current_user&.theme || 'dark' %>">
<div data-maps-target="container" class="w-full h-full">
<div id="fog" class="fog"></div>
<!-- Map Container - Fills remaining space -->
<div class="w-full h-full">
<div
id='map'
class="w-full h-full"
data-controller="maps points add-visit family-members"
data-points-target="map"
data-api_key="<%= current_user.api_key %>"
data-self_hosted="<%= @self_hosted %>"
data-user_settings='<%= current_user.safe_settings.settings.to_json %>'
data-user_theme="<%= current_user&.theme || 'dark' %>"
data-coordinates='<%= @coordinates.to_json.html_safe %>'
data-tracks='<%= @tracks.to_json.html_safe %>'
data-distance="<%= @distance %>"
data-points_number="<%= @points_number %>"
data-timezone="<%= Rails.configuration.time_zone %>"
data-features='<%= @features.to_json.html_safe %>'
data-family-members-features-value='<%= @features.to_json.html_safe %>'
data-family-members-user-theme-value="<%= current_user&.theme || 'dark' %>">
<div data-maps-target="container" class="w-full h-full">
<div id="fog" class="fog"></div>
</div>
</div>
</div>

View file

@ -18,6 +18,8 @@
<% if DawarichSettings.reverse_geocoding_enabled? %>
<%= render 'stats/reverse_geocoding_stats' %>
<% else %>
</div>
<% end %>
<div class='text-xs text-gray-500 text-center mt-5'>

View file

@ -0,0 +1,11 @@
# frozen_string_literal: true
class AddUtmParametersToUsers < ActiveRecord::Migration[8.0]
def change
add_column :users, :utm_source, :string
add_column :users, :utm_medium, :string
add_column :users, :utm_campaign, :string
add_column :users, :utm_term, :string
add_column :users, :utm_content, :string
end
end

33
db/schema.rb generated
View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_09_30_150256) do
ActiveRecord::Schema[8.0].define(version: 2025_10_30_190924) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"
enable_extension "postgis"
@ -113,10 +113,10 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_30_150256) do
t.integer "status", default: 0, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["email"], name: "index_family_invitations_on_email"
t.index ["expires_at"], name: "index_family_invitations_on_expires_at"
t.index ["family_id"], name: "index_family_invitations_on_family_id"
t.index ["status"], name: "index_family_invitations_on_status"
t.index ["family_id", "email"], name: "index_family_invitations_on_family_id_and_email"
t.index ["family_id", "status", "expires_at"], name: "index_family_invitations_on_family_status_expires"
t.index ["status", "expires_at"], name: "index_family_invitations_on_status_and_expires_at"
t.index ["status", "updated_at"], name: "index_family_invitations_on_status_and_updated_at"
t.index ["token"], name: "index_family_invitations_on_token", unique: true
end
@ -126,8 +126,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_30_150256) do
t.integer "role", default: 1, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["family_id", "role"], name: "index_family_memberships_on_family_id_and_role"
t.index ["family_id"], name: "index_family_memberships_on_family_id"
t.index ["family_id", "role"], name: "index_family_memberships_on_family_and_role"
t.index ["user_id"], name: "index_family_memberships_on_user_id", unique: true
end
@ -316,6 +315,16 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_30_150256) do
t.integer "status", default: 0
t.datetime "active_until"
t.integer "points_count", default: 0, null: false
t.string "provider"
t.string "uid"
t.text "patreon_access_token"
t.text "patreon_refresh_token"
t.datetime "patreon_token_expires_at"
t.string "utm_source"
t.string "utm_medium"
t.string "utm_campaign"
t.string "utm_term"
t.string "utm_content"
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
@ -342,11 +351,11 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_30_150256) do
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "areas", "users"
add_foreign_key "families", "users", column: "creator_id", validate: false
add_foreign_key "family_invitations", "families", validate: false
add_foreign_key "family_invitations", "users", column: "invited_by_id", validate: false
add_foreign_key "family_memberships", "families", validate: false
add_foreign_key "family_memberships", "users", validate: false
add_foreign_key "families", "users", column: "creator_id"
add_foreign_key "family_invitations", "families"
add_foreign_key "family_invitations", "users", column: "invited_by_id"
add_foreign_key "family_memberships", "families"
add_foreign_key "family_memberships", "users"
add_foreign_key "notifications", "users"
add_foreign_key "place_visits", "places"
add_foreign_key "place_visits", "visits"