console: the billing page gets a plan summary, plan cards with inclusions, a currency switch and pack rows (styling only; no client JS; currency and action invariants unchanged)
Squashed from billing-page-style into main.
7 files changed,
+409
−35
docs/superpowers/reviews/CODEX-FINDINGS-billing-page-style-r1.md+21 −0docs/superpowers/reviews/CODEX-REVIEW-BRIEF-billing-page-style.md+32 −0internal/console/billingpage.go+126 −6internal/console/billingpage_copy.go+23 −1internal/console/billingpage_test.go+31 −0internal/console/templates/billing.html+59 −28internal/console/templates/layout.html+117 −0
CI cancelled — superseded by a newer push — run details
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-billing-page-style-r1.md b/docs/superpowers/reviews/CODEX-FINDINGS-billing-page-style-r1.md| new file mode 100644 |
| index 000000000..ce3f35a7b |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-FINDINGS-billing-page-style-r1.md |
| @@ -0,0 +1,21 @@ |
| +# Astra findings: billing-page-style, round 1 of 3 |
| + |
| +gpt-6-astra via codex, high, at 468fac58. Unedited. |
| + |
| +Review round 1 at `468fac587c3a0fa554cfb01b1d27317b4eba3502`. No P1 findings identified. |
| + |
| +1. **P2 — Team summary uses current members instead of paid seats.** |
| + [billingpage.go:381](/home/paulca/.cache/tmp/claude-1001/billing-page-style/internal/console/billingpage.go:381) passes `members` directly to `Effective`. Enforced limits instead use the stored seats when positive ([planlapse.go:103](/home/paulca/.cache/tmp/claude-1001/billing-page-style/internal/console/planlapse.go:103)). With the example catalog, a Community account retaining 20 paid seats after membership falls to 10 displays **50 apps and instances**, although its entitlement remains **100** until renewal. |
| + **Fix:** Apply the existing `teamMembers` rule to the current-plan summary. Keep current membership for purchase previews. |
| + |
| +2. **P2 — Quantity input boundaries have insufficient contrast.** |
| + [layout.html:651](/home/paulca/.cache/tmp/claude-1001/billing-page-style/internal/console/templates/layout.html:651) replaces the native number-input border with `--rule` against `--bg`: approximately **1.22:1 in light mode** and **1.27:1 in dark mode**. An unfocused, empty input without visible spinner controls becomes difficult to locate. Hover and focus styling do not address its initial visibility. |
| + **Fix:** Use a control-border colour with at least 3:1 contrast in both themes. This follows the input-boundary guidance in [https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html). |
| + |
| +3. **P2 — Long plan names overflow the cards.** |
| + [layout.html:622](/home/paulca/.cache/tmp/claude-1001/billing-page-style/internal/console/templates/layout.html:622) makes the name a flex item with its default minimum width and no word-breaking rule. A long, unbroken catalog name cannot shrink or wrap within the card; at 390 px it can extend beyond the viewport, and on desktop beyond its card. |
| + **Fix:** Allow the name to shrink with `min-width: 0` and wrap with `overflow-wrap: anywhere`. Apply equivalent handling to the summary’s plan name. |
| + |
| +Validation: `git diff --check` passed. Targeted billing-page tests could not start because the read-only sandbox prevented Go from creating its build directory. Layout findings are from static CSS inspection; browser rendering was not verified. No files were changed. |
| + |
| +**READY AFTER FIXES** |
| \ No newline at end of file |
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-billing-page-style.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-billing-page-style.md| new file mode 100644 |
| index 000000000..24065da63 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-billing-page-style.md |
| @@ -0,0 +1,32 @@ |
| +# Review brief: branch billing-page-style, round 1 of 3 |
| + |
| +Repo carlos/platform, branch `billing-page-style`, the commit that adds this brief (named in your prompt). |
| +Under review: the diff `origin/main...HEAD` (a restyle of the console billing page: internal/console/templates/billing.html, layout.html CSS, billingpage.go view model, billingpage_copy.go). |
| +Authorities (merged on main): Plan 6b `docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md` Task 8 and its ledger rulings in `docs/superpowers/notes/plans-6b-ledger.md` (notably the Task 8 currency ruling: every sold currency's prices render, CSS :has shows the checked one, radios required in the buy form, a refused currency query preselects nothing, no client JS). Paul approved the new strings unchanged on 2026-10-28. |
| + |
| +You are an independent reviewer. Read the diff and check every claim against the code. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- The visual direction (summary tile, plan cards, segmented currency control, pack rows). Report only defects. |
| +- Copy text (approved by Paul). |
| + |
| +## What to check |
| + |
| +1. Behaviour unchanged: form field names (plan, currency, pack_<name>, start_over, renewal, csrf), the decision's action order, every notice state, member/operator/owner differences, the fixed-currency case. |
| +2. The currency invariant: the buy form can never submit a currency whose prices are not on the page, and the visible prices are the checked currency's; a refused query selects nothing; still no client JS. |
| +3. Accessibility: each radio and quantity input has a real label, focus is visible, the visually hidden radios are still keyboard operable and announced, contrast of the new colours. |
| +4. The new view-model code (limits shown per plan and pack "adds"): correct values from the catalog, team plans, overflow or missing limits, no panic on an empty or unusual catalog, no provider calls added. |
| +5. Narrow screens (390 px) and long values (big numbers, long plan names). |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for another round. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3 with file:line evidence, failure scenario and fix. End with exactly one verdict: **READY**, **READY AFTER FIXES**, or **NOT READY**. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of your own. Do not run the full test suites. |
diff --git a/internal/console/billingpage.go b/internal/console/billingpage.go| index 8e341705e..442ea9b52 100644 |
| --- a/internal/console/billingpage.go |
| +++ b/internal/console/billingpage.go |
| @@ -9,6 +9,7 @@ import ( |
| "net/url" |
| "regexp" |
| "slices" |
| + "strconv" |
| "strings" |
| "time" |
| @@ -193,8 +194,13 @@ type billingView struct { |
| Notice, OwnersOnly, CurrencyNotice string |
| // Actions is decideBillingPage's Offered: the template renders each |
| // offered action in this order. |
| - Actions []string |
| + Actions []string |
| + // The summary: the current plan's label, its facts (packs held, |
| + // members on a team plan, currency, renewal) and a few of the limits |
| + // it gives the account today. |
| + Plan string |
| Facts []string |
| + Includes []string |
| Offers billingOffers |
| Buy *billingBuyView |
| Change *billingChangeView |
| @@ -232,10 +238,14 @@ type billingPlanOption struct { |
| // Prices and, on a team plan, Totals: one per currency the form can |
| // submit. |
| Prices, Totals []billingPrice |
| + // Includes is a few of the plan's limits for this account today |
| + // (planIncludes). |
| + Includes []string |
| } |
| type billingPackInput struct { |
| Name, Price string // Price: the change form's, in the subscription's currency |
| + Label, Adds string // the pack as the page names it, and what one adds |
| Prices []billingPrice // the purchase form's, one per currency it can submit |
| Max, Value int |
| } |
| @@ -356,12 +366,26 @@ func (s *Server) billingViewFor(r *http.Request, in billingPageInput, st billing |
| } |
| } |
| - // The facts. |
| + // The summary. |
| plan, packs := cat.DefaultPlan, map[string]int(nil) |
| + var sponsored *plans.Limits |
| + seats := 0 |
| if in.Row != nil { |
| - plan, packs = in.Row.Plan, in.Row.Packs |
| + 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 { |
| + held := map[string]int{} |
| + for _, name := range heldPacks(packs) { |
| + held[name] = packs[name] |
| + } |
| + // 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) |
| + } |
| } |
| - v.Facts = append(v.Facts, fmt.Sprintf(billingCopy["fact.plan"], planLabel(plan))) |
| if held := heldPacks(packs); len(held) > 0 { |
| var parts []string |
| for _, name := range held { |
| @@ -445,6 +469,9 @@ func (s *Server) billingBuy(r *http.Request, book *plans.PriceBook, b *billingAc |
| for _, name := range paidPlansByTotal(cat, book, order) { |
| p := cat.Plans[name] |
| opt := billingPlanOption{Name: name, Label: planLabel(name), Checked: name == want} |
| + if l, err := cat.Effective(name, nil, nil, members); err == nil { |
| + opt.Includes = planIncludes(l, p.MaxMembers) |
| + } |
| for _, c := range codes { |
| price, ok := book.PlanPrice(name, c) |
| if !ok { |
| @@ -463,7 +490,7 @@ func (s *Server) billingBuy(r *http.Request, book *plans.PriceBook, b *billingAc |
| continue |
| } |
| seen[pk] = true |
| - in := billingPackInput{Name: pk, Max: cat.Packs[pk].MaxQuantity} |
| + in := billingPackInput{Name: pk, Label: planLabel(pk), Adds: packAdds(cat.Packs[pk].Adds), Max: cat.Packs[pk].MaxQuantity} |
| for _, c := range codes { |
| if price, ok := book.PackPrice(pk, c); ok { |
| in.Prices = append(in.Prices, billingPrice{c, fmt.Sprintf(billingCopy["pack.price"], plans.FormatMinor(c, price))}) |
| @@ -506,7 +533,7 @@ func billingChange(cat *plans.Catalog, book *plans.PriceBook, plan string, packs |
| } |
| func packInput(cat *plans.Catalog, book *plans.PriceBook, name, currency string, value int) billingPackInput { |
| - in := billingPackInput{Name: name, Max: cat.Packs[name].MaxQuantity, Value: value} |
| + in := billingPackInput{Name: name, Label: planLabel(name), Adds: packAdds(cat.Packs[name].Adds), Max: cat.Packs[name].MaxQuantity, Value: value} |
| if price, ok := book.PackPrice(name, currency); ok { |
| in.Price = fmt.Sprintf(billingCopy["pack.price"], plans.FormatMinor(currency, price)) |
| } |
| @@ -583,6 +610,99 @@ func planLabel(name string) string { |
| func billingDate(t time.Time) string { return t.UTC().Format("2 January 2006") } |
| +// planIncludes is a few of l's limits as a plan card lists them, in the |
| +// words `carlos accounts plan` uses: apps and instances, sleeps after, |
| +// disk per app, custom domains, and the member cap of a plan that has one |
| +// (maxMembers, 0 for none). A limit of 0 is left out. |
| +func planIncludes(l plans.Limits, maxMembers int) []string { |
| + var out []string |
| + if l.RunningThings > 0 { |
| + out = append(out, fmt.Sprintf(billingCopy["limit.running"], billingCount(int64(l.RunningThings)))) |
| + } |
| + if l.IdleSeconds > 0 { |
| + out = append(out, fmt.Sprintf(billingCopy["limit.idle"], billingDuration(l.IdleSeconds))) |
| + } |
| + if l.DiskBytes > 0 { |
| + out = append(out, fmt.Sprintf(billingCopy["limit.disk"], billingBytes(l.DiskBytes))) |
| + } |
| + if l.CustomDomains { |
| + out = append(out, billingCopy["limit.domains"]) |
| + } |
| + if maxMembers > 0 { |
| + out = append(out, fmt.Sprintf(billingCopy["limit.members"], maxMembers)) |
| + } |
| + return out |
| +} |
| + |
| +// packAdds is what one unit of a pack adds, as its row says it; "" when |
| +// it adds nothing the page names. |
| +func packAdds(a plans.Limits) string { |
| + var parts []string |
| + if a.RunningThings > 0 { |
| + parts = append(parts, fmt.Sprintf(billingCopy["limit.running"], billingCount(int64(a.RunningThings)))) |
| + } |
| + if a.DiskBytes > 0 { |
| + parts = append(parts, fmt.Sprintf(billingCopy["limit.disk"], billingBytes(a.DiskBytes))) |
| + } |
| + if a.StorageBytes > 0 { |
| + parts = append(parts, fmt.Sprintf(billingCopy["limit.storage"], billingBytes(a.StorageBytes))) |
| + } |
| + if a.EmailPerDay > 0 { |
| + parts = append(parts, fmt.Sprintf(billingCopy["limit.email"], billingCount(int64(a.EmailPerDay)))) |
| + } |
| + if a.BandwidthBytesMonth > 0 { |
| + parts = append(parts, fmt.Sprintf(billingCopy["limit.bandwidth"], billingBytes(a.BandwidthBytesMonth))) |
| + } |
| + if len(parts) == 0 { |
| + return "" |
| + } |
| + return fmt.Sprintf(billingCopy["pack.adds"], strings.Join(parts, ", ")) |
| +} |
| + |
| +// billingBytes is a size in GB, or MB below one GB, in the binary units |
| +// the catalog's numbers are written in (as accounts_plan.go's planBytes). |
| +func billingBytes(b int64) string { |
| + const mb, gb = 1 << 20, 1 << 30 |
| + if b >= gb { |
| + if b%gb == 0 { |
| + return billingCount(b/gb) + " GB" |
| + } |
| + return strconv.FormatFloat(float64(b)/gb, 'f', 1, 64) + " GB" |
| + } |
| + return billingCount(b/mb) + " MB" |
| +} |
| + |
| +// billingCount is n with its thousands grouped: 1000 is "1,000". |
| +func billingCount(n int64) string { |
| + if n < 0 { |
| + return "-" + billingCount(-n) |
| + } |
| + s := strconv.FormatInt(n, 10) |
| + for i := len(s) - 3; i > 0; i -= 3 { |
| + s = s[:i] + "," + s[i:] |
| + } |
| + return s |
| +} |
| + |
| +// billingDuration is seconds in the largest whole unit: 900 is "15 |
| +// minutes", 90 is "90 seconds". |
| +func billingDuration(s int) string { |
| + unit := func(n int, one, many string) string { |
| + if n == 1 { |
| + return fmt.Sprintf(billingCopy[one], n) |
| + } |
| + return fmt.Sprintf(billingCopy[many], n) |
| + } |
| + switch { |
| + case s%3600 == 0: |
| + return unit(s/3600, "duration.hour", "duration.hours") |
| + case s%60 == 0: |
| + return unit(s/60, "duration.minute", "duration.minutes") |
| + default: |
| + return unit(s, "duration.second", "duration.seconds") |
| + } |
| +} |
| + |
| // ---- /upgrade ------------------------------------------------------------- |
| // upgradeCurrency is a currency value /upgrade keeps as given. |
diff --git a/internal/console/billingpage_copy.go b/internal/console/billingpage_copy.go| index 20d716e8e..b75ebd252 100644 |
| --- a/internal/console/billingpage_copy.go |
| +++ b/internal/console/billingpage_copy.go |
| @@ -98,7 +98,6 @@ var billingCopy = map[string]string{ |
| "pick.title": "Which account?", |
| // Task 8's own drafts, beyond the plan's list: labels the page needs. |
| - "fact.plan": "Plan: %s", |
| "fact.packs": "Packs: %s", |
| "fact.currency": "Pays in %s", |
| "plan.price": "%s a year", |
| @@ -116,4 +115,27 @@ var billingCopy = map[string]string{ |
| "error.title": "Error", |
| "page.read_failed": "We couldn't read billing. Please try again.", |
| "upgrade.read_failed": "We couldn't read your accounts. Please try again.", |
| + |
| + // The page's styling pass (2026-10-28): the summary's heading, the |
| + // packs heading and line, and the limits a plan card and a pack row |
| + // list, in the words `carlos accounts plan` uses. DRAFTS for copy |
| + // review. |
| + "summary.title": "Your plan", |
| + "packs.title": "Packs", |
| + "packs.lede": "Optional. Each pack adds to the plan's limits.", |
| + "pack.adds": "Adds %s", |
| + "limit.running": "%s apps and instances", |
| + "limit.idle": "Sleeps after %s", |
| + "limit.disk": "%s disk per app", |
| + "limit.storage": "%s object storage", |
| + "limit.email": "%s emails a day", |
| + "limit.bandwidth": "%s bandwidth a month", |
| + "limit.domains": "Custom domains", |
| + "limit.members": "Up to %d members", |
| + "duration.second": "%d second", |
| + "duration.seconds": "%d seconds", |
| + "duration.minute": "%d minute", |
| + "duration.minutes": "%d minutes", |
| + "duration.hour": "%d hour", |
| + "duration.hours": "%d hours", |
| } |
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/billing.html b/internal/console/templates/billing.html| index 7504b6164..570cdc9ea 100644 |
| --- a/internal/console/templates/billing.html |
| +++ b/internal/console/templates/billing.html |
| @@ -9,10 +9,20 @@ |
| {{if .Notice}}<p class="banner">{{.Notice}}</p>{{end}} |
| {{if .OwnersOnly}}<p class="banner">{{.OwnersOnly}}</p>{{end}} |
| {{if .CurrencyNotice}}<p class="banner error">{{.CurrencyNotice}}</p>{{end}} |
| -<ul> |
| - {{range .Facts}}<li>{{.}}</li> |
| - {{end}} |
| -</ul> |
| +<section class="tile billing-now" aria-labelledby="billing-now-title"> |
| + <div> |
| + <h2 id="billing-now-title">{{billingText "summary.title"}}</h2> |
| + <p class="tile-value">{{.Plan}}</p> |
| + {{if .Facts}}<ul class="billing-facts"> |
| + {{range .Facts}}<li>{{.}}</li> |
| + {{end}} |
| + </ul>{{end}} |
| + </div> |
| + {{if .Includes}}<ul class="billing-includes"> |
| + {{range .Includes}}<li>{{icon "check"}}<span>{{.}}</span></li> |
| + {{end}} |
| + </ul>{{end}} |
| +</section> |
| {{/* The offered actions, in decideBillingPage's order. */}} |
| {{range .Actions}} |
| {{if eq . "confirm"}}<div class="settings-row"><form method="post" action="{{$.Base}}/billing/confirm"> |
| @@ -37,59 +47,80 @@ |
| <button type="submit">{{billingText "button.resume"}}</button> |
| </form></div>{{end}} |
| {{if eq . "buy"}}{{with $.Billing.Buy}} |
| -<h2>{{billingText "buy.title"}}</h2> |
| {{if .Currencies}}<style> |
| {{range .Currencies}}.buy:has(input[name=currency][value={{.Code}}]:checked) .price:not(.price-{{.Code}}){display:none} |
| {{end}}</style>{{end}} |
| +{{/* One form: the currency, a plan card per paid plan, the packs. Every |
| + price stays on the page in every currency the form can submit; the |
| + rules above show the checked currency's. */}} |
| <form class="buy" method="post" action="{{$.Base}}/billing/checkout"> |
| <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| - {{if .FixedCurrency}}<p>{{.FixedCurrency}}<input type="hidden" name="currency" value="{{.FixedCurrency}}"></p> |
| - {{else}}<p>{{billingText "currency.legend"}}: |
| - {{range .Currencies}}<label><input type="radio" name="currency" value="{{.Code}}"{{if .Checked}} checked{{end}} required> {{.Code}}</label> |
| - {{end}} |
| - </p>{{end}} |
| - {{range .Plans}}<p data-plan="{{.Name}}"> |
| - <label><input type="radio" name="plan" value="{{.Name}}"{{if .Checked}} checked{{end}} required> {{.Label}}</label> |
| - {{range .Prices}}<span class="small price price-{{.Code}}" data-currency="{{.Code}}">{{.Text}}</span> |
| - {{end}}{{range .Totals}}<span class="small price price-{{.Code}} total" data-currency="{{.Code}}">{{.Text}}</span> |
| - {{end}} |
| - </p> |
| - {{end}} |
| + <div class="sectionhead"> |
| + <h2 id="buy-title">{{billingText "buy.title"}}</h2> |
| + {{if .FixedCurrency}}<p class="currency"><span class="small">{{billingText "currency.legend"}}</span> |
| + <span class="seg"><span class="seg-fixed">{{.FixedCurrency}}</span></span><input type="hidden" name="currency" value="{{.FixedCurrency}}"></p> |
| + {{else}}<fieldset class="currency"> |
| + <legend class="small">{{billingText "currency.legend"}}</legend> |
| + <span class="seg"> |
| + {{range .Currencies}}<label><input type="radio" name="currency" value="{{.Code}}"{{if .Checked}} checked{{end}} required><span>{{.Code}}</span></label> |
| + {{end}}</span> |
| + </fieldset>{{end}} |
| + </div> |
| + <fieldset class="plan-cards" aria-labelledby="buy-title"> |
| + {{range .Plans}}<div class="plan-card"> |
| + <p data-plan="{{.Name}}"> |
| + <label><input type="radio" name="plan" value="{{.Name}}"{{if .Checked}} checked{{end}} required aria-describedby="plan-{{.Name}}-cost{{if .Includes}} plan-{{.Name}}-incl{{end}}"> <span class="plan-name">{{.Label}}</span></label> |
| + <span class="plan-cost" id="plan-{{.Name}}-cost"> |
| + {{range .Prices}}<span class="small price price-{{.Code}}" data-currency="{{.Code}}">{{.Text}}</span> |
| + {{end}}{{range .Totals}}<span class="small price price-{{.Code}} total" data-currency="{{.Code}}">{{.Text}}</span> |
| + {{end}}</span> |
| + </p> |
| + {{if .Includes}}<ul class="plan-incl" id="plan-{{.Name}}-incl"> |
| + {{range .Includes}}<li>{{icon "check"}}<span>{{.}}</span></li> |
| + {{end}} |
| + </ul>{{end}} |
| + </div> |
| + {{end}}</fieldset> |
| + {{if .Packs}}<h3 id="packs-title">{{billingText "packs.title"}}</h3> |
| + <p class="small">{{billingText "packs.lede"}}</p> |
| <div class="tablewrap"> |
| - <table> |
| + <table class="packs" aria-labelledby="packs-title"> |
| {{range .Packs}}<tr data-pack="{{.Name}}"> |
| - <td><label for="pack-{{.Name}}">{{.Name}}</label></td> |
| - <td><input type="number" id="pack-{{.Name}}" name="pack_{{.Name}}" min="0" max="{{.Max}}" step="1" value="{{.Value}}"></td> |
| + <td><label for="pack-{{.Name}}">{{.Label}}</label>{{if .Adds}}<span class="small" id="pack-{{.Name}}-adds">{{.Adds}}</span>{{end}}</td> |
| + <td><input type="number" id="pack-{{.Name}}" name="pack_{{.Name}}" min="0" max="{{.Max}}" step="1" value="{{.Value}}" inputmode="numeric"{{if .Adds}} aria-describedby="pack-{{.Name}}-adds"{{end}}></td> |
| <td>{{range .Prices}}<span class="small price price-{{.Code}}" data-currency="{{.Code}}">{{.Text}}</span> |
| {{end}}</td> |
| </tr> |
| {{end}} |
| </table> |
| + </div>{{end}} |
| + <div class="buy-foot"> |
| + <button type="submit">{{billingText "buy.button"}}</button> |
| </div> |
| - <button type="submit">{{billingText "buy.button"}}</button> |
| </form> |
| {{end}}{{end}} |
| {{if eq . "change"}}{{with $.Billing.Change}} |
| +{{if .Packs}}<h2 id="packs-title">{{billingText "packs.title"}}</h2> |
| <div class="tablewrap"> |
| -<table> |
| +<table class="packs packs-change" aria-labelledby="packs-title"> |
| {{range .Packs}}<tr> |
| - <td><label for="change-{{.Name}}">{{.Name}}</label></td> |
| + <td><label for="change-{{.Name}}">{{.Label}}</label>{{if .Adds}}<span class="small" id="change-{{.Name}}-adds">{{.Adds}}</span>{{end}}</td> |
| <td class="small">{{.Price}}</td> |
| <td><form method="post" action="{{$.Base}}/billing/change"> |
| <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| <input type="hidden" name="pack" value="{{.Name}}"> |
| - <input type="number" id="change-{{.Name}}" name="quantity" value="{{.Value}}" min="0" max="{{.Max}}" step="1"> |
| - <button class="linkish" type="submit">{{billingText "button.change"}}</button> |
| + <input type="number" id="change-{{.Name}}" name="quantity" value="{{.Value}}" min="0" max="{{.Max}}" step="1" inputmode="numeric"{{if .Adds}} aria-describedby="change-{{.Name}}-adds"{{end}}> |
| + <button class="btn-sm btn-secondary" type="submit">{{billingText "button.change"}}</button> |
| </form></td> |
| </tr> |
| {{end}} |
| </table> |
| -</div> |
| -{{if .Upgrades}}<div class="settings-row"> |
| +</div>{{end}} |
| +{{if .Upgrades}}<div class="settings-row billing-upgrades"> |
| {{range .Upgrades}}<form method="post" action="{{$.Base}}/billing/change"> |
| <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| <input type="hidden" name="plan" value="{{.Name}}"> |
| - <button type="submit">{{.Label}}</button> |
| + <button class="btn-secondary" type="submit">{{.Label}}</button> |
| </form> |
| {{end}} |
| </div>{{end}} |
diff --git a/internal/console/templates/layout.html b/internal/console/templates/layout.html| index 2df237b94..1043ce9f7 100644 |
| --- a/internal/console/templates/layout.html |
| +++ b/internal/console/templates/layout.html |
| @@ -558,6 +558,123 @@ |
| header nav a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: none; } |
| header nav a.addr { color: var(--muted); text-decoration: none; } |
| header nav a.addr:hover { text-decoration: underline; } |
| + /* The billing page (billing.html). Its price elements carry fixed class |
| + lists that billing.html's own currency rules and their guard test |
| + (TestBillingPagePricesFollowShownCurrency) read, so they are styled |
| + here as span.price in context, never by a class of their own. |
| + |
| + The summary is a tile: the plan's name as its value, its facts under |
| + it, and what it gives the account today beside them. */ |
| + .billing-now { |
| + 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 > 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; } |
| + .billing-includes li, .plan-incl li { display: flex; align-items: flex-start; gap: 0.5rem; } |
| + .billing-includes .icon, .plan-incl .icon { color: var(--accent); margin-top: 0.25em; } |
| + /* The purchase form: a heading with the currency switch at its right |
| + end, the plan cards, the packs, then the one button. */ |
| + .buy fieldset { border: 0; min-width: 0; } |
| + .buy .currency { display: flex; align-items: center; gap: 0.6rem; margin: 0; } |
| + .buy .currency legend { float: left; } |
| + /* A segmented control made of real radios: each radio is laid |
| + transparently over its own label, so it keeps its click, its keyboard |
| + arrows and its required check, and the label carries the look. */ |
| + .seg { |
| + display: inline-flex; gap: 2px; padding: 2px; border-radius: 0.5rem; |
| + background: var(--accent-soft); |
| + } |
| + .seg label { position: relative; display: block; } |
| + .seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; } |
| + .seg label > span, .seg-fixed { |
| + display: block; min-width: 3.4rem; padding: 0.4rem 0.75rem; border-radius: 0.375rem; |
| + font-size: 0.82rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; |
| + text-align: center; color: var(--muted); line-height: 1.3; |
| + transition: color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out; |
| + } |
| + .seg label:hover > span { color: var(--ink); } |
| + .seg label:has(input:checked) > span, .seg-fixed { |
| + background: var(--bg); color: var(--ink); |
| + box-shadow: 0 1px 2px rgba(32, 29, 41, 0.12), 0 1px 4px rgba(32, 29, 41, 0.08); |
| + } |
| + .seg label:has(input:focus-visible) > span { outline: 2px solid var(--accent); outline-offset: 1px; } |
| + /* Plan cards. The label's ::after stretches over its card, so the whole |
| + card picks the plan; the checked card takes the accent. */ |
| + .plan-cards { |
| + display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); |
| + gap: 1rem; margin: 0 0 2.25rem; |
| + } |
| + .plan-card { |
| + position: relative; border: 1px solid var(--rule); border-radius: 0.6rem; |
| + padding: 1.1rem 1.25rem 1.25rem; |
| + transition: border-color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out; |
| + } |
| + .plan-card:hover { border-color: var(--muted); } |
| + .plan-card:has(input:checked) { |
| + border-color: var(--accent); background: var(--accent-soft); |
| + box-shadow: inset 0 0 0 1px var(--accent); |
| + } |
| + .plan-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; } |
| + .plan-card p { margin: 0; max-width: none; } |
| + .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 { 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; |
| + line-height: 1.3; text-wrap: balance; font-variant-numeric: tabular-nums; |
| + } |
| + .plan-card span.total { margin-top: 0.4rem; font-size: 0.9rem; font-weight: 500; } |
| + /* No currency checked yet (a refused one): every currency's price shows, |
| + so each steps down to one line's weight. */ |
| + .buy:not(:has(input[name=currency]:checked)) .plan-card span.price { font-size: 0.95rem; font-weight: 500; } |
| + .plan-incl { margin: 1rem 0 0; padding: 0.9rem 0 0; border-top: 1px solid var(--rule); } |
| + .plan-card:has(input:checked) .plan-incl { border-top-color: var(--accent-soft); } |
| + /* Packs: one row each, the name and what one adds, a quantity, a price. |
| + The quantity box is wide enough for its maximum and steps by one. */ |
| + .buy h3 { margin: 0 0 0.2rem; } |
| + .buy h3 + .small { margin: 0 0 0.75rem; } |
| + table.packs { margin: 0; } |
| + .packs tr:first-child td { border-top: 1px solid var(--rule); } |
| + .packs td { padding: 0.75rem 1.25rem 0.75rem 0; vertical-align: middle; } |
| + .packs td:first-child { width: 100%; } |
| + .packs td + td { white-space: nowrap; } |
| + .packs td:last-child { padding-right: 0; text-align: right; } |
| + .packs label { display: block; font-weight: 600; } |
| + .packs td:first-child .small { display: block; } |
| + .packs span.price { display: block; color: var(--ink); font-variant-numeric: tabular-nums; } |
| + .packs td form { justify-content: flex-end; flex-wrap: nowrap; } |
| + .packs input[type=number] { |
| + 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(--muted); border-radius: 0.4rem; |
| + } |
| + .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; } |
| + .billing-upgrades { margin-top: 1.25rem; } |
| + @media (min-width: 46rem) { |
| + .billing-includes { grid-template-columns: repeat(2, auto); } |
| + } |
| + @media (max-width: 40rem) { |
| + .billing-now { padding: 1rem 1.1rem 1.1rem; } |
| + .packs tr { |
| + display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; |
| + gap: 0.6rem 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--rule); |
| + } |
| + .packs tr:first-child { border-top: 1px solid var(--rule); } |
| + .packs td, .packs tr:first-child td { display: block; width: auto; padding: 0; border: 0; } |
| + .packs td:first-child { grid-column: 1 / -1; } |
| + .packs td:last-child { text-align: right; } |
| + .buy-foot button { width: 100%; } |
| + } |
| </style> |
| </head> |
| <body> |