Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions internal/templates/components/pages/feed.templ
Original file line number Diff line number Diff line change
Expand Up @@ -554,27 +554,10 @@ templ feedSyncBody(it FeedItem, s *FeedSync, now time.Time) {
</div>
}
if len(s.RuleOutcomes) > 0 {
<div class="mt-1 flex items-center gap-1.5 flex-wrap text-base-content/55">
<a href={ templ.SafeURL("/logs/sync-logs/" + s.SyncLogID) } class="mt-1 inline-flex items-center gap-1.5 text-base-content/55 hover:text-primary transition-colors no-underline">
@components.LucideIcon("zap", "w-3 h-3 text-primary opacity-70")
for i, ro := range s.RuleOutcomes {
if i > 0 {
<span class="text-base-content/25">·</span>
}
if ro.RuleShortID != "" {
<a href={ templ.SafeURL("/rules/" + ro.RuleShortID) } class="hover:text-primary transition-colors no-underline">
<span class="font-medium text-base-content/85">{ feedNonEmpty(ro.RuleName, "A rule") }</span>
<span>&nbsp;applied to&nbsp;</span>
<span class="font-medium tabular-nums text-base-content/85">{ fmt.Sprintf("%d", ro.Count) }</span>
</a>
} else {
<span>
<span class="font-medium text-base-content/85">{ feedNonEmpty(ro.RuleName, "A rule") }</span>
<span>&nbsp;applied to&nbsp;</span>
<span class="font-medium tabular-nums text-base-content/85">{ fmt.Sprintf("%d", ro.Count) }</span>
</span>
}
}
</div>
<span class="font-medium text-base-content/85">{ feedRuleSummaryText(s.RuleOutcomes) }</span>
</a>
}
}

Expand Down Expand Up @@ -1046,6 +1029,21 @@ func feedNonEmpty(a, fallback string) string {
return fallback
}

// feedRuleSummaryText renders the one-line rule-application summary shown on
// a sync card — e.g. "3 rules applied · 12 hits". The per-rule breakdown
// (which rule, how many each) lives on the sync-log detail page that the
// summary links to, so the feed stays a glanceable headline.
func feedRuleSummaryText(outcomes []FeedRuleOutcome) string {
rules := len(outcomes)
total := 0
for _, o := range outcomes {
total += o.Count
}
return fmt.Sprintf("%d %s applied · %d %s",
rules, pluralLabel("rule", rules != 1),
total, pluralLabel("hit", total != 1))
}

// feedDisplayName resolves the preferred display label for a feed tx ref:
// the assigned counterparty's name when present, otherwise the caller's
// provider/merchant fallback. Mirrors the COALESCE(counterparty_name, ...)
Expand Down
Loading