Compare commits

..
Author SHA1 Message Date
Casey Gollan 40792d6387 dashboard: always-visible 'Buy a credit pack' link out to Open Collective
Members expected to add usage from the dashboard and couldn't find it —
the buy path (OpenCollective contribute page) was invisible. Payments
still happen on OC; this just surfaces the door:

- green 'Buy a credit pack' button in the My usage card, always visible
- hint shows the member's real credit status ('Credits never expire
  ($X purchased all-time).' — moved out of the meta line, which keeps
  'Shared across chat and API · Allowance renews <date>.')
- 'More about allowance & credits' links to the docs section
  (getting-started.md#need-more-than-the-allowance)

Verified desktop + 390px mobile rendering.
2026-11-01 18:23:36 -05:00
3 changed files with 86 additions and 3 deletions

No files matched your search

+24 -3
View File
@@ -357,6 +357,18 @@ PAGE_HTML = """<!DOCTYPE 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 = """<!DOCTYPE html>
</div>
<div class="bar"><div class="fill" id="fill" style="width:0%"></div></div>
<div class="meta" id="meta">Shared across chat and API.</div>
<div class="buy-row">
<a class="buy-btn" href="https://opencollective.com/inference-cooperative/contribute" target="_blank" rel="noopener">Buy a credit pack</a>
<span class="buy-hint"><span id="buy-credits">Credit packs never expire · used after your monthly allowance.</span>
<a class="buy-docs" href="https://git.inference.coop/co-op/docs/src/branch/main/getting-started.md#need-more-than-the-allowance" target="_blank">More about allowance &amp; credits →</a>
</span>
</div>
<div class="models" id="models"></div>
</div>
@@ -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);
Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

@@ -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 <date>." 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.