mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Add some minor changes
This commit is contained in:
parent
c1955fe6c3
commit
b1c48076e4
14 changed files with 95 additions and 36 deletions
|
|
@ -1 +1 @@
|
|||
0.19.5
|
||||
0.19.6
|
||||
|
|
|
|||
12
CHANGELOG.md
12
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
|
||||
|
|
|
|||
|
|
@ -13,3 +13,10 @@
|
|||
|
||||
*/
|
||||
@import 'actiontext.css';
|
||||
|
||||
@layer components {
|
||||
.fade-out {
|
||||
opacity: 0;
|
||||
transition: opacity 150ms ease-in-out;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
|
||||
|
|
|
|||
|
|
@ -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.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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
<% content_for :title, "Places" %>
|
||||
|
||||
<div class="w-full my-5">
|
||||
<div class="flex justify-center">
|
||||
<h1 class="font-bold text-4xl">Places</h1>
|
||||
<div role="tablist" class="tabs tabs-lifted tabs-lg">
|
||||
<%= 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')}" %>
|
||||
</div>
|
||||
|
||||
<div id="places" class="min-w-full">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<div class="fixed top-5 right-5 flex flex-col gap-2" id="flash-messages">
|
||||
<% flash.each do |key, value| %>
|
||||
<div data-controller="removals" class="flex items-center fixed top-5 right-5 <%= classes_for_flash(key) %> py-3 px-5 rounded-lg">
|
||||
<div data-controller="removals"
|
||||
data-removals-timeout-value="5000"
|
||||
class="flex items-center <%= classes_for_flash(key) %> py-3 px-5 rounded-lg z-[6000]">
|
||||
<div class="mr-4"><%= value %></div>
|
||||
|
||||
<button type="button" data-action="click->removals#remove">
|
||||
|
|
@ -9,3 +12,4 @@
|
|||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@
|
|||
<li><%= link_to 'Map', map_url, class: "#{active_class?(map_url)}" %></li>
|
||||
<li><%= link_to 'Points', points_url, class: "#{active_class?(points_url)}" %></li>
|
||||
<li><%= link_to 'Stats', stats_url, class: "#{active_class?(stats_url)}" %></li>
|
||||
<li><%= link_to 'Visits<sup>α</sup>'.html_safe, visits_url(status: :confirmed), class: "#{active_class?(visits_url)}" %></li>
|
||||
<li><%= link_to 'Places<sup>α</sup>'.html_safe, places_url, class: "#{active_class?(places_url)}" %></li>
|
||||
<li><%= link_to 'Visits & Places<sup>α</sup>'.html_safe, visits_url(status: :confirmed), class: "#{active_class?(visits_url)}" %></li>
|
||||
<li><%= link_to 'Trips<sup>α</sup>'.html_safe, trips_url, class: "#{active_class?(trips_url)}" %></li>
|
||||
<li><%= link_to 'Imports', imports_url, class: "#{active_class?(imports_url)}" %></li>
|
||||
<li><%= link_to 'Exports', exports_url, class: "#{active_class?(exports_url)}" %></li>
|
||||
|
|
@ -45,8 +44,7 @@
|
|||
<li><%= link_to 'Map', map_url, class: "mx-1 #{active_class?(map_url)}" %></li>
|
||||
<li><%= link_to 'Points', points_url, class: "mx-1 #{active_class?(points_url)}" %></li>
|
||||
<li><%= link_to 'Stats', stats_url, class: "mx-1 #{active_class?(stats_url)}" %></li>
|
||||
<li><%= link_to 'Visits<sup>α</sup>'.html_safe, visits_url(status: :confirmed), class: "mx-1 #{active_class?(visits_url)}" %></li>
|
||||
<li><%= link_to 'Places<sup>α</sup>'.html_safe, places_url, class: "mx-1 #{active_class?(places_url)}" %></li>
|
||||
<li><%= link_to 'Visits & Places<sup>α</sup>'.html_safe, visits_url(status: :confirmed), class: "mx-1 #{active_class?(visits_url)}" %></li>
|
||||
<li><%= link_to 'Trips<sup>α</sup>'.html_safe, trips_url, class: "mx-1 #{active_class?(trips_url)}" %></li>
|
||||
<li><%= link_to 'Imports', imports_url, class: "mx-1 #{active_class?(imports_url)}" %></li>
|
||||
<li><%= link_to 'Exports', exports_url, class: "mx-1 #{active_class?(exports_url)}" %></li>
|
||||
|
|
@ -55,7 +53,7 @@
|
|||
<div class="navbar-end">
|
||||
<ul class="menu menu-horizontal bg-base-100 rounded-box px-1">
|
||||
<% if user_signed_in? %>
|
||||
<div class="dropdown dropdown-end dropdown-bottom dropdown-hover z-[5000]"
|
||||
<div class="dropdown dropdown-end dropdown-bottom dropdown-hover"
|
||||
data-controller="notifications"
|
||||
data-notifications-user-id-value="<%= current_user.id %>">
|
||||
<div tabindex="0" role="button" class='btn btn-sm btn-ghost hover:btn-ghost'>
|
||||
|
|
@ -77,7 +75,7 @@
|
|||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<ul tabindex="0" class="dropdown-content z-10 menu p-2 shadow-lg bg-base-100 rounded-box min-w-52" data-notifications-target="list">
|
||||
<ul tabindex="0" class="dropdown-content z-[5000] menu p-2 shadow-lg bg-base-100 rounded-box min-w-52" data-notifications-target="list">
|
||||
<li><%= link_to 'See all', notifications_path %></li>
|
||||
<div class="divider p-0 m-0"></div>
|
||||
<% @unread_notifications.first(10).each do |notification| %>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="group relative">
|
||||
<div class="group relative timeline-box">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<%= render 'visits/name', visit: visit %>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
<% content_for :title, "Visits" %>
|
||||
|
||||
<div class="w-full my-5">
|
||||
<div role="tablist" class="tabs tabs-lifted tabs-lg">
|
||||
<%= 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')}" %>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between">
|
||||
<h1 class="font-bold text-4xl">Visits</h1>
|
||||
<div role="tablist" class="tabs tabs-boxed">
|
||||
<%= link_to 'Confirmed', visits_path(status: :confirmed), role: 'tab',
|
||||
class: "tab #{active_tab?(visits_path(status: :confirmed))}" %>
|
||||
|
|
@ -24,7 +27,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div role="alert" class="alert">
|
||||
<div role="alert" class="alert mt-5">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
|
|
@ -58,13 +61,13 @@
|
|||
</div>
|
||||
|
||||
<ul class="timeline timeline-snap-icon max-md:timeline-compact timeline-vertical">
|
||||
<% @visits.each.with_index do |date, index| %>
|
||||
<% @visits.each do |visit| %>
|
||||
<li>
|
||||
<div class="timeline-middle">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 20 20"
|
||||
fill="<%= date[:visits].all?(&:confirmed?) ? 'green' : 'currentColor' %>"
|
||||
fill="<%= visit.confirmed? ? 'green' : 'currentColor' %>"
|
||||
class="h-5 w-5">
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
|
|
@ -72,11 +75,11 @@
|
|||
clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="<%= index.odd? ? 'timeline-start' : 'timeline-end' %> mb-10 md:text-end">
|
||||
<time class="font-mono italic"><%= date[:date].strftime('%A, %d %B %Y') %></time>
|
||||
<% date[:visits].each do |visit| %>
|
||||
<div class="timeline-start md:text-end">
|
||||
<time class="font-mono italic"><%= visit.started_at.strftime('%A, %d %B %Y') %></time>
|
||||
</div>
|
||||
<div class="timeline-end md:text-end">
|
||||
<%= render partial: 'visit', locals: { visit: visit } %>
|
||||
<% end %>
|
||||
</div>
|
||||
<hr />
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ class AddReverseGeocodedAtToPoints < ActiveRecord::Migration[7.2]
|
|||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_column :points, :reverse_geocoded_at, :datetime
|
||||
return if column_exists?(:points, :reverse_geocoded_at)
|
||||
|
||||
add_column :points, :reverse_geocoded_at, :datetime
|
||||
add_index :points, :reverse_geocoded_at, algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddStartedAtIndexToVisits < ActiveRecord::Migration[7.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :visits, :started_at, algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
3
db/schema.rb
generated
3
db/schema.rb
generated
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_12_05_160055) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_12_11_113119) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
|
|
@ -232,6 +232,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_05_160055) do
|
|||
t.bigint "place_id"
|
||||
t.index ["area_id"], name: "index_visits_on_area_id"
|
||||
t.index ["place_id"], name: "index_visits_on_place_id"
|
||||
t.index ["started_at"], name: "index_visits_on_started_at"
|
||||
t.index ["user_id"], name: "index_visits_on_user_id"
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue