Skip to content

feat(b2c): dashboard hero + pricing ratio cleanup + first-call moment - #6

Merged
hades217 merged 1 commit into
mainfrom
feat/dashboard-pricing-celebration
May 16, 2026
Merged

feat(b2c): dashboard hero + pricing ratio cleanup + first-call moment#6
hades217 merged 1 commit into
mainfrom
feat/dashboard-pricing-celebration

Conversation

@hades217

Copy link
Copy Markdown

Summary

Sprint 3 收尾 —— B2C funnel 最后几个 polish。完成 PR #1-#5 之后还剩的最后几个对终端用户体验的小破坏。

6.B Pricing 页隐藏倍率(非 admin)

  • /pricing 页 per-group 价格表里的 `{ratio}x` 列对非 admin 用户隐藏 —— 同 Create Key、Usage Logs 一样的 useIsAdmin gate 模式
  • pricing-sidebar.tsx 过滤芯片不再在 group 名后面追加 "x1.2" suffix
  • 最终 per-token 价格仍然显示,只是不再暴露倍率乘数(运营概念)

6.A Dashboard hero

  • summary-cards.tsx 顶部 hero:"Usage at a glance" → "Your AI usage",描述改大白话
  • "Credit remaining" 卡片副标题从 "Displayed in CNY" 改成 "≈ 200 chats remaining" 友好估算(零余额时显示 "Top up to start using AI models.")
  • 估算公式 inline(quota / 2500 ≈ 中等模型一次对话),避免依赖 PR feat(onboarding): trial credit + client tutorials + wallet B2C hints #4 的 lib/usage-estimate.ts

6.D 首次调用庆祝

  • 纯前端,不需要后端 `first_call_at` 字段
  • SummaryCards useEffect 观察 user.request_count,从 0 → 1+ 时触发 sonner toast "🎉 Your first API call worked!"
  • localStorage flag `dr_first_call_celebrated` 保证只触发一次/浏览器
  • 不管用户在哪里发起的首次调用(Cherry Studio、Cursor、curl、Playground)都能识别

6.C 充值历史空状态文案

  • billing-history-dialog.tsx 区分了"无搜索结果"和"还没充值过" 两种 empty state
  • 比原来通用的 "No billing records found" 友好

Test plan

  • `bun run typecheck` 通过
  • /pricing 非 admin 视角:每个 group 价格表头没有 "Ratio" 列,行内没有 "1.2x" 字样
  • /pricing admin 视角:仍能看到完整倍率
  • /dashboard/overview hero 卡:"Your AI usage" + "≈ N chats remaining"
  • 零余额用户:副标题改为"Top up to start using AI models."
  • 触发首次调用后回 dashboard:toast 弹一次"🎉",刷新页面不再弹
  • /wallet → 充值记录弹窗:从未充值过的用户看到 "You haven't recharged yet"

文件

修改 (8 file):

  • `web/default/src/features/pricing/components/model-details.tsx` — 3 处 ratio gate
  • `web/default/src/features/pricing/components/pricing-sidebar.tsx` — group suffix gate
  • `web/default/src/features/dashboard/components/overview/summary-cards.tsx` — hero + celebration toast
  • `web/default/src/features/wallet/components/dialogs/billing-history-dialog.tsx` — empty state
  • `web/default/src/i18n/locales/{en,zh}.json` — 8 keys

🤖 Generated with Claude Code

Sprint 3 — final B2C polish on the three remaining surfaces.

6.B Pricing page ratio cleanup:
- Hide `{ratio}x` multipliers from the per-group pricing table and
  pricing breakdown for non-admin users (features/pricing/components/
  model-details.tsx). Same useIsAdmin gate pattern as Create Key form
  + Usage Logs. Final per-token prices stay visible — only the
  multiplier (operator concept) is hidden.
- pricing-sidebar.tsx filter chips no longer append "x1.2" suffixes
  to group names for non-admin viewers.

6.A Dashboard hero:
- summary-cards.tsx hero block: title "Usage at a glance" → "Your AI
  usage"; description rewritten in plain language. Credit-remaining
  card replaces "Displayed in CNY" technical sub-label with friendly
  "≈ 200 chats remaining" estimate (or "Top up to start using AI
  models." when balance is zero). Math is inlined since this PR is
  branched independently of PR #4's lib/usage-estimate.ts — they'll
  produce identical content when both merge.

6.D First-call celebration:
- Pure frontend, no backend `first_call_at` field needed. SummaryCards
  useEffect watches user.request_count; when it flips from 0 to 1+ on
  any dashboard mount, fires a single sonner toast "🎉 Your first API
  call worked!" + sets localStorage flag `dr_first_call_celebrated`
  so it never repeats per browser.
- Acknowledges the magic moment regardless of where the user made
  the call (Cherry Studio, Cursor, curl, Playground).

6.C Recharge history polish:
- billing-history-dialog.tsx empty state copy differentiates "no
  search results" (keyword present) from "you haven't recharged yet"
  (first-time user). Friendlier than the generic "No billing records
  found".

i18n: 8 new en + zh keys.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@hades217
hades217 force-pushed the feat/dashboard-pricing-celebration branch from b566a33 to c4bef48 Compare May 16, 2026 12:29
@hades217
hades217 merged commit 4277236 into main May 16, 2026
hades217 added a commit that referenced this pull request May 18, 2026
…rter

Single-file Python script + YAML config + .env template that creates/updates
all upstream channels (OpenAI, Anthropic, Gemini, DeepSeek, Moonshot, Qwen,
Zhipu, Doubao, ERNIE, Hunyuan, Spark, MiniMax, Yi, xAI, Mistral, Cohere,
Perplexity by default; 360, OpenRouter, SiliconFlow, Midjourney, Suno, Sora
disabled) via admin API.

- channels.yaml: 23 channels, 17 enabled, 147+ models curated to those with
  pricing in setting/ratio_setting/model_ratio.go
- seed.py: stdlib urllib + pyyaml only; idempotent by channel name (upsert);
  --dry-run, --only KEYWORD, --include-disabled flags; gracefully skips
  channels whose upstream API key env var is unset
- .env.example: all upstream key vars listed
- README.md: quick-start, troubleshooting, design rationale

Used by docs/onboarding-v2-prd.md sect 11 decision #6 (full model coverage
via automated seed rather than hand-curated 14).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant