From b1c48076e426f72b7102a8cf91848f119c2cd231 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Wed, 11 Dec 2024 14:21:44 +0100 Subject: [PATCH] Add some minor changes --- .app_version | 2 +- CHANGELOG.md | 12 ++++++++++ .../stylesheets/application.tailwind.css | 9 ++++++- app/controllers/visits_controller.rb | 4 +--- app/helpers/application_helper.rb | 4 ++++ .../controllers/removals_controller.js | 23 +++++++++++++++++- app/views/places/index.html.erb | 5 ++-- app/views/shared/_flash.html.erb | 24 +++++++++++-------- app/views/shared/_navbar.html.erb | 10 ++++---- app/views/visits/_visit.html.erb | 2 +- app/views/visits/index.html.erb | 21 +++++++++------- ...14820_add_reverse_geocoded_at_to_points.rb | 3 ++- ...11113119_add_started_at_index_to_visits.rb | 9 +++++++ db/schema.rb | 3 ++- 14 files changed, 95 insertions(+), 36 deletions(-) create mode 100644 db/migrate/20241211113119_add_started_at_index_to_visits.rb diff --git a/.app_version b/.app_version index 16235ea2..68d0e0ab 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.19.5 +0.19.6 diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d488f3..d1d8e836 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ 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.19.6 - 2024-12-11 + +### Fixed + +- Flash messages are now being removed after 5 seconds. +- Fixed broken migration that was preventing the app from starting. +- Visits page is now loading a lot faster than before. + +### Changed + +- Places page is now accessible from the Visits & Places tab on the navbar. + # 0.19.5 - 2024-12-10 ### Fixed diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css index 3bff5194..48e213d2 100644 --- a/app/assets/stylesheets/application.tailwind.css +++ b/app/assets/stylesheets/application.tailwind.css @@ -12,4 +12,11 @@ } */ -@import 'actiontext.css'; \ No newline at end of file +@import 'actiontext.css'; + +@layer components { + .fade-out { + opacity: 0; + transition: opacity 150ms ease-in-out; + } +} diff --git a/app/controllers/visits_controller.rb b/app/controllers/visits_controller.rb index cde2c8fd..a8469831 100644 --- a/app/controllers/visits_controller.rb +++ b/app/controllers/visits_controller.rb @@ -13,12 +13,10 @@ class VisitsController < ApplicationController .where(status:) .includes(%i[suggested_places area]) .order(started_at: order_by) - .group_by { |visit| visit.started_at.to_date } - .map { |k, v| { date: k, visits: v } } @suggested_visits_count = current_user.visits.suggested.count - @visits = Kaminari.paginate_array(visits).page(params[:page]).per(10) + @visits = visits.page(params[:page]).per(10) end def update diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3fe89204..08b341ef 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -101,6 +101,10 @@ module ApplicationHelper 'tab-active' if current_page?(link_path) end + def active_visit_places_tab?(controller_name) + 'tab-active' if current_page?(controller: controller_name) + end + def notification_link_color(notification) return 'text-gray-600' if notification.read? diff --git a/app/javascript/controllers/removals_controller.js b/app/javascript/controllers/removals_controller.js index 9d4172df..cf487d07 100644 --- a/app/javascript/controllers/removals_controller.js +++ b/app/javascript/controllers/removals_controller.js @@ -1,7 +1,28 @@ import { Controller } from "@hotwired/stimulus" export default class extends Controller { + static values = { + timeout: Number + } + + connect() { + if (this.timeoutValue) { + setTimeout(() => { + this.remove() + }, this.timeoutValue) + } + } + remove() { - this.element.remove() + this.element.classList.add('fade-out') + setTimeout(() => { + this.element.remove() + + // Remove the container if it's empty + const container = document.getElementById('flash-messages') + if (container && !container.hasChildNodes()) { + container.remove() + } + }, 150) } } diff --git a/app/views/places/index.html.erb b/app/views/places/index.html.erb index 4d93a744..939cca3b 100644 --- a/app/views/places/index.html.erb +++ b/app/views/places/index.html.erb @@ -1,8 +1,9 @@ <% content_for :title, "Places" %>
-
-

Places

+
+ <%= link_to 'Visits', visits_path(status: :confirmed), role: 'tab', class: "tab font-bold text-xl #{active_visit_places_tab?('visits')}" %> + <%= link_to 'Places', places_path, role: 'tab', class: "tab font-bold text-xl #{active_visit_places_tab?('places')}" %>
diff --git a/app/views/shared/_flash.html.erb b/app/views/shared/_flash.html.erb index 5b01dbdd..54895274 100644 --- a/app/views/shared/_flash.html.erb +++ b/app/views/shared/_flash.html.erb @@ -1,11 +1,15 @@ -<% flash.each do |key, value| %> -
-
<%= value %>
+
+ <% flash.each do |key, value| %> +
+
<%= value %>
- -
-<% end %> + +
+ <% end %> +
diff --git a/app/views/shared/_navbar.html.erb b/app/views/shared/_navbar.html.erb index 89e9dc44..96ec7428 100644 --- a/app/views/shared/_navbar.html.erb +++ b/app/views/shared/_navbar.html.erb @@ -8,8 +8,7 @@
  • <%= link_to 'Map', map_url, class: "#{active_class?(map_url)}" %>
  • <%= link_to 'Points', points_url, class: "#{active_class?(points_url)}" %>
  • <%= link_to 'Stats', stats_url, class: "#{active_class?(stats_url)}" %>
  • -
  • <%= link_to 'Visitsα'.html_safe, visits_url(status: :confirmed), class: "#{active_class?(visits_url)}" %>
  • -
  • <%= link_to 'Placesα'.html_safe, places_url, class: "#{active_class?(places_url)}" %>
  • +
  • <%= link_to 'Visits & Placesα'.html_safe, visits_url(status: :confirmed), class: "#{active_class?(visits_url)}" %>
  • <%= link_to 'Tripsα'.html_safe, trips_url, class: "#{active_class?(trips_url)}" %>
  • <%= link_to 'Imports', imports_url, class: "#{active_class?(imports_url)}" %>
  • <%= link_to 'Exports', exports_url, class: "#{active_class?(exports_url)}" %>
  • @@ -45,8 +44,7 @@
  • <%= link_to 'Map', map_url, class: "mx-1 #{active_class?(map_url)}" %>
  • <%= link_to 'Points', points_url, class: "mx-1 #{active_class?(points_url)}" %>
  • <%= link_to 'Stats', stats_url, class: "mx-1 #{active_class?(stats_url)}" %>
  • -
  • <%= link_to 'Visitsα'.html_safe, visits_url(status: :confirmed), class: "mx-1 #{active_class?(visits_url)}" %>
  • -
  • <%= link_to 'Placesα'.html_safe, places_url, class: "mx-1 #{active_class?(places_url)}" %>
  • +
  • <%= link_to 'Visits & Placesα'.html_safe, visits_url(status: :confirmed), class: "mx-1 #{active_class?(visits_url)}" %>
  • <%= link_to 'Tripsα'.html_safe, trips_url, class: "mx-1 #{active_class?(trips_url)}" %>
  • <%= link_to 'Imports', imports_url, class: "mx-1 #{active_class?(imports_url)}" %>
  • <%= link_to 'Exports', exports_url, class: "mx-1 #{active_class?(exports_url)}" %>
  • @@ -55,7 +53,7 @@