Skip to content

feat(subscription): 优化凭据导入与账号卡片 - #457

Merged
tbphp merged 8 commits into
v2from
tbphp/subscription-credential-ui-optimization
Aug 22, 2026
Merged

feat(subscription): 优化凭据导入与账号卡片#457
tbphp merged 8 commits into
v2from
tbphp/subscription-credential-ui-optimization

Conversation

@tbphp

@tbphp tbphp commented Aug 22, 2026

Copy link
Copy Markdown
Owner

关联 Issue / Related Issue

无(订阅凭据管理前端交互优化)

变更内容 / Change Content

  • Bug 修复 / Bug fix
  • 新功能 / New feature
  • 其他改动 / Other changes
  • 统一新建分组与已有分组侧边栏的订阅账号连接入口,直接展示登录和凭据文件导入,并将粘贴 JSON 收纳为次级操作。
  • 精简重复静态说明,将订阅授权风险收敛为连接区域附近的短提示,同时保留授权、回调、导入和暂存状态反馈。
  • 将账号卡片额度窗口改为单行扁平进度背景,左侧展示现有窗口名称,右侧完整展示剩余额度与重置时间。
  • 将展开区调整为“用量窗口 → 运行概况”,运行概况按三列九项展示既有活动与诊断字段;用量窗口实现保持不变。
  • 适配 feat(subscription): 增加账号批量操作 #455 合并后的账号选择、批量同步、整卡同步骨架和多文件导入行为;不修改后端 API、DTO、持久化或共享额度组件。

自查清单 / Checklist

  • 我已运行 make check,或在说明中写明无法运行的原因和未验证范围。 / I ran make check, or documented why it could not run and what remains unverified.
  • 本 PR 范围聚焦,未包含无关改动。 / This PR is focused and contains no unrelated changes.
  • 我已更新必要的公开文档或发布说明。 / I updated any required public documentation or release notes.
  • 我已确认提交、日志和测试数据不包含敏感信息。 / I confirmed that commits, logs, and fixtures contain no sensitive data.
  • 如适用,我已说明兼容性或数据迁移影响。 / Where applicable, I documented compatibility or data-migration impact.

无需更新公开文档或执行数据迁移;本次仅调整管理前端交互与三语文案。

Summary by CodeRabbit

  • 新功能

    • 重构订阅账号配额卡片,展示配额进度、重置时间、成功/失败统计及运行概况。
    • 新增交互式授权、JSON 粘贴和凭据文件导入入口。
    • 支持按系统设置减少界面动画。
    • 优化展开面板指示器位置、键盘操作、悬停反馈与过渡效果。
  • 体验优化

    • 统一连接抽屉按钮尺寸,优化布局与加载骨架。
    • 简化订阅导入说明和风险提示,优化配额与统计文案,并同步更新中、英、日语言内容。

Copilot AI lite review requested due to automatic review settings August 22, 2026 06:46
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

更新订阅账户卡片的额度展示、详情概览、同步时间、加载骨架和响应式样式。调整订阅凭据导入入口、JSON 粘贴面板和风险提示。更新 DisclosurePanel 的指示器位置、摘要插槽、交互样式和无障碍支持。同步更新英文、日文和中文文案。连接抽屉改用国际化描述,并统一按钮尺寸。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题明确概括了订阅凭据导入和账号卡片优化,符合本次变更的主要内容。
Description check ✅ Passed 描述包含变更内容、自查清单、测试结果、文档和兼容性说明,信息基本完整且与变更范围一致。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 6 files. (1 skipped: 1 unsupported.)
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch tbphp/subscription-credential-ui-optimization

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Pro Plus

Run ID: 7f62628f-5117-4b69-ac93-5ae9f7f9897e

📥 Commits

Reviewing files that changed from the base of the PR and between 92c52ec and 049b33d.

📒 Files selected for processing (11)
  • web/src/features/groups/credentials/GroupCredentialsTab.vue
  • web/src/features/groups/credentials/SubscriptionAccountCard.vue
  • web/src/features/import/ChannelPresetPicker.vue
  • web/src/features/import/NewGroupImport.vue
  • web/src/features/import/SubscriptionCredentialStager.vue
  • web/src/i18n/locales/en-US/group.ts
  • web/src/i18n/locales/en-US/import.ts
  • web/src/i18n/locales/ja-JP/group.ts
  • web/src/i18n/locales/ja-JP/import.ts
  • web/src/i18n/locales/zh-CN/group.ts
  • web/src/i18n/locales/zh-CN/import.ts
