Skip to content

UX:收起取消 Star 操作并简化仓库界面提示 - #443

Merged
AmintaCCCP merged 2 commits into
AmintaCCCP:mainfrom
Khk-NL:codex/issue-440-card-actions
Oct 10, 2026
Merged

AmintaCCCP merged 2 commits into
AmintaCCCP:mainfrom
Khk-NL:codex/issue-440-card-actions

Conversation

@Khk-NL

@Khk-NL Khk-NL commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

对应 #440。按讨论仅做三处小调整:取消 Star 始终放在操作菜单底部,与普通操作分隔,保留原有确认流程;“仓库健康事实”更名为“仓库概况”,仍留在 Release 侧栏供 Web/Docker 用户使用;移除问答历史入口的数字徽标,改在历史侧栏标题显示当前加载的会话数。

没有调整其他按钮顺序,也没有新增插件分类或常驻入口。

验证:相关 45 项测试、TypeScript 类型检查、i18n 和前端边界检查通过。

Summary by CodeRabbit

  • 功能调整
    • 问答历史标题在加载成功后显示会话数量;加载中或加载失败时不显示数量。
    • 仓库卡片的取消收藏操作统一移至“更多仓库操作”菜单;列表视图和网格视图均保留该菜单入口。
    • 搜索栏中的问答历史入口不再显示会话数量徽标。
    • 网格视图中,点击卡片空白区域会关闭操作菜单,不会打开 README。
  • 文案更新
    • 多语言界面中的“仓库健康事实”相关名称调整为“仓库概况”。

@ghfind-review ghfind-review Bot added the review: medium ghfind author score; see https://ghfind.com label Oct 9, 2026
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f1559be3-56fd-4360-8471-28b421d92521

📥 Commits

Reviewing files that changed from the base of the PR and between 59dbd9d and 3dadc78.


📒 Files selected for processing (2)
  • src/components/RepositoryCard.test.tsx
  • src/components/RepositoryCard.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.



📝 Walkthrough

Walkthrough

调整仓库卡片溢出菜单和网格菜单行为。问答历史数量改为在历史抽屉标题中显示。多种语言的仓库健康相关标签更新为“仓库概况”。

Changes

仓库卡片操作

Layer / File(s) Summary
溢出菜单与取消 Star 操作
src/components/RepositoryCard.tsx, src/components/RepositoryCard.test.tsx
统一溢出操作槽位计算。更多操作菜单始终显示,取消 Star 始终位于菜单末尾。测试覆盖菜单内容、分隔线和更多操作按钮。
网格菜单控制与编辑提示
src/components/RepositoryCard.tsx, src/components/RepositoryCard.test.tsx
网格操作行增加菜单控制和指针外点处理。编辑按钮标题反映仓库是否自定义。测试覆盖点击卡片空白区域时关闭菜单,以及自定义描述的编辑提示。

问答历史会话数量

Layer / File(s) Summary
历史数量显示与验证
src/components/SearchBar.tsx, src/components/GlobalChatHistorySheet.tsx, src/components/GlobalChatHistorySheet.test.tsx
搜索栏不再读取或显示会话数量,但保留打开历史抽屉的入口。抽屉在加载完成且无错误时显示会话数量,测试新增标题断言。

仓库概况文案

Layer / File(s) Summary
仓库概况标签与测试
src/components/RepositoryHealthPanel.test.tsx, src/locales/*/{app,repositories}.json
面板测试改用“仓库概况”按钮名称。多个语言的应用和仓库文案更新了对应标签。

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: amintacccp


Merge Risk: ⚪ Minimal · up to 3dadc

No demonstrated issue blocks merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 标题准确概括了将“取消 Star”操作收起到菜单中,以及简化仓库界面提示这两项主要变更。它未提及问答历史数量显示调整,但标题不需要覆盖所有细节。
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.


  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@Khk-NL Khk-NL changed the title 收起取消 Star 操作并简化仓库界面提示 UX:收起取消 Star 操作并简化仓库界面提示 Oct 9, 2026
@AmintaCCCP

Copy link
Copy Markdown
Owner

PR #443 审计报告与改进建议

感谢对仓库操作和问答历史 UI 的优化!经代码审计及对比 CodeRabbit 检查结果,发现以下几点需要完善的问题,供作者参考修复:


1. CodeRabbit 预合并检查告警 (Docstring Coverage 0.00% < 80.00%)

  • 问题:PR 修改了 src/components/RepositoryCard.tsx 中顶层函数 countVisibleOverflowActions 的签名与逻辑,因缺少 JSDoc 注释导致 CodeRabbit 的 Docstring 检查未达标。
  • 建议:为 countVisibleOverflowActions 补充完整的 JSDoc 注释,例如:
/**
 * Calculates the number of primary quick actions visible outside the overflow menu.
 *
 * Reserves one action slot for the persistent "More actions" menu button when
 * width is constrained.
 *
 * @param width - Available width in pixels for the action row.
 * @param primaryActionCount - Total count of primary actions available for display.
 * @returns Number of actions to render inline before the overflow menu trigger.
 */

2. 网格(Grid)模式下点击卡片空白收起操作菜单会误触发打开 README 模态框

  • 问题:
    • 在 List 模式中,OverflowActionRow 传递了 isActionsMenuOpen、onActionsMenuOpenChange 与 onMenuPointerDownOutside,当菜单展开时,用户点击卡片空白区域会设置 menuDismissedByPointerDownRef,在 handleCardClick 中拦截点击并仅关闭菜单。
    • 本 PR 在 Grid 模式下常驻了更多操作菜单,但 Grid 模式渲染 OverflowActionRow 时未传入上述属性,同时卡片内有 viewMode !== 'list' 强制重置 isActionsMenuOpen 的 useEffect。
    • 导致在网格视图下,用户展开操作菜单后,点击卡片空白处收起菜单时,会穿透触发卡片点击,意外弹出 README 模态框。
  • 建议:
    1. 在 Grid 模式的 OverflowActionRow 中补全属性:
    isActionsMenuOpen={isActionsMenuOpen}
    onActionsMenuOpenChange={setIsActionsMenuOpen}
    menuAlign="start"
    onMenuPointerDownOutside={(target) => {
      if (cardRef.current?.contains(target)) {
        menuDismissedByPointerDownRef.current = true;
      }
    }}
    1. 将关闭菜单的 useEffect 调整为在模式切换时复位:
    useEffect(() => {
      setIsActionsMenuOpen(false);
    }, [viewMode, selectionMode]);
    1. 在 src/components/RepositoryCard.test.tsx 中补充网格模式点击卡片空白收起菜单不打开 README 的单元测试用例。

3. 操作菜单顶部出现多余的孤立分割线

  • 问题:DropdownMenuContent 内在插件项和「取消 Star」上方无条件渲染了 <DropdownMenuSeparator />。当卡片宽度足够展示所有平铺按钮且未安装插件时,菜单内只有唯一的「取消 Star」,导致菜单第一项就是一条空分割线。
  • 建议:增加前置项存在性检查,只有上方确实存在其他选项时才渲染分割线:
const hasPrimaryOverflowItems =
  !showAnalyze ||
  Boolean(onAskRepository && !showAsk) ||
  !showSubscribe ||
  !showEdit ||
  !showReleases ||
  !showDocs ||
  !showGithub;
const hasUpperItems = hasPrimaryOverflowItems || showFindSimilarInMenu;
const hasItemsAboveUnstar = hasUpperItems || pluginActions.length > 0;

// 下拉菜单内条件渲染:
{pluginActions.length > 0 ? (
  <>
    {hasUpperItems ? <DropdownMenuSeparator /> : null}
    <DropdownMenuLabel>{t('repositoryCard.plugin-actions')}</DropdownMenuLabel>
    <PluginRepositoryActionItems actions={pluginActions} repository={repository} language={language} />
  </>
) : null}
{hasItemsAboveUnstar ? <DropdownMenuSeparator /> : null}
<DropdownMenuItem className="text-destructive focus:text-destructive" disabled={unstarring} onSelect={() => void onUnstar()}>
  <StarOff className={`mr-2 h-3.5 w-3.5 ${unstarring ? 'animate-pulse' : ''}`} />
  {t('repositoryCard.unstar')}
</DropdownMenuItem>

4. 清理 ResizeObserver useEffect 中的遗留过时依赖

  • 问题:移除 hasPersistentMenu 后,updateVisibleActionCount 的 useEffect 依赖数组中依然残留了 pluginActions.actions.length 与 vectorSearchAvailable,但它们在 effect 内已不再使用。
  • 建议:将其从依赖数组中移除,避免不必要的重新绑定。

5. 对齐 Grid 模式编辑按钮提示

  • 问题:List 模式根据 displayContent.isCustomized 区分了已自定义状态提示,Grid 模式写死了默认提示。
  • 建议:Grid 模式统一对齐为:
editButtonTitle={displayContent.isCustomized ? t('repositoryCard.customized-edit-repository-info') : t('repositoryCard.edit-repository-info')}

Khk-NL commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

这五项已在 3dadc78 处理:补了计算函数的 JSDoc;网格菜单沿用列表模式的关闭与防误开 README 逻辑,并加了回归测试;分隔线只在上方有菜单项时显示;移除无用的 effect 依赖;网格编辑提示与自定义状态保持一致。相关 28 项测试、类型检查、i18n、边界检查和 ESLint 均通过。

@AmintaCCCP
AmintaCCCP merged commit 2e7821b into AmintaCCCP:main Oct 10, 2026
10 checks passed
@Khk-NL
Khk-NL deleted the codex/issue-440-card-actions branch October 12, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: medium ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants