Skip to content

fix(desktop): collapse github-import cards with Disclosure to fix blank space#248

Open
Fldicoahkiin wants to merge 1 commit into
mainfrom
fix/github-import-blank-space
Open

fix(desktop): collapse github-import cards with Disclosure to fix blank space#248
Fldicoahkiin wants to merge 1 commit into
mainfrom
fix/github-import-blank-space

Conversation

@Fldicoahkiin

@Fldicoahkiin Fldicoahkiin commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

问题

ImportGithubSkillPanel 扫描出长技能列表后,列表底部出现大片空白。

根因

三张折叠卡片用 grid grid-rows-[1fr]/[0fr] 动画。长列表在 h-full overflow-y-auto 滚动容器内,1fr row 撑得高于内容,内容下方留白。本地导入 / 新建面板没有这个折叠,因此没有此问题。

修复

改用 HeroUI Disclosure(受控):

  • card1:isExpanded + onExpandedChange(重新展开时 reset 下游状态)
  • card2 / card3:isExpanded + onExpandedChange + isDisabled(替代原先的 reached 门控)
  • ChevronDownIconDisclosure.Indicator
  • card2 的全选 / 取消按钮移入 Disclosure.ContentDisclosure.Trigger 本身是 button,不能嵌 button)

Disclosure 按内容高度渲染,消除留白,并保留展开 / 折叠动画。

验证

  • bun run typecheck:0 error
  • ⚠️ 未在真 app(WKWebView)跑通验证:开发环境起不了 app,且 Chromium 复现不了 WebKit 的 grid 行为,需在真 app 确认「空白消失 + 折叠动画正常」

Fixes #247

Summary by CodeRabbit

  • Refactor
    • Restructured the GitHub skill import dialog with collapsible card sections for repository credentials, skill selection, and installation progress. Cards now unlock progressively as you advance through workflow phases.

…nk space

The import-from-github panel collapsed each card body with a `grid
grid-rows-[1fr]/[0fr]` animation. With a long scanned skill list inside the
scrolling panel, the `1fr` row expanded past its content and left a large blank
area below the list.

Replace the hand-rolled grid collapse with HeroUI's `Disclosure` (controlled via
isExpanded / onExpandedChange, plus isDisabled for not-yet-reached cards), which
sizes to its content and keeps the expand/collapse animation. The card-2
select-all / deselect-all buttons move into the disclosure content, since a
Disclosure.Trigger is itself a button and cannot nest buttons.

Fixes #247
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1570930f-2dab-42fe-8609-09e1bbcb78d9

📥 Commits

Reviewing files that changed from the base of the PR and between d5668ed and 7639736.

📒 Files selected for processing (1)
  • crates/desktop/src/components/import-github-skill-panel.tsx

📝 Walkthrough

Walkthrough

ImportGithubSkillPanel replaces manual grid grid-rows-[1fr]/[0fr] accordion toggles with HeroUI Disclosure components for all three cards (repository/credentials, skill selection, install progress). A new handleCard1ExpandedChange handler manages Card 1 expansion state and downstream resets. Phase-based isDisabled gating prevents premature Card 2/3 expansion.

Changes

Disclosure-based card accordion refactor

Layer / File(s) Summary
Import changes: remove ChevronDownIcon, add Disclosure
crates/desktop/src/components/import-github-skill-panel.tsx
ChevronDownIcon is removed from the heroicons import and Disclosure is added to the @heroui/react imports.
Card 1 expansion handler and Disclosure rendering
crates/desktop/src/components/import-github-skill-panel.tsx
handleCard1ExpandedChange replaces the old toggle handler, conditionally resetting downstream scan/selection/install state on expand and updating card1Open. Card 1's header and body are rebuilt with Disclosure, Disclosure.Trigger, Disclosure.Indicator, and Disclosure.Content primitives.
Card 2 Disclosure rendering and back-button fix
crates/desktop/src/components/import-github-skill-panel.tsx
Card 2's header and body are rebuilt using Disclosure primitives with phase/eligibility-driven isDisabled gating. The Card 2 back button now calls handleCard1ExpandedChange(true) instead of the prior toggle function.
Card 3 Disclosure rendering and closing structure
crates/desktop/src/components/import-github-skill-panel.tsx
Card 3's header and body are rebuilt with Disclosure primitives and phase-based isDisabled logic. The closing JSX structure is updated to account for the Disclosure.Content wrapper.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Three cards once bloated with empty white space,
A Disclosure arrived to put height in its place.
No more chevron hand-coded, no grid-row to fight,
The rabbit clicked "expand" and the layout looked right.
1fr begone — let the content decide!

🚥 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%. 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 The title accurately describes the main change: replacing grid-based collapse with HeroUI's Disclosure component to fix the blank space issue in the ImportGithubSkillPanel.
Linked Issues check ✅ Passed The PR directly addresses issue #247 by replacing the grid-based collapse mechanism with HeroUI's Disclosure component, eliminating the blank space below skill lists as specified.
Out of Scope Changes check ✅ Passed All changes are scoped to ImportGithubSkillPanel component refactoring to use Disclosure component, with no unrelated modifications outside the stated objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/github-import-blank-space

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 and usage tips.

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.

导入远端 Skill 面板:技能列表底部出现大片空白

1 participant