diff --git a/app/main.py b/app/main.py index 05b5e28..f4e85c2 100644 --- a/app/main.py +++ b/app/main.py @@ -357,6 +357,18 @@ PAGE_HTML = """ .bar .fill { height: 100%; background: var(--green-mid); border-radius: 6px; transition: width .3s ease; } .bar .fill.warn { background: #d99a3e; } .meta { color: var(--muted); font-size: 13px; margin-top: 8px; } + /* Buy-a-credit-pack: always-visible link out to Open Collective, plus + a pointer to the docs section that explains allowance vs. credits. */ + .buy-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; } + a.buy-btn { + display: inline-block; background: var(--green-deep); color: #fff; + border-radius: 8px; font-size: 14px; font-weight: 600; + padding: 8px 16px; text-decoration: none; transition: background .15s ease; + } + a.buy-btn:hover { background: #4e7a4d; } + .buy-hint { color: var(--muted); font-size: 12px; } + a.buy-docs { color: var(--green-deep); font-weight: 600; text-decoration: none; white-space: nowrap; } + a.buy-docs:hover { text-decoration: underline; } .models { margin-top: 16px; } .model-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; @@ -557,6 +569,12 @@ PAGE_HTML = """
Shared across chat and API.
+
+ Buy a credit pack + Credit packs never expire · used after your monthly allowance. + More about allowance & credits → + +
@@ -685,9 +703,12 @@ async function load() { if (d.reset_at) { const d2 = new Date(d.reset_at); const opts = { year: 'numeric', month: 'long', day: 'numeric' }; - let meta = 'Shared across chat and API · Allowance renews ' + d2.toLocaleDateString(undefined, opts); - if (creditsTotal > 0) meta += ' · Credits never expire (' + fmtMoney(creditsTotal) + ' purchased all-time)'; - $('meta').textContent = meta + '.'; + $('meta').textContent = 'Shared across chat and API · Allowance renews ' + d2.toLocaleDateString(undefined, opts) + '.'; + } + + // Credits copy lives in the buy row (next to the button), not the meta line. + if (creditsTotal > 0) { + $('buy-credits').textContent = 'Credits never expire (' + fmtMoney(creditsTotal) + ' purchased all-time).'; } const calls = (d.models || []).reduce((s, m) => s + (m.calls || 0), 0); diff --git a/docs/assets/buy-credit-pack-row.png b/docs/assets/buy-credit-pack-row.png new file mode 100644 index 0000000..74b67b0 Binary files /dev/null and b/docs/assets/buy-credit-pack-row.png differ diff --git a/docs/superpowers/specs/2026-11-01-buy-credit-pack-link-design.md b/docs/superpowers/specs/2026-11-01-buy-credit-pack-link-design.md new file mode 100644 index 0000000..4de0256 --- /dev/null +++ b/docs/superpowers/specs/2026-11-01-buy-credit-pack-link-design.md @@ -0,0 +1,62 @@ +# Buy-a-credit-pack link in the member dashboard — design + +Date: 2026-11-01 · Status: awaiting approval · Size: small change + +## Intent + +Members expect to add usage from the dashboard and can't find it (a real +member got lost and had to ask the AI chat). The buy path lives on the +OpenCollective contribute page, and the dashboard never mentions it. +Payments stay on OpenCollective for now (per Nathan); the fix is making +that path visible from the dashboard, always. + +## Goals + +- A always-visible "Buy a credit pack" affordance in the **My usage** + view of `app/main.py`, linking to + `https://opencollective.com/inference-cooperative/contribute` + (opens in a new tab). +- The meta line under the balance bar keeps its existing shape: + "Shared across chat and API · Allowance renews ." The credits + clause moves out of it. +- The hint next to the button shows the member's real credit status, + same copy the app already used: "Credits never expire ($X purchased + all-time)." For members with no packs yet, the static default reads + "Credit packs never expire · used after your monthly allowance." +- A link to the docs section that explains allowance and credits — + `getting-started.md` → "Need more than the allowance?" — following the + dashboard's existing docs-link pattern + (`https://git.inference.coop/co-op/docs/src/branch/main/...`), so + members can read the full story. + +## Non-goals + +- In-dashboard checkout or handling money in this app (this app holds no + privileged credentials by design). +- Showing pack prices or sizes in the dashboard — those live on OC and + can change there without a deploy here. +- Any low-balance gating — always visible, per Casey's call. + +## Approaches + +1. **Always-visible button + hint line in the usage card** (chosen) — + sits right under the balance bar where a member looks when they're + running low. Discoverable every visit. +2. Low-balance-only (appears when allowance exhausted / bar amber) — + quieter, but repeats the original problem for anyone who wants to + top up early. Rejected. +3. Link in the page header next to "Member Home" — far from the usage + context it explains. Rejected. + +## How it gets made (decided) + +- One new block in `#view-mine` after the `.meta` line: a green + primary-style anchor (`Buy a credit pack`) plus a muted hint span on + the same row (with the docs link at the end of the hint), wrapping on + narrow phones. +- Reuses existing palette vars and button look; ~8 lines of CSS, no JS, + no new endpoints, no API changes. + +## Left to the builder + +- Exact copy tweak of the hint line is builder's call.