Skip to content

Conversation

Jack251970
Copy link
Member

@Jack251970 Jack251970 commented Feb 21, 2025

Remove useless columns in Xaml files

#4173361

Improve report window with dark theme & localization support

#44aa17d

Test

Original:

Screenshot 2025-02-21 211432

After:

image

This comment has been minimized.

@Jack251970 Jack251970 added the kind/ui related to UI, icons, themes, etc label Feb 21, 2025
Copy link
Contributor

coderabbitai bot commented Feb 21, 2025

📝 Walkthrough

Walkthrough

This pull request applies layout modifications across several XAML files in the Flow.Launcher project. The grid structures are simplified by removing extra ColumnDefinition elements, which reduces the grid columns from five to three, and button positions are updated accordingly. Additionally, new string resources for crash reporting have been added to the language file, and the ReportWindow code-behind has been refactored to use translated texts and handle a cancel action.

Changes

File(s) Change Summary
…/CustomQueryHotkeySetting.xaml, …/CustomShortcutSetting.xaml, …/PriorityChangeWindow.xaml, …/SelectBrowserWindow.xaml, …/SelectFileManagerWindow.xaml, …/WelcomeWindow.xaml Removed extra ColumnDefinition elements (reducing grid columns from five to three) and updated Button's Grid.Column property (mostly from 4 to 1, except WelcomeWindow from 4 to 2) for UI realignment.
…/Languages/en.xaml Added new string resources for crash reporting prompts, log upload instructions, and exception labeling.
…/ReportWindow.xaml Restructured window layout with reformatted attributes, introduced WindowChrome, and added organized UI elements (Image, TextBlock, Button with an event handler) for enhanced error display.
…/ReportWindow.xaml.cs Enhanced error reporting: updated SetException to utilize translations, converted Hyperlink to a static method, added a new cancel button event handler, and improved overall code organization.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant RW as ReportWindow
    participant API as App.API

    U->>RW: Encounter error (triggers SetException)
    RW->>API: Request translation for error text
    RW->>RW: Assemble error message using translations
    U->>RW: Click Cancel Button
    RW->>RW: Execute BtnCancel_OnClick event
    RW-->>U: Close the error report window
Loading

Possibly related PRs

Suggested labels

enhancement, Small PR

Suggested reviewers

  • onesounds

Poem

I'm a rabbit with a joyful hop,
Trimming grids 'til the clutter stops.
Buttons find their brand new home,
Where all the UI elements roam.
Translations sing in code so bright,
Hopping through changes with delight!
Happy trails in every byte!

Tip

CodeRabbit's docstrings feature is now available as part of our Pro Plan! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 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 44aa17d and 3fa8806.

