Skip to content

Commit 4e15d41

Browse files
sethherrclaude
andcommitted
Color the claim alert by whether it's still waiting on somebody
Warning until the claim is answered, success once it is. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 820af0b commit 4e15d41

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

app/components/registrations/show/current_alerts/claim_impound/component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<%= render(UI::Alert::Component.new(kind: :purple, header: heading, margin_classes: "")) do %>
1+
<%= render(UI::Alert::Component.new(kind: alert_kind, header: heading, margin_classes: "")) do %>
22
<div
33
data-controller="ui--collapse"
44
data-ui--collapse-param-value="contact_owner"

app/components/registrations/show/current_alerts/claim_impound/component.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,18 @@ def render?
2525
private
2626

2727
def heading
28-
translation((impound_claim || submitting_impound_claim) ? ".your_claim" : ".does_this_look_like_your_bike")
28+
translation(shown_impound_claim ? ".your_claim" : ".does_this_look_like_your_bike")
29+
end
30+
31+
# An answered claim is good news; everything else is still waiting on somebody
32+
def alert_kind
33+
shown_impound_claim&.successful? ? :success : :warning
34+
end
35+
36+
# Whichever side of the claim this bike is - the impound being claimed, or the
37+
# stolen registration it was claimed with
38+
def shown_impound_claim
39+
impound_claim || submitting_impound_claim
2940
end
3041

3142
def claim_button_text

app/components/registrations/show/wrapper/component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Wrapper
88
class Component < ApplicationComponent
99
# Digest of the markup inside the cache block — the cached_markup_digest spec
1010
# keeps it current, following what this tree renders out into UI:: and elsewhere
11-
MARKUP_DIGEST = "fb4cbfb189d9"
11+
MARKUP_DIGEST = "6f77e53c5f17"
1212

1313
def initialize(bike:, current_user:, view:, available_views:, bike_sticker: nil, current_alerts: {})
1414
@bike = bike

0 commit comments

Comments
 (0)