Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
1.3 KB
Raw Blame
<%
  context = goal.status_callout_context
  return if context.blank?

  variant_classes = case goal.status
                    when :behind
                      "bg-warning/10 border-warning/20"
                    when :on_track
                      "bg-success/10 border-success/20"
                    else
                      "bg-surface-inset border-secondary"
                    end

  icon_glyph = case goal.status
               when :behind then "triangle-alert"
               when :on_track then "circle-check"
               when :no_target_date then "infinity"
               else "info"
               end

  icon_color = case goal.status
               when :behind then "warning"
               when :on_track then "success"
               else "default"
               end

  label = t("goals.status.#{goal.status}", default: goal.status.to_s.titleize)
%>
<div class="rounded-lg border px-3 py-2 text-sm flex items-center gap-2 text-primary <%= variant_classes %>">
  <span class="shrink-0"><%= icon(icon_glyph, size: "sm", color: icon_color) %></span>
  <span class="font-medium"><%= label %></span>
  <span class="opacity-60" aria-hidden="true"><%= t("shared.dot_separator") %></span>
  <span class="opacity-90 <%= "privacy-sensitive" if goal.status == :behind %>"><%= context %></span>
</div>