📒 Files selected for processing (2)
  • Flow.Launcher/Languages/en.xaml (1 hunks)
  • Flow.Launcher/ReportWindow.xaml.cs (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher/Languages/en.xaml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: gitStream.cm
🔇 Additional comments (7)
Flow.Launcher/ReportWindow.xaml.cs (7)

45-49: Improved code formatting in switch expression.

The switch expression formatting looks clean and follows consistent C# formatting standards.


51-54: Consider reviewing translation needs based on past feedback.

The changes properly implement translations for user-facing text, supporting the PR's localization objectives. However, there was past feedback from jjw24 indicating that text below "2. copy below exception message" shouldn't be translated as they are part of the standardized error message.

Line 54 appears to translate the "copy below" text, which might contradict this guidance.


60-60: Improved error report formatting.

Adding a blank line improves the readability of the error report content.


69-69: Good practice: Making Hyperlink method static.

Making the Hyperlink method static is appropriate since it doesn't access any instance members.


71-74: Improved code readability with object initializer.

The code is more readable with the object initializer syntax for the paragraph creation.


85-85: Better UI formatting with explicit space.

Adding an explicit space between the text and hyperlink ensures proper spacing in the UI.


92-95: Added Cancel button functionality.

The new BtnCancel_OnClick method properly handles the cancel action by closing the window, supporting the UI improvements mentioned in the PR objectives.

✨ Finishing Touches
  • 📝 Generate Docstrings

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>, 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 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.

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

🧹 Nitpick comments (4)
Flow.Launcher/SelectBrowserWindow.xaml (1)

194-198: Consider adding a tooltip for better UX.

The radio buttons for tab/window preferences could benefit from tooltips explaining the difference between the options.

 <RadioButton IsChecked="{Binding OpenInTab}" 
-             Content="{DynamicResource defaultBrowser_newTab}"></RadioButton>
+             Content="{DynamicResource defaultBrowser_newTab}"
+             ToolTip="{DynamicResource defaultBrowser_newTab_tooltip}"></RadioButton>
 <RadioButton IsChecked="{Binding OpenInNewWindow, Mode=OneTime}"
-             Content="{DynamicResource defaultBrowser_newWindow}"></RadioButton>
+             Content="{DynamicResource defaultBrowser_newWindow}"
+             ToolTip="{DynamicResource defaultBrowser_newWindow_tooltip}"></RadioButton>
Flow.Launcher/SelectFileManagerWindow.xaml (1)

114-114: Consider using DynamicResource for consistency.

The Rectangle's Fill property uses StaticResource while other UI elements use DynamicResource. Consider changing it for theme consistency.

-                        Fill="{StaticResource Color03B}" />
+                        Fill="{DynamicResource SeparatorForeground}" />
Flow.Launcher/ReportWindow.xaml (1)

71-79: Consider adding theme-aware colors to RichTextBox.

The RichTextBox should also respect the dark theme.

 <RichTextBox
     x:Name="ErrorTextbox"
     Grid.Row="1"
     Margin="10"
     BorderThickness="0"
     FontSize="14"
+    Background="{DynamicResource PopuBGColor}"
+    Foreground="{DynamicResource PopupTextColor}"
     HorizontalScrollBarVisibility="Auto"
     IsDocumentEnabled="True"
     VerticalScrollBarVisibility="Auto" />
Flow.Launcher/ReportWindow.xaml.cs (1)

98-108: Consider adding more runtime information.

The RuntimeInfo method could include more useful debugging information.

 private static string RuntimeInfo()
 {
     var info =
         $"""
         Flow Launcher {App.API.GetTranslation("reportWindow_version")}: {Constant.Version}
         OS {App.API.GetTranslation("reportWindow_version")}: {ExceptionFormatter.GetWindowsFullVersionFromRegistry()}
         IntPtr {App.API.GetTranslation("reportWindow_length")}: {IntPtr.Size}
         x64: {Environment.Is64BitOperatingSystem}
+        CLR Version: {Environment.Version}
+        Process Architecture: {Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")}
         """;
     return info;
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 54a49d6 and 44aa17d.

📒 Files selected for processing (9)
  • Flow.Launcher/CustomQueryHotkeySetting.xaml (1 hunks)
  • Flow.Launcher/CustomShortcutSetting.xaml (1 hunks)
  • Flow.Launcher/Languages/en.xaml (1 hunks)
  • Flow.Launcher/PriorityChangeWindow.xaml (1 hunks)
  • Flow.Launcher/ReportWindow.xaml (1 hunks)
  • Flow.Launcher/ReportWindow.xaml.cs (3 hunks)
  • Flow.Launcher/SelectBrowserWindow.xaml (1 hunks)
  • Flow.Launcher/SelectFileManagerWindow.xaml (1 hunks)
  • Flow.Launcher/WelcomeWindow.xaml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: gitStream.cm
🔇 Additional comments (16)
Flow.Launcher/PriorityChangeWindow.xaml (1)

31-37: LGTM! Grid structure simplified.

The grid layout has been streamlined by removing unnecessary columns while maintaining proper alignment and functionality.

Flow.Launcher/WelcomeWindow.xaml (1)

35-39: LGTM! Efficient grid layout with proper alignment.

The simplified column structure maintains proper alignment between the app icon, title, and close button.

Flow.Launcher/CustomQueryHotkeySetting.xaml (1)

34-37: LGTM! Simplified grid structure with proper element alignment.

The streamlined column structure maintains proper spacing and alignment while reducing layout complexity.

Flow.Launcher/CustomShortcutSetting.xaml (1)

32-35: LGTM! Consistent grid structure with proper alignment.

The simplified column structure aligns with the changes in other windows, maintaining consistency across the application.

Flow.Launcher/SelectBrowserWindow.xaml (2)

11-11: LGTM! Proper implementation of theme support.

The window correctly uses DynamicResource for background and foreground colors, ensuring proper dark theme support.

Also applies to: 13-13


35-35: LGTM! Grid layout change maintains proper alignment.

The button's Grid.Column property is correctly set to maintain proper alignment within the simplified grid structure.

Flow.Launcher/SelectFileManagerWindow.xaml (3)

11-11: LGTM! Proper implementation of theme support.

The window correctly uses DynamicResource for background and foreground colors, ensuring proper dark theme support.

Also applies to: 13-13


35-35: LGTM! Grid layout change maintains proper alignment.

The button's Grid.Column property is correctly set to maintain proper alignment within the simplified grid structure.


248-259: LGTM! Proper validation implementation.

The Done button's validation logic is well implemented, ensuring both profile name and path are provided before enabling the button.

Flow.Launcher/ReportWindow.xaml (3)

13-14: LGTM! Dark theme support added correctly.

The window now properly binds to theme-aware dynamic resources:

  • PopuBGColor for background
  • PopupTextColor for foreground

20-22: LGTM! WindowChrome improves window styling.

The WindowChrome addition provides better window styling with proper caption height and resize border thickness.


24-70: LGTM! Grid layout is well-structured.

The grid layout is organized effectively:

  • Clear row definitions
  • Proper column spacing
  • Consistent margins and alignments
Flow.Launcher/ReportWindow.xaml.cs (3)

51-54: LGTM! Localization support added correctly.

The error messages are now properly localized using App.API.GetTranslation.


58-62: LGTM! Error information is well-organized.

The error report now includes:

  • Runtime information
  • Dependencies information
  • Timestamp

110-118: Verify dependency paths exist.

The DependenciesInfo method should verify that the paths exist before including them in the report.

 private static string DependenciesInfo()
 {
+    var pythonPath = File.Exists(Constant.PythonPath) ? Constant.PythonPath : "Not found";
+    var nodePath = File.Exists(Constant.NodePath) ? Constant.NodePath : "Not found";
     var info = 
         $"""
-        {App.API.GetTranslation("pythonFilePath")}: {Constant.PythonPath}
-        {App.API.GetTranslation("nodeFilePath")}: {Constant.NodePath}
+        {App.API.GetTranslation("pythonFilePath")}: {pythonPath}
+        {App.API.GetTranslation("nodeFilePath")}: {nodePath}
         """;
     return info;
 }
Flow.Launcher/Languages/en.xaml (1)

386-391: LGTM! Localization strings are well-structured.

The new error reporting strings are:

  • Clear and user-friendly
  • Properly use placeholders
  • Follow existing naming conventions

@Jack251970 Jack251970 changed the title Improve Report window with Dark Theme and Localization Support Improve Report window Design Feb 22, 2025
@Jack251970 Jack251970 changed the title Improve Report window Design Improve Report Window Design Feb 22, 2025
@jjw24 jjw24 added the bug Something isn't working label Feb 26, 2025
@jjw24 jjw24 added this to the 1.20.0 milestone Feb 26, 2025
@Jack251970
Copy link
Member Author

@onesounds Hello, if you have time, could you please take a look?

Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors Count
❌ forbidden-pattern 22
⚠️ ignored-expect-variant 1
⚠️ non-alpha-in-dictionary 19

See ❌ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@jjw24 jjw24 merged commit 30aa1fa into Flow-Launcher:dev Feb 26, 2025
7 checks passed
@onesounds
Copy link
Contributor

@onesounds Hello, if you have time, could you please take a look?

Good design. 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working kind/ui related to UI, icons, themes, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants