Skip to content

Add more resize features #1559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 9, 2025
Merged

Add more resize features #1559

merged 4 commits into from
Apr 9, 2025

Conversation

myieye
Copy link
Contributor

@myieye myieye commented Mar 25, 2025

@hahn-kev this is ready for you to decide if you like it at all 😉

fruit.-.Google.Chrome.2025-03-25.17-19-26.mp4

Copy link

coderabbitai bot commented Mar 25, 2025

📝 Walkthrough

Walkthrough

The pull request adds new pane-resizing functionality across two components. The ResizableHandle component now accepts three new properties—leftPane, rightPane, and resetTo—and includes additional state management for dragging operations, along with new click handling and lifecycle initialization. In parallel, the BrowseView component is updated with immutable layout definitions and introduces state variables to bind its left and right panes, allowing the updated ResizableHandle to manage resizing more directly.

Changes

File Change Summary
frontend/.../resizable-handle.svelte Added three new props: leftPane, rightPane, and resetTo; introduced dragging and its debounced state; implemented getPaneResizerOnClick and resetPanes functions; updated lifecycle and event handling.
frontend/.../BrowseView.svelte Changed defaultLayout to an immutable constant; added state variables leftPane and rightPane; bound these to the respective panes; modified the ResizableHandle to accept new pane props for improved resizing.

Poem

I'm a hopping rabbit in the coding wood,
Skipping through panes as I knew I should.
Left and right sides now dance in tune,
Reset and resizing beneath a debug moon.
With a twitch of my nose and a joyful cheer,
These changes make my code-day clear! 🥕✨


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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

Base automatically changed from new-browse-view to develop March 28, 2025 16:24
@myieye myieye force-pushed the add-more-resize-features branch from eedd561 to 996e3d4 Compare March 31, 2025 12:20
Copy link

github-actions bot commented Mar 31, 2025

UI unit Tests

12 tests  ±0   12 ✅ ±0   0s ⏱️ ±0s
 4 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 2430350. ± Comparison against base commit 83f9cc8.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Mar 31, 2025

C# Unit Tests

112 tests  +5   112 ✅ +5   6s ⏱️ -1s
 17 suites +1     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 2430350. ± Comparison against base commit 83f9cc8.

♻️ This comment has been updated with latest results.

@myieye myieye requested a review from hahn-kev March 31, 2025 13:55
@alex-larkin
Copy link

Looks pretty neat!

@myieye myieye marked this pull request as ready for review April 9, 2025 12:51
Copy link

@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: 0

🧹 Nitpick comments (2)
frontend/viewer/src/lib/components/ui/resizable/resizable-handle.svelte (2)

50-54: Consider explaining the redundant resize comment

The code includes a commented line stating that resizing the right pane is redundant. While this may be true in the current implementation, adding a brief explanation would improve code maintainability.

  function resetPanes() {
    if (!leftPane || !rightPane || !resetTo) return;
    leftPane.resize(resetTo[0]);
-   // rightPane.resize(resetTo[1]); // redundant
+   // No need to resize the right pane as it automatically adjusts when the left pane is resized
  }

1-94: Consider adding accessibility improvements

While the resize functionality works well, consider enhancing accessibility by:

  1. Adding ARIA attributes to the resize handle
  2. Implementing keyboard navigation for resizing operations
  3. Ensuring proper focus management

This would make the resizing functionality accessible to all users, including those using screen readers or keyboard navigation.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 83f9cc8 and 2430350.

📒 Files selected for processing (2)
  • frontend/viewer/src/lib/components/ui/resizable/resizable-handle.svelte (1 hunks)
  • frontend/viewer/src/project/browse/BrowseView.svelte (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: GHA integration tests / playwright
  • GitHub Check: GHA integration tests / dotnet
  • GitHub Check: Build FW Lite and run tests
🔇 Additional comments (11)
frontend/viewer/src/project/browse/BrowseView.svelte (3)

12-12: Type assertion improves type safety

Using as const on the defaultLayout array ensures it's treated as a readonly tuple with specific literal values, which provides better type checking and prevents unintended modifications.


21-22: Clean state management for pane references

Good approach creating state variables to reference both panes. This enables the new resizing functionality while maintaining clear component relationships.


29-30: Well-implemented pane binding and handle integration

The binding and property passing between panes and handles creates a cohesive resizing system. The ResizableHandle now has direct access to both panes, allowing for sophisticated resize operations and reset functionality.

Also applies to: 53-53, 56-58

frontend/viewer/src/lib/components/ui/resizable/resizable-handle.svelte (8)

15-17: Props and types are well-defined

The new properties (leftPane, rightPane, and resetTo) are well-typed and properly integrated into the component's interface. Using Readonly<[number, number]> for resetTo ensures type safety for the reset dimensions.

Also applies to: 21-23


26-27: Good debouncing implementation for dragging state

Using a debounced version of the dragging state is a smart approach to prevent UI flicker during rapid updates, improving the user experience during resize operations.


29-42: Well-structured click handlers with proper edge case handling

The implementation cleanly handles various scenarios including undefined panes and collapsed states. The function returns undefined when appropriate, preventing potential runtime errors.


44-48: Solid initialization with proper async handling

Using onMount with tick() ensures the panes are fully mounted before attempting to access their properties. The fallback initialization for resetTo is a good defensive approach.


56-56: Comprehensive visibility logic for resizers

The derived variable for showing resizers combines multiple conditions in a clean way, ensuring the UI elements appear only when they're functional.


60-63: Well-handled dragging state updates

The component properly updates its internal state while still respecting any external event handlers provided through props.


69-69: Intuitive double-click reset functionality

Adding the reset function to the double-click event follows common UI patterns and provides users with an intuitive way to return to the default layout.


73-82: Elegant UI implementation with thoughtful transitions

The resizer UI is well-designed with:

  1. Clean hover effects that reveal the buttons
  2. Logical overflow handling to maintain visual consistency
  3. Proper z-indexing to ensure controls remain accessible
  4. Reusable button component via the snippet pattern

The implementation addresses the challenge of keeping the handle centered by maintaining symmetrical DOM structure.

Also applies to: 84-92

@myieye myieye merged commit f6b0ea5 into develop Apr 9, 2025
19 checks passed
@myieye myieye deleted the add-more-resize-features branch April 9, 2025 13:23
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