carlos / platform Public

console: billing page review fixes: paid seats in the summary, visible quantity borders, long plan names wrap

Astra round 1 (READY AFTER FIXES, three P2s):
- The current-plan summary limits a team plan at its stored paid seats
  when positive (teamMembers, as enforcement does); purchase previews
  keep current membership. TestBillingPageSummaryCountsPaidSeats: a
  Community account with 20 seats and 10 members shows 100 apps and
  instances, not 50.
- The pack quantity box's border is --muted (5.5:1 light, 7.2:1 dark
  against --bg), not --rule (about 1.2:1).
- Plan names in the cards and the summary shrink and wrap
  (min-width: 0, overflow-wrap: anywhere).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev bbd08aedad78ae58f23d09e4d76f0e1140c8f330 parent 64aaae6
3 files changed, +42 −6
  • internal/console/billingpage.go +6 −2
  • internal/console/billingpage_test.go +31 −0
  • internal/console/templates/layout.html +5 −4

CI passed — run details

diff --git a/internal/console/billingpage.go b/internal/console/billingpage.go
index e943a6032..442ea9b52 100644
--- a/internal/console/billingpage.go
+++ b/internal/console/billingpage.go
@@ -369,8 +369,9 @@ func (s *Server) billingViewFor(r *http.Request, in billingPageInput, st billing
// The summary.
plan, packs := cat.DefaultPlan, map[string]int(nil)
var sponsored *plans.Limits
+ seats := 0
if in.Row != nil {
- plan, packs, sponsored = in.Row.Plan, in.Row.Packs, in.Row.Sponsored
+ plan, packs, sponsored, seats = in.Row.Plan, in.Row.Packs, in.Row.Sponsored, in.Row.Seats
}
v.Plan = planLabel(plan)
if p, ok := cat.Plans[plan]; ok {
@@ -378,7 +379,10 @@ func (s *Server) billingViewFor(r *http.Request, in billingPageInput, st billing
for _, name := range heldPacks(packs) {
held[name] = packs[name]
}
- if l, err := cat.Effective(plan, held, sponsored, members); err == nil {
+ // The limits the account has now: a team plan's at its paid seats
+ // when billing wrote some, as enforcement counts them (teamMembers).
+ limitedAt, _ := teamMembers(cat, plan, seats, func() (int, error) { return members, nil })
+ if l, err := cat.Effective(plan, held, sponsored, limitedAt); err == nil {
v.Includes = planIncludes(l, p.MaxMembers)
}
}
diff --git a/internal/console/billingpage_test.go b/internal/console/billingpage_test.go
index 41de921f6..ce6d636b6 100644
--- a/internal/console/billingpage_test.go
+++ b/internal/console/billingpage_test.go
@@ -510,6 +510,37 @@ func TestBillingPagePaidFacts(t *testing.T) {
// TestBillingPageOpenIntent: an open Checkout offers continue (a GET, so
// the session token never rides in a URL) and start over (the intent's
// own request, posted with CSRF).
+// TestBillingPageSummaryCountsPaidSeats: the summary shows a team plan's
+// limits at its paid seats, as enforcement counts them (teamMembers), not
+// at the current member count. 20 seats with 10 members is 20 seats'
+// limits: 25 x 0.2 x 20 = 100 apps and instances, not 50.
+func TestBillingPageSummaryCountsPaidSeats(t *testing.T) {
+ pf := newBillingPageFixture(t)
+ for i := 0; i < 9; i++ { // the owner and 9: 10 members
+ if err := pf.st.AddMember(pf.acct.ID, fmt.Sprintf("s%d@example.com", i), RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if _, err := pf.st.SetAccountPlan(pf.acct.ID, "community", map[string]int{}, 20, PlanSourceBilling, nil, "billing", "billing", time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if err := pf.st.PutBillingState(billingAccount{AccountID: pf.acct.ID, Subscription: "sub_1", State: billing.StatePaid, Live: true,
+ Currency: "usd", PeriodEnd: periodEnd, Plan: "community", Seats: 20, PaidSeats: 20, PaidPacks: map[string]int{}}); err != nil {
+ t.Fatal(err)
+ }
+ _, body := pf.page(t, "")
+ i := strings.Index(body, `class="tile billing-now"`)
+ if i < 0 {
+ t.Fatalf("no summary:\n%s", body)
+ }
+ summary := body[i:]
+ summary = summary[:strings.Index(summary, "</section>")]
+ running := func(n string) string { return esc(fmt.Sprintf(billingCopy["limit.running"], n)) }
+ if !strings.Contains(summary, running("100")) || strings.Contains(summary, running("50")) {
+ t.Errorf("the summary is not at 20 paid seats (want %q):\n%s", running("100"), summary)
+ }
+}
+
func TestBillingPageOpenIntent(t *testing.T) {
pf := newBillingPageFixture(t)
ci := testIntent(pf.acct.ID, "ci_page")
diff --git a/internal/console/templates/layout.html b/internal/console/templates/layout.html
index 0fb0d1b2a..1043ce9f7 100644
--- a/internal/console/templates/layout.html
+++ b/internal/console/templates/layout.html
@@ -569,7 +569,8 @@
display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start;
gap: 1rem 3rem; padding: 1.15rem 1.4rem 1.25rem; margin: 0 0 0.5rem;
}
- .billing-now .tile-value { margin: 0 0 0.3rem; line-height: 1.2; }
+ .billing-now > div { min-width: 0; }
+ .billing-now .tile-value { margin: 0 0 0.3rem; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
.billing-facts { list-style: none; font-size: 0.9rem; color: var(--muted); }
.billing-includes, .plan-incl { list-style: none; display: grid; gap: 0.3rem; font-size: 0.9rem; }
.billing-includes { grid-template-columns: repeat(auto-fit, minmax(13rem, auto)); column-gap: 2rem; align-self: center; }
@@ -622,7 +623,7 @@
.plan-card label { display: flex; align-items: center; gap: 0.55rem; cursor: pointer; }
.plan-card label::after { content: ""; position: absolute; inset: 0; }
.plan-card input { flex: none; width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); cursor: pointer; }
- .plan-name { font-size: 1.15rem; font-weight: 650; }
+ .plan-name { min-width: 0; overflow-wrap: anywhere; font-size: 1.15rem; font-weight: 650; }
.plan-cost { display: block; margin: 0.65rem 0 0; }
.plan-card span.price {
display: block; color: var(--ink); font-size: 1.15rem; font-weight: 650;
@@ -652,9 +653,9 @@
width: 4.75rem; padding: 0.4rem 0.5rem; text-align: center;
font: inherit; font-size: 1rem; font-variant-numeric: tabular-nums;
color: var(--ink); background: var(--bg); accent-color: var(--accent);
- border: 1px solid var(--rule); border-radius: 0.4rem;
+ border: 1px solid var(--muted); border-radius: 0.4rem;
}
- .packs input[type=number]:hover { border-color: var(--muted); }
+ .packs input[type=number]:hover { border-color: var(--ink); }
.packs input[type=number]:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.buy-foot { margin: 1.75rem 0 0; }
.buy-foot button { padding: 0.7rem 1.5rem; }