Merge branch 'main' into responsive-card-view

* main:
  Just set the clear filter so `restore_collections_filter_from_cookie` can do the right thing
  Refresh local time target when morphed
  Handle case where no params are sent because nothing is checked
  Ensure checkboxes in menus have full size click targets
  Do or die
  Handle collections that do not auto close
  Ensure dates are re-formatted on turbo frame load
  Render the "last active at" timestamp in the card meta
  dep: update rack and rack-session
  Simplify selector
  Fix the flashing notif tray
  Close pinned cards when you click since the tray persists between page loads
  Remove unused var
  Update bubble text when 0 days
  Nudge people that `/` is for commands
  Show help if you arrow-up but don't have any previous commands yet
This commit is contained in:
Andy Smith
2025-05-13 16:40:08 -05:00
16 changed files with 47 additions and 38 deletions
+2 -2
View File
@@ -264,10 +264,10 @@ GEM
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.8.1)
rack (3.1.13)
rack (3.1.14)
rack-contrib (2.5.0)
rack (< 4)
rack-session (2.1.0)
rack-session (2.1.1)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rack-test (2.2.0)
+3 -2
View File
@@ -78,7 +78,8 @@
.terminal__help {
display: none;
.terminal--showing-help & {
.terminal--showing-help &,
.terminal--open .terminal__menu:empty ~ & {
border-block-end: 1px dashed;
display: block;
margin-block-end: 0.5lh;
@@ -119,7 +120,7 @@
}
.terminal__item {
&:where(:not(:active)):focus-visible, &:where(:not(:active))[aria-current] {
&[aria-current] {
--btn-color: var(--color-terminal-bg);
background: var(--color-terminal-text);
@@ -4,12 +4,19 @@ module DayTimelinesScoped
included do
include FilterScoped
before_action :normalize_collection_params
before_action :restore_collections_filter_from_cookie
before_action :set_day_timeline
after_action :save_collections_filter_to_cookie
end
private
def normalize_collection_params
if params[:collection_ids].blank? && !params[:clear_filter]
params[:clear_filter] = true
end
end
def restore_collections_filter_from_cookie
if params[:clear_filter]
delete_collections_filter_cookie
+1 -1
View File
@@ -1,5 +1,5 @@
module TimeHelper
def local_datetime_tag(datetime, style: :time, **attributes)
tag.time **attributes, datetime: datetime.iso8601, data: { local_time_target: style }
tag.time **attributes, datetime: datetime.iso8601, data: { local_time_target: style, action: "turbo:morph-element->local-time#refreshTarget" }
end
end
@@ -37,6 +37,12 @@ export default class extends Controller {
})
}
refreshTarget(event) {
const target = event.target;
const targetName = target.dataset.localTimeTarget
this.#formatTime(this[`${targetName}Formatter`], target)
}
timeTargetConnected(target) {
this.#formatTime(this.timeFormatter, target)
}
+1 -1
View File
@@ -34,7 +34,7 @@ module Card::Closeable
end
def closing_soon?
considering? && Time.current >= auto_close_at - AUTO_CLOSE_REMINDER_BEFORE
considering? && auto_closing? && Time.current >= auto_close_at - AUTO_CLOSE_REMINDER_BEFORE
end
def closed?
+2 -2
View File
@@ -15,7 +15,7 @@
<%= card.title %>
</h1>
<%= link_to collection_card_path(card.collection, card), class: "card__link", title: card_title_tag(card), data: { turbo_frame: "_top" } do %>
<%= link_to collection_card_path(card.collection, card), class: "card__link", title: card_title_tag(card), data: { action: "dialog#close", turbo_frame: "_top" } do %>
<span class="for-screen-reader"><%= card.title %></span>
<% end %>
</div>
@@ -30,7 +30,7 @@
<%= render "cards/display/common/background", card: card %>
<% if card.closing_soon? %>
<%= render "cards/display/preview/bubble", label: "Closes in", days: card.days_until_close %>
<%= render "cards/display/preview/bubble", days: card.days_until_close %>
<% end %>
<% end %>
<% end %>
@@ -13,7 +13,7 @@
&nbsp;
<% else %>
Updated
<%= local_datetime_tag(card.updated_at, style: :daysago) %>
<%= local_datetime_tag(card.last_active_at, style: :daysago) %>
<% end %>
</span>
<span class="card__meta-item card__meta-item--reported overflow-ellipsis">
@@ -3,20 +3,20 @@
<path id="top-half" fill="transparent" d="M 20,100 A 80,80 0 0,1 180,100" />
<text text-anchor="middle" fill="currentColor">
<textPath href="#top-half" startOffset="50%" dominant-baseline="middle">
<%= label %>
<%= days < 1 ? "Closes" : "Closes in" %>
</textPath>
</text>
</svg>
<span class="circle-bubble__number">
<%= days %>
<%= days < 1 ? "!" : days %>
</span>
<svg viewBox="0 0 200 100">
<path id="bottom-half" d="M 20,0 A 80,80 0 0,0 180,0" fill="transparent" />
<text text-anchor="middle" fill="currentColor">
<textPath href="#bottom-half" startOffset="50%" dominant-baseline="middle">
<%= "Day".pluralize(days) %>
<%= days < 1 ? "today" : "Day".pluralize(days) %>
</textPath>
</text>
</svg>
@@ -5,7 +5,7 @@
<% end %>
<% if Current.user.collections.one? %>
<%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "popup__group flex align-center", style: "--hover-size: 0" do %>
<%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "popup__group flex align-center" do %>
<%= tag.div class: "btn popup__item min-width flex-item-grow" do %>
<span class="overflow-ellipsis"><%= Current.user.collections.first.name %></span>
<span class="txt-ink translucent flex-item-no-shrink flex-item-justify-end"><span class="txt-x-small txt-uppercase">GO TO</span> </span>
@@ -13,14 +13,14 @@
<% end %>
<% elsif Current.user.collections.many? %>
<%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "popup__group flex align-center", style: "--hover-size: 0" do %>
<div class="btn txt-xx-small flex-item-no-shrink">
<label class="btn txt-xx-small flex-item-no-shrink" style="--hover-size: 0.15rem">
<input type="checkbox" <%= "checked" if filter.collection_ids.empty? %>>
<span class="for-screen-reader">
See everything in all collections
</span>
<%= icon_tag "check", size: 18, class: "checked" %>
</div>
</label>
<%= tag.div class: "btn popup__item min-width flex-item-grow" do %>
<span class="overflow-ellipsis">All collections</span>
<span class="txt-ink translucent flex-item-no-shrink flex-item-justify-end"><span class="txt-x-small txt-uppercase">GO TO</span> </span>
@@ -29,7 +29,7 @@
<% Current.user.collections.order(:name).each do |collection| %>
<li class="popup__group flex align-center" data-value="<%= collection.name.downcase %>">
<div class="btn txt-xx-small flex-item-no-shrink">
<label class="btn txt-xx-small flex-item-no-shrink">
<%= form.check_box "collection_ids[]", {
checked: filter.collections.include?(collection),
data: { action: "change->form#submit" },
@@ -40,7 +40,7 @@
Toggle filter for <%= collection.name %>
</span>
<%= icon_tag "check", size: 18, class: "checked" %>
</div>
</label>
<%= link_to cards_path(collection_ids: [ collection ]), class: "btn popup__item min-width flex-item-grow" do %>
<span class="overflow-ellipsis"><%= collection.name %></span>
@@ -1,4 +1,4 @@
<strong class="txt-large">Auto-Close Cards</strong>
<strong class="txt-large">Do or Die</strong>
<label for="closure" class="margin-block-end">Cards automatically close when there is no activity for…</label>
<%= form_with model: collection, data: { controller: "form" } do |form| %>
+1 -1
View File
@@ -18,7 +18,7 @@
terminal_target: "input",
action: "keydown.up->toggle-class#add:prevent keydown.up->navigable-list#selectCurrentOrLast terminal#hideError"
},
placeholder: "Press ⌘+K to search or type commands…",
placeholder: "Press ⌘+K to search or type /commands…",
spellcheck: "false" %>
<%= hidden_field_tag "confirmed", nil, data: { terminal_target: "confirmation" } %>
+1 -3
View File
@@ -1,7 +1,5 @@
<%= turbo_frame_tag :recent_commands do %>
<ul class="terminal__menu flex-column txt-align-start margin-none margin-block-end unpad" aria-label="Recent commands">
<%= render partial: "commands/command", collection: @commands %>
</ul>
<ul class="terminal__menu flex-column txt-align-start margin-none margin-block-end unpad" aria-label="Recent commands"><%= render partial: "commands/command", collection: @commands %></ul>
<%= render "commands/help" %>
<% end %>
@@ -6,21 +6,18 @@
<% end %>
<% end %>
<% elsif Current.user.collections.many? %>
<div class="popup__group flex align-center" style="--hover-size: 0">
<div class="btn txt-xx-small flex-item-no-shrink">
<%= link_to events_path(clear_filter: true), style: "--hover-size: 0" do %>
<div class="popup__group flex align-center">
<%= link_to events_path(clear_filter: true), class: "btn txt-xx-small flex-item-no-shrink" do %>
<%= check_box_tag "filter_collections", nil, filter.collections.blank?, class: "form-checkbox" %>
<span class="for-screen-reader">
See everything in all collections
</span>
<%= icon_tag "check", size: 18, class: "checked" %>
<% end %>
<span class="for-screen-reader">
See everything in all collections
</span>
<%= icon_tag "check", size: 18, class: "checked" %>
</div>
<%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "btn popup__item min-width flex-item-grow" do %>
<span class="overflow-ellipsis">All collections</span>
<span class="txt-ink translucent flex-item-no-shrink flex-item-justify-end"><span class="txt-x-small txt-uppercase">GO TO</span> </span>
<% end %>
<%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "btn popup__item min-width flex-item-grow" do %>
<span class="overflow-ellipsis">All collections</span>
<span class="txt-ink translucent flex-item-no-shrink flex-item-justify-end"><span class="txt-x-small txt-uppercase">GO TO</span> </span>
<% end %>
</div>
<% end %>
@@ -1,5 +1,5 @@
<li class="popup__group flex align-center" data-value="<%= collection.name.downcase %>">
<div class="btn txt-xx-small">
<label class="btn txt-xx-small">
<%= form.check_box "collection_ids[]", {
checked: filter.collections.include?(collection),
data: { action: "change->form#submit" },
@@ -10,7 +10,7 @@
Toggle filter for <%= collection.name %>
</span>
<%= icon_tag "check", size: 18, class: "checked flex-item-justify-end" %>
</div>
</label>
<%= link_to cards_path(collection_ids: [ collection ]), class: "btn popup__item min-width flex-item-grow" do %>
<span class="overflow-ellipsis"><%= collection.name %></span>
+1 -1
View File
@@ -47,7 +47,7 @@
<%= yield :footer %>
<% if Current.user && !@hide_footer_frames %>
<div id="footer_frames">
<div id="footer_frames" data-turbo-permanent="true" >
<%= render "notifications/tray" %>
<%= render "my/pins/tray" %>
<%= render "commands/terminal" %>