💤 Files with no reviewable changes (1)
  • web/src/features/import/ChannelPresetPicker.vue

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread web/src/features/import/SubscriptionCredentialStager.vue

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new custom quota progressbar UI can emit out-of-range/non-finite aria-valuenow and un-clamped widths, which can break accessibility expectations and rendering in edge cases.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refines the subscription-credential import flow and subscription account card UI in the web frontend, focusing on clearer entry actions (authorize vs. file import vs. paste JSON), streamlined risk messaging, and a reworked quota/overview presentation.

Changes:

  • Refactors subscription credential staging UI to surface primary entry actions and demote JSON paste into a disclosure panel.
  • Redesigns subscription account quota display into a flatter “meter + value + reset” row layout and consolidates details into a “runtime overview”.
  • Updates i18n strings (zh-CN/ja-JP/en-US) to match the new UI copy and structure.
File summaries
File Description
web/src/i18n/locales/zh-CN/import.ts Removes old subscription risk/description copy and adds new risk/paste/import labels.
web/src/i18n/locales/zh-CN/group.ts Renames runtime/usage labels and adds quota reset prefix/suffix strings.
web/src/i18n/locales/ja-JP/import.ts Mirrors subscription import copy changes for Japanese.
web/src/i18n/locales/ja-JP/group.ts Mirrors group/runtime/quota copy changes for Japanese.
web/src/i18n/locales/en-US/import.ts Mirrors subscription import copy changes for English.
web/src/i18n/locales/en-US/group.ts Mirrors group/runtime/quota copy changes for English.
web/src/features/import/SubscriptionCredentialStager.vue Reworks subscription account connection entry actions and messaging layout.
web/src/features/import/NewGroupImport.vue Removes subscription step description and adjusts credential-step description computation.
web/src/features/import/ChannelPresetPicker.vue Removes subscription risk inline notice from channel preset picker.
web/src/features/groups/credentials/SubscriptionAccountCard.vue Replaces QuotaProgressBar with custom meter UI and reorganizes details into runtime overview.
web/src/features/groups/credentials/GroupCredentialsTab.vue Minor dialog button sizing and description binding cleanup.
Review details

Suppressed comments (1)

web/src/features/groups/credentials/SubscriptionAccountCard.vue:708

  • The custom progressbar meter binds aria-valuenow directly to remainingPercent(window) without clamping/finite checks. role="progressbar" expects aria-valuenow within the declared min/max (0–100); out-of-range or NaN values can break assistive-tech expectations.
          <span
            class="subscription-account__quota-meter"
            :role="remainingPercent(window) === undefined ? 'img' : 'progressbar'"
            :aria-label="
              remainingPercent(window) === undefined
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread web/src/features/groups/credentials/SubscriptionAccountCard.vue
tbphp added 3 commits August 22, 2026 15:13
将额度条从「整行 34px 铺色」改为「淡色背景 + 3px 语义左竖条 + 3px 行底进度线」,
左竖条改用 inset 阴影避免与进度线的接缝断口。强调色采用在 sRGB 色域内的高饱和值,
同一值同时适配明暗主题。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd010a42c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +653 to +655
<span
v-if="supportsQuotaObservation && observation?.observed_at_ms != null"
class="subscription-account__sync-age"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the sync age out of the crowded action row

When a card has a plan badge, quota observation, and a longer status or relative-time translation (for example, “Needs sign-in” and “3 minutes ago”), moving the non-shrinking sync age beside both action buttons makes the first header row wider than the card's 420px minimum column. The row does not wrap, .subscription-account__actions and its children cannot shrink, and the card hides overflow, so the rightmost menu can be clipped or unreachable. Keep the age in the second row or add a narrow-card layout that hides or wraps it while preserving the actions.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已采纳并在 5c69015 修复:卡片宽度不超过 480px 时,操作组会整行换行,保留同步时间、同步和更多操作;宽卡布局不变。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c690150cd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/src/features/import/SubscriptionCredentialStager.vue

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/src/features/groups/credentials/SubscriptionAccountCard.vue (1)

524-610: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

避免刷新骨架被卡片高度裁切。

当实际只有一个额度窗口时,refreshSkeletonRows 仍会生成至少两行占位内容。.subscription-account__refresh-skeleton 使用绝对定位,而 maindetail 仅使用 visibility: hidden 保留原高度。新增的头部、底部内边距和详情占位可能超过父卡片高度,随后被 .subscription-account { overflow: hidden } 裁切。

让刷新骨架参与布局,或为刷新状态设置足够的卡片高度。同时不要为单窗口账户强制生成第二行占位内容。

建议修复
-const refreshSkeletonRows = computed(() => Math.max(2, Math.min(4, quotaWindows.value.length || 2)))
+const refreshSkeletonRows = computed(() => Math.min(4, quotaWindows.value.length))
 .subscription-account--refreshing > .subscription-account__main,
 .subscription-account--refreshing > .subscription-account__detail {
-  visibility: hidden;
+  display: none;
 }

 .subscription-account__refresh-skeleton {
-  position: absolute;
-  inset: 0;
+  position: relative;
 }

Also applies to: 1192-1205


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Pro Plus

Run ID: 0f77e0c9-2556-4322-ba8f-c01778d255f1

📥 Commits

Reviewing files that changed from the base of the PR and between bd010a4 and 5c69015.

📒 Files selected for processing (1)
  • web/src/features/groups/credentials/SubscriptionAccountCard.vue

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/src/features/groups/credentials/SubscriptionAccountCard.vue (1)

515-518: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

将进度百分比限制在有效范围内。

quotaFillStyle 会将 remainingPercent 直接写入 CSS 宽度。该值也用于 aria-valuenowremainingPercentutilization 分支没有限制范围。

如果上游返回小于 0 或大于 1utilization,卡片会生成负宽度或大于 100% 的宽度,并输出无效的 ARIA 进度值。请在 remainingPercent 中统一限制结果。

建议修改
 function remainingPercent(window: CredentialQuotaWindowDto): number | undefined {
-  if (window.utilization !== undefined) return Math.round((1 - window.utilization) * 100)
+  if (window.utilization !== undefined && Number.isFinite(window.utilization)) {
+    return Math.max(0, Math.min(100, Math.round((1 - window.utilization) * 100)))
+  }
🟡 Other comments (1)
web/src/features/groups/credentials/SubscriptionAccountCard.vue-110-132 (1)

110-132: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

使用 label_key 对专属窗口分组。

Line 110-132 忽略了 window.label_key。当窗口没有 model_ids,且 label 不带 · <period> 后缀时,不同专属窗口会返回相同的 scope: 分组键。排序会将这些窗口错误地合并。

在解析显示标签前,使用 label_key 生成稳定的 subject: 分组键。

建议修改
   if (modelIDs.length > 0) return `models:${modelIDs.join('\u0000')}`
+  if (window.label_key) return `subject:${window.label_key}`
 
   const period = quotaWindowPeriodLabel(window.window_seconds)

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Pro Plus

Run ID: a0b607e5-83f1-4206-b779-60e7bb8b3790

📥 Commits

Reviewing files that changed from the base of the PR and between 5c69015 and 292b26d.

📒 Files selected for processing (1)
  • web/src/features/groups/credentials/SubscriptionAccountCard.vue

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@tbphp

tbphp commented Aug 22, 2026

Copy link
Copy Markdown
Owner Author

CodeRabbit outside-diff feedback follow-up:

  • 已采纳刷新骨架意见:495af56c 使占位行数与实际窗口数一致,保留覆盖层以避免刷新时卡片跳高。
  • 不采纳进度 clamp:后端规范化保证有限的 0–1 utilization,属于已处理意见的重复。
  • 不采纳 label_key 分组回退:当前快照均可从主体和时长得出正确分组;无条件使用 label_key 会破坏账号全局窗口的时长排序。

@tbphp tbphp self-assigned this Aug 22, 2026
@tbphp tbphp added the enhancement New feature or request label Aug 22, 2026
@tbphp tbphp added this to the v2.0.0 milestone Aug 22, 2026
@tbphp
tbphp merged commit dd7e720 into v2 Aug 22, 2026
7 checks passed
@tbphp
tbphp deleted the tbphp/subscription-credential-ui-optimization branch August 22, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants