Skip to content
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

ucList design changes #3435

Merged
merged 3 commits into from
Jan 10, 2024
Merged

ucList design changes #3435

merged 3 commits into from
Jan 10, 2024

Conversation

MeniKadosh1
Copy link
Contributor

@MeniKadosh1 MeniKadosh1 commented Jan 9, 2024

  • fitting usLict item and description to list width
  • allowing to see ucList Item extra info also if width is large
  • allowing more item in list by shorten the margin between list items
  • shorten summary execution page width and heigth

Thank you for your contribution.
Before submitting this PR, please make sure:

  • PR description and commit message should describe the changes done in this PR
  • Verify the PR is pointing to correct branch i.e. Release or Beta branch if the code fix is for specific release , else point it to master
  • Latest Code from master or specific release branch is merged to your branch
  • No unwanted\commented\junk code is included
  • No new warning upon build solution
  • Code Summary\Comments are added to my code which explains what my code is doing
  • Existing unit test cases are passed
  • New Unit tests are added for your development
  • Sanity Tests are successfully executed for New and Existing Functionality
  • Verify that changes are compatible with all relevant browsers and platforms.
  • After creating pull request there should not be any conflicts
  • Resolve all Codacy comments
  • Builds and checks are passed before PR is sent for review
  • Resolve code review comments
  • Update the Help Library document to match any feature changes

Summary by CodeRabbit

  • Style

    • Improved layout and visual presentation of various user interface components.
  • New Features

    • Enabled horizontal scrolling for list views where necessary.
  • Bug Fixes

    • Adjusted UI elements for better alignment and spacing consistency.

- fitting usLict item and description to list width
- allowing to see ucList Item extra info also if width is large
- allowing more item in list by shorten the margin between list items
- shorten summary execution page width and heigth
Copy link
Contributor

coderabbitai bot commented Jan 9, 2024

Walkthrough

The recent updates involve a user interface overhaul across various XAML files and associated C# code, focusing on reducing dimensions, refining layout margins, and enhancing scrollability. The modifications suggest a shift towards a more compact and user-friendly design, possibly to improve user experience on smaller screens or to create a cleaner, more streamlined interface.

Changes

File Path Change Summary
.../ExecutionSummaryPage.xaml Changed Height and Width from 800x1000 to 600x600.
.../NewAutomatePage.xaml Reduced grid column width from 650 to 550; modified GridSplitter margin to "0,0,0,10".
.../Skins/GingerDefaultSkinDictionary.xaml Adjusted ListViewItem margin from "0 5 0 5" to "0 4 0 4".
.../UCListView/UcListView.xaml Changed ScrollViewer HorizontalScrollBarVisibility from "Disabled" to "Auto".
.../UCListView/UcListViewItem.xaml
.../UCListView/UcListViewItem.xaml.cs
Updated layout, styling, and behavior of list view items; added methods for alignment and size change handling.

🐇✨
In XAML land, where UIs grow,
A rabbit tweaked the code just so,
Screens shrink, margins tight,
A user's delight by day or night. 🌙
🐇✨

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cc7a6fa and 3205fe1.
Files selected for processing (6)
  • Ginger/Ginger/AutomatePageLib/ExecutionSummaryPage.xaml (1 hunks)
  • Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml (2 hunks)
  • Ginger/Ginger/Dictionaries/Skins/GingerDefaultSkinDictionary.xaml (1 hunks)
  • Ginger/Ginger/UserControlsLib/UCListView/UcListView.xaml (1 hunks)
  • Ginger/Ginger/UserControlsLib/UCListView/UcListViewItem.xaml (2 hunks)
  • Ginger/Ginger/UserControlsLib/UCListView/UcListViewItem.xaml.cs (6 hunks)
Files skipped from review due to trivial changes (1)
  • Ginger/Ginger/Dictionaries/Skins/GingerDefaultSkinDictionary.xaml
Additional comments: 8
Ginger/Ginger/AutomatePageLib/ExecutionSummaryPage.xaml (1)
  • 6-6: The dimensions of the ExecutionSummaryPage have been reduced significantly from a width of 1000 to 600 and a height from 800 to 600. This change will create a more compact layout, which should be tested across different screen sizes to ensure that the content is still legible and the layout does not become cluttered.
Ginger/Ginger/UserControlsLib/UCListView/UcListView.xaml (1)
  • 58-58: The HorizontalScrollBarVisibility property of the ScrollViewer has been changed to "Auto". This is a positive change as it will allow horizontal scrolling when the content exceeds the viewable area, improving the user experience by making it easier to view all content without resizing the window.
Ginger/Ginger/UserControlsLib/UCListView/UcListViewItem.xaml (3)
  • 96-98: The addition of the xItemNameColumn with HorizontalAlignment set to "Stretch" is a good change, as it allows the item name to use the available horizontal space, which can adapt to different screen sizes and resolutions.

  • 102-147: The xItemNameTxtBlock and xItemExtraInfoTxtBlock have been placed inside a StackPanel with horizontal orientation. This change should ensure that the item name and extra info are displayed inline. However, it's important to verify that the MaxWidth set on the xItemExtraInfoTxtBlock does not cut off important information when the list width is large.

  • 159-159: The HorizontalAlignment property of the xItemDescriptionTxtBlock has been changed to "Left". This change should make the alignment of the description consistent with the rest of the list items, which is typically expected in list views.

Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml (2)
  • 321-321: The width of the first column in the xActivitiesDataGrid has been reduced from 650 to 550. This change aligns with the PR objectives to optimize space usage. However, it's important to ensure that this reduction does not negatively impact the display of content within this column. If there are any elements that rely on the previous width, they may need to be adjusted accordingly.
Verification successful

Based on the information gathered, there are no explicit width settings or constraints within the xActivitiesDataGrid that would be directly affected by the change in column width from 650 to 550. The layout appears to be designed with responsiveness in mind, which is in line with the PR's objectives. Therefore, it seems that the reduction in column width is unlikely to negatively impact the display of content within the xActivitiesDataGrid.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the content within the first column of xActivitiesDataGrid is still displayed correctly.
# This would typically require manual testing within the application's UI.

Length of output: 0



Script:

#!/bin/bash
# Search for references to xActivitiesDataGrid in the XAML file to see if there are any hardcoded width dependencies.
rg 'xActivitiesDataGrid' Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml

# Search for references to xActivitiesDataGrid in the code-behind (.xaml.cs) file to check for width-related logic.
fd 'NewAutomatePage.xaml.cs' --exec rg 'xActivitiesDataGrid'

Length of output: 417



Script:

#!/bin/bash
# Search for any elements within xActivitiesDataGrid that have width settings or constraints.
rg 'Width' Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml | rg 'xActivitiesDataGrid'

Length of output: 86



Script:

#!/bin/bash
# Search for any width-related attributes in the entire NewAutomatePage.xaml file.
rg 'Width' Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml

Length of output: 5227

* 330-330: The `GridSplitter` named `xActivityDetailsSectionSpliter` has had its margin adjusted. The bottom margin has been increased from 0 to 10. This change is likely to increase the spacing at the bottom of the splitter, which could improve the visual separation between sections. It's a minor change but should be visually verified to ensure it meets the design expectations.
Ginger/Ginger/UserControlsLib/UCListView/UcListViewItem.xaml.cs (1)
  • 763-775: The new methods AlignGridandTextWidth and XDetailsGrid_SizeChanged have been added to manage the alignment of grid and text width and to handle size changes. These methods are private and seem to be well-implemented for the intended purpose. Ensure that the event subscription pattern used here is consistent with the rest of the application to avoid potential memory leaks or unexpected behavior.

Comment on lines 760 to 779
});
}

private void AlignGridandTextWidth()
{
if (xItemNameColumn.ActualWidth > 200)
{
xItemNameTxtBlock.MaxWidth = xItemNameColumn.ActualWidth - 100;
xItemDescriptionTxtBlock.MaxWidth = xItemNameTxtBlock.MaxWidth;
}
}

private void XDetailsGrid_SizeChanged(object sender, SizeChangedEventArgs e)
{
AlignGridandTextWidth();
}

private void SetItemDescription()
{
this.Dispatcher.Invoke(() =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [700-770]

The method AlignGridandTextWidth has been added to dynamically adjust the MaxWidth of text blocks based on the actual width of a column. This is a good approach to ensure responsive design. However, the magic number 200 and 100 used in the condition and width calculation should be replaced with named constants for better maintainability and readability.

- if (xItemNameColumn.ActualWidth > 200)
+ const int minWidthThreshold = 200; // This value should be adjusted to the appropriate threshold
+ const int widthOffset = 100; // This value should be adjusted to the appropriate offset
+ if (xItemNameColumn.ActualWidth > minWidthThreshold)
...
- xItemNameTxtBlock.MaxWidth = xItemNameColumn.ActualWidth - 100;
+ xItemNameTxtBlock.MaxWidth = xItemNameColumn.ActualWidth - widthOffset;

Comment on lines +701 to +702
xDetailsGrid.SizeChanged -= XDetailsGrid_SizeChanged;
xDetailsGrid.SizeChanged += XDetailsGrid_SizeChanged;
Copy link
Contributor

Choose a reason for hiding this comment

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

The event handler XDetailsGrid_SizeChanged is being unsubscribed and then immediately resubscribed. This is redundant and can be removed if the event handler is not being dynamically changed elsewhere in the code.

- xDetailsGrid.SizeChanged -= XDetailsGrid_SizeChanged;
- xDetailsGrid.SizeChanged += XDetailsGrid_SizeChanged;

If the intention is to ensure that the event handler is only subscribed once, consider checking if the event is already subscribed before adding it, or ensure that the event is unsubscribed when the control is disposed of to prevent memory leaks.


Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
xDetailsGrid.SizeChanged -= XDetailsGrid_SizeChanged;
xDetailsGrid.SizeChanged += XDetailsGrid_SizeChanged;

Comment on lines 697 to 708
{
try
{
AlignGridandTextWidth();
xDetailsGrid.SizeChanged -= XDetailsGrid_SizeChanged;
xDetailsGrid.SizeChanged += XDetailsGrid_SizeChanged;
xItemNameTxtBlock.Text = string.Empty;
xItemExtraInfoTxtBlock.Text = string.Empty;
xItemExtraInfoTxtBlock.Visibility = Visibility.Collapsed;
string fullname = string.Empty;
if (!string.IsNullOrEmpty(mItemNameField))
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [700-753]

The method SetItemFullName has been modified to include additional logic for setting the visibility and text of xItemExtraInfoTxtBlock. The changes seem to correctly implement the desired functionality, but there are a few points to consider:

  1. The use of direct property access through reflection (Item.GetType().GetProperty(mItemNameField).GetValue(Item)) is not type-safe and may lead to runtime errors if property names change. Consider using a safer approach, such as a method or a dictionary to map property names to delegates.
  2. The visibility of xItemExtraInfoTxtBlock is being set multiple times which could be simplified.
  3. The try-catch block is good for exception handling, but it's important to ensure that the catch block does not swallow exceptions that should be handled or logged at a higher level.

@Maheshkale447 Maheshkale447 changed the base branch from master to Releases/Beta January 10, 2024 05:51
@Maheshkale447 Maheshkale447 merged commit 9796746 into Releases/Beta Jan 10, 2024
1 check passed
@Maheshkale447 Maheshkale447 deleted the Design-Fixes-Meni branch January 10, 2024 05:52
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.

2 participants