mirror of
https://github.com/we-promise/sure.git
synced 2026-05-30 07:49:01 +00:00
P4: status pills now carry an icon alongside the colored tint (circle-check / triangle-alert / star / infinity / pause), so color is no longer the sole signal. Drop the redundant dot. P4: default sort on the active goals list becomes attention-first — behind → on_track → no_target_date → paused, alphabetical within bucket. The user opens the page and lands on the goals that need them. P5: add a Paused filter chip + render paused goal cards with opacity-75 so they read as inactive at a glance. Rename "No date" chip to "Open-ended" — clearer to non-jargon readers.
35 lines
840 B
Ruby
35 lines
840 B
Ruby
class Savings::StatusPillComponent < ApplicationComponent
|
|
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" }
|
|
}.freeze
|
|
|
|
def initialize(goal:)
|
|
@goal = goal
|
|
end
|
|
|
|
def status_key
|
|
return :paused if @goal.paused?
|
|
@goal.status
|
|
end
|
|
|
|
def variant
|
|
VARIANTS.fetch(status_key, VARIANTS[:no_target_date])
|
|
end
|
|
|
|
def label
|
|
I18n.t("savings_goals.status.#{status_key}")
|
|
end
|
|
|
|
def classes
|
|
variant[:classes]
|
|
end
|
|
|
|
def icon_name
|
|
variant[:icon]
|
|
end
|
|
end
|