Skip to content

Conversation

@yoav0gal
Copy link
Contributor

@yoav0gal yoav0gal commented Aug 8, 2025

Summary by CodeRabbit

  • Refactor
    • Updated the project form UI for runtime and template selection steps to use a paged, windowed list instead of free scrolling.
    • Simplified navigation: cursor always remains visible within a fixed-size window of items.
    • Mouse wheel and page up/down key support removed; navigation is now via arrow keys and mouse clicks within the visible window.
    • Improved visual indicators for additional items above or below the current window.
    • Minor style and formatting cleanups.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The update refactors the scrolling logic for the runtime and template selection steps in the project form UI. It replaces free scrolling with a paged window approach, introduces new fields to manage visible items, updates input handling for mouse and keyboard, revises rendering logic, and removes unused styles and scroll behaviors.

Changes

Cohort / File(s) Change Summary
Project Form UI Refactor
internal/ui/project.go
Replaces free scrolling with paged window logic for list navigation; adds windowStart/windowSize fields; rewrites cursor visibility and input handling; updates rendering to show only visible items and scroll indicators; removes unused styles and scroll features; applies minor formatting fixes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ProjectFormModel
    participant Viewport

    User->>ProjectFormModel: Keyboard/Mouse Input (Up/Down/Click/Enter)
    ProjectFormModel->>ProjectFormModel: Update cursor position
    ProjectFormModel->>ProjectFormModel: Call ensureCursorVisible()
    ProjectFormModel->>Viewport: Set YOffset to 0
    ProjectFormModel->>ProjectFormModel: Slice visible items (windowStart:windowStart+windowSize)
    ProjectFormModel->>User: Render visible items with scroll indicators
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Poem

A windowed hop, no scroll in sight,
The bunny bounds from left to right.
With paged displays and cursor true,
The list stays neat in every view.
Up and down, the carrots show—
Only what's needed, row by row!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 887f076 and b56f989.

📒 Files selected for processing (1)
  • internal/ui/project.go (19 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/unrisponsive-ui

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yoav0gal yoav0gal requested a review from jhaynie August 8, 2025 16:25
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
internal/ui/project.go (3)

929-938: Viewport width ignores actual terminal width

contentWidth := width - 2 still uses the global constant width (76) even after the window has been resized and m.width was updated a few lines earlier.
On narrow terminals the viewport can overflow, breaking layout.

Calculate the viewport width from m.width (clamped to a minimum) so the UI always fits:

- contentWidth := width - 2
+ // leave at least 2 columns for borders
+ contentWidth := m.width - 2

998-1008: ensureCursorVisible can leave windowStart past the end

When the number of items shrinks (e.g. after filtering) windowStart
may stay > totalItems-windowSize, leading to an empty viewport slice.

Clamp windowStart to the last valid starting index:

 windowEnd := m.windowStart + m.windowSize - 1
 if m.cursor > windowEnd {
     m.windowStart = m.cursor - (m.windowSize - 1)
 }
+
+maxStart := totalItems - m.windowSize
+if maxStart < 0 {
+    maxStart = 0
+}
+if m.windowStart > maxStart {
+    m.windowStart = maxStart
+}

893-902: Redundant viewport update after zeroing Y-offset

After forcibly setting m.viewport.SetYOffset(0) the subsequent
m.viewport.Update(msg) still processes the same message, although
scrolling is now disabled.
Skipping the update when YOffset is constant would avoid a needless
layout pass. (Minor performance nit.)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d538ad7 and 25530a8.

📒 Files selected for processing (1)
  • internal/ui/project.go (24 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Test CLI Upgrade Path (windows-latest)
  • GitHub Check: Build and Test (macos-latest)
  • GitHub Check: Build and Test (blacksmith-4vcpu-ubuntu-2204-arm)
  • GitHub Check: Analyze (go)

Comment on lines 429 to 438
case tea.MouseMsg:
if !m.ready {
return m, nil
}
if msg.String() == "MouseLeft" {
m.mouseY = msg.Y
// Approximate top offset of list area; keep prior 6-line offset heuristic
localIndex := (msg.Y - 6) / m.itemHeight
clickedIndex := m.windowStart + localIndex

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Magic 6 offset risks mis-mapping mouse clicks

localIndex := (msg.Y - 6) / m.itemHeight hard-codes a vertical offset of 6 rows.
Any future tweak to the header height (or different terminal sizes) will desynchronise the click mapping and select the wrong item.

Derive the offset from the actual layout (e.g. sum of titleBarHeight, headerHeight, top margin) instead of keeping a literal.

🤖 Prompt for AI Agents
In internal/ui/project.go around lines 429 to 438, replace the hard-coded
vertical offset value 6 used in calculating localIndex with a dynamic value
derived from the actual layout measurements such as the sum of titleBarHeight,
headerHeight, and any top margin. This ensures the mouse click mapping stays
accurate even if the header or layout changes. Identify or add variables
representing these layout heights and use their sum instead of the literal 6 in
the calculation.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
internal/ui/project.go (1)

434-437: Hard-coded “6” offset is still here (dup of prior feedback)

Mouse-click mapping still subtracts a literal 6 ((msg.Y - 6)/m.itemHeight).
This was flagged before; any header/layout tweak will break hit-testing.
Please derive the offset from the same constants you use in initViewport() (e.g. titleBarHeight + headerHeight + verticalMargins) instead of a magic number.

🧹 Nitpick comments (1)
internal/ui/project.go (1)

915-921: All layout heights are hard-coded – fragile on future UI changes

titleBarHeight, headerHeight, footerHeight, and verticalMargins are fixed literals.
If any of those sections change (more/less lines, different padding) the viewport math and click-mapping will desynchronise again. Consider:

  • Storing these values in one place (constants or methods) shared by both initViewport and mouse-click calculations.
  • Or computing them from rendered strings’ line counts to stay self-consistent.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25530a8 and 887f076.

📒 Files selected for processing (1)
  • internal/ui/project.go (19 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (go)

@jhaynie jhaynie merged commit 05c02c2 into main Aug 9, 2025
13 of 14 checks passed
@jhaynie jhaynie deleted the fix/unrisponsive-ui branch August 9, 2025 03:04
@devin-ai-integration devin-ai-integration bot mentioned this pull request Aug 12, 2025
5 tasks
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.

3 participants