From 7f10ec3b6c35ebcf20317a602d34afa5ca816dc9 Mon Sep 17 00:00:00 2001 From: Guillem Arias Date: Mon, 11 May 2026 19:36:54 +0200 Subject: [PATCH] fix(savings_goals/show): dedupe ring labels, DS::Button banners, status-pill contrast - progress_ring_component: drop the in-ring "$saved / of $target" lines. The same money pair already renders directly below the ring in show.html.erb (now the single source). Inside the ring keeps only "Saved" + percent. - show.html.erb: replace 3 hand-rolled button_to CTAs (Paused banner "Resume goal", Archived banner "Restore goal", celebration card "Archive goal") with DS::Button so focus/hover/disabled match the rest of the app. variant: primary/outline, size: sm, method: :patch. - status_pill_component: swap text-success / text-warning / text-secondary to text-green-700 / text-yellow-700 / text-gray-700 so all 5 light-mode pill variants pass WCAG 4.5:1. Local override pending the upstream DS token fix tracked at we-promise/sure#1736. --- .../savings/progress_ring_component.html.erb | 2 -- .../savings/status_pill_component.rb | 15 ++++++--- app/views/savings_goals/show.html.erb | 33 ++++++++++++------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/app/components/savings/progress_ring_component.html.erb b/app/components/savings/progress_ring_component.html.erb index bdac3620f..794964b01 100644 --- a/app/components/savings/progress_ring_component.html.erb +++ b/app/components/savings/progress_ring_component.html.erb @@ -13,8 +13,6 @@
<%= t("savings_goals.show.ring.saved") %> <%= percent %>% - <%= amount_label %> - of <%= target_label %>
diff --git a/app/components/savings/status_pill_component.rb b/app/components/savings/status_pill_component.rb index ed8763bc7..0d43e3ef8 100644 --- a/app/components/savings/status_pill_component.rb +++ b/app/components/savings/status_pill_component.rb @@ -1,10 +1,15 @@ class Savings::StatusPillComponent < ApplicationComponent + # Text colors here intentionally use palette steps (green-700 / yellow-700 / + # gray-700) rather than `text-success` / `text-warning` / `text-secondary` + # tokens because the functional tokens drop below WCAG 1.4.3 4.5:1 on tinted + # surfaces in light mode (~2.88:1 / 3.0:1 / 4.16:1). Local override only; + # revert once we-promise/sure#1736 lands token-level fixes. VARIANTS = { - on_track: { classes: "bg-green-500/10 text-success", icon: "circle-check" }, - behind: { classes: "bg-yellow-500/10 text-warning", icon: "triangle-alert" }, - reached: { classes: "bg-green-500/10 text-success", icon: "star" }, - no_target_date: { classes: "bg-surface-inset text-secondary", icon: "infinity" }, - paused: { classes: "bg-surface-inset text-secondary", icon: "pause" } + on_track: { classes: "bg-green-500/10 text-green-700", icon: "circle-check" }, + behind: { classes: "bg-yellow-500/10 text-yellow-700", icon: "triangle-alert" }, + reached: { classes: "bg-green-500/10 text-green-700", icon: "star" }, + no_target_date: { classes: "bg-surface-inset text-gray-700", icon: "infinity" }, + paused: { classes: "bg-surface-inset text-gray-700", icon: "pause" } }.freeze def initialize(goal:) diff --git a/app/views/savings_goals/show.html.erb b/app/views/savings_goals/show.html.erb index d61b9ea46..7779e791c 100644 --- a/app/views/savings_goals/show.html.erb +++ b/app/views/savings_goals/show.html.erb @@ -83,10 +83,13 @@ <%= render DS::Alert.new(variant: "info", title: t("savings_goals.show.paused_banner.title")) do %>

<%= t("savings_goals.show.paused_banner.body") %>

- <%= button_to t("savings_goals.show.paused_banner.resume_cta"), - resume_savings_goal_path(@savings_goal), - method: :patch, - class: "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium text-inverse bg-inverse hover:bg-inverse-hover" %> + <%= render DS::Button.new( + text: t("savings_goals.show.paused_banner.resume_cta"), + href: resume_savings_goal_path(@savings_goal), + variant: "primary", + size: "sm", + method: :patch + ) %>
<% end %> <% elsif @savings_goal.archived? %> @@ -95,10 +98,13 @@

<%= t("savings_goals.show.archived_banner.body") %>

<% if @savings_goal.may_unarchive? %>
- <%= button_to t("savings_goals.show.archived_banner.restore_cta"), - unarchive_savings_goal_path(@savings_goal), - method: :patch, - class: "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium text-inverse bg-inverse hover:bg-inverse-hover" %> + <%= render DS::Button.new( + text: t("savings_goals.show.archived_banner.restore_cta"), + href: unarchive_savings_goal_path(@savings_goal), + variant: "primary", + size: "sm", + method: :patch + ) %>
<% end %> <% end %> @@ -149,10 +155,13 @@

<%= t(".celebration.body", amount: @savings_goal.target_amount_money.format) %>

<% if @savings_goal.may_archive? %>
- <%= button_to t(".celebration.archive_cta"), - archive_savings_goal_path(@savings_goal), - method: :patch, - class: "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium text-primary border border-secondary bg-transparent hover:bg-surface-hover" %> + <%= render DS::Button.new( + text: t(".celebration.archive_cta"), + href: archive_savings_goal_path(@savings_goal), + variant: "outline", + size: "sm", + method: :patch + ) %>
<% end %>