Skip to content
New issue

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

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

Already on GitHub? # to your account

Plugin Page Control Swap Feature & Restore "Search Delay" Field in General Page #3421

Merged
merged 31 commits into from
Apr 8, 2025

Conversation

onesounds
Copy link
Contributor

@onesounds onesounds commented Apr 4, 2025

What's the PR

image
image

  • Restore "Search Delay" field on the General page which was accidentally removed
  • Add a ComboBox at the top of the plugin page to switch controls, and a Help button to open an information dialog.
  • Separate the previously occupying "Priority" and "Search Delay" sections.
  • Allow users to modify the priority of multiple plugins with minimal steps.
  • "Search Delay" is added in the same manner.
  • Feature details are explained in a separate Help dialog.

Todo List

  • The explanation text in the Help dialog needs to be added or refined.
  • Adjust and verify the behavior of the Priority number box.
  • Match and confirm that all values in the Search Delay combo box

To Jack

  • The "Search Delay" field on the General page was accidentally removed, but it has been restored in this PR.
  • Let's remove the "Long", "Short", "Normal"... labels and use plain numeric values instead. On the plugin side, it's already set up with values like 100ms. You can change the control to a TextBox, ComboBox, or Slider—whichever you prefer. If the guide clearly explains the behavior difference between using large and small values, we probably don't need to use labels like "Long", "Short", or "Normal".
  • I tried using a NumberBox, but it wouldn't allow values below 0, so I removed the value handling. It also seems that the Search Delay isn't being saved properly. This part needs to be reworked.
  • This PR is mostly focused on design, and the internal implementation is still incomplete. Since I’ve made a lot of changes to your original PR, I think there might be quite a bit left for you to work on—sorry about that. 🙇‍♂️ If you notice anything that feels off or if there's any UI/UX you’re not happy with, feel free to let me know.

memo

  • I spent a long time debating whether to implement this feature using a ComboBox or RadioButtons. Since this kind of layout isn’t commonly used, I even considered dropping the idea altogether. However, I prioritized the convenience of being able to quickly switch between multiple options at a glance. In the end, I chose the ComboBox for its compact size and aesthetic appeal.

  • For the Search Delay setting, I originally considered labeling the options as long, short, and normal. But since it's a setting users typically don’t need to adjust, and numerical values don’t require translation, I concluded that clearly explaining what each value does would be sufficient. (It also helped that ptr uses this same approach.)

  • I considered using an InfoBox to show guidance, but ultimately decided against it. Showing it only in certain situations caused the list to shift downward, and once users understand how it works, the extra information becomes unnecessary. Instead, I used a content dialog. Rather than creating a new window in XAML as was done in previous implementations, I handled everything in code. I also adjusted the style accordingly to match. I thought about adding an image, but in the end decided it would be better to simply provide a detailed explanation.

@prlabeler prlabeler bot added the enhancement New feature or request label Apr 4, 2025

This comment has been minimized.

Copy link

gitstream-cm bot commented Apr 4, 2025

🥷 Code experts: Jack251970, Yusyuriv

Jack251970, onesounds have most 👩‍💻 activity in the files.
Yusyuriv, onesounds have most 🧠 knowledge in the files.

See details

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

Jack251970 onesounds
APR 9 additions & 1 deletions
MAR 67 additions & 42 deletions 8 additions & 3 deletions
FEB 15 additions & 9 deletions
JAN 1 additions & 0 deletions
DEC
NOV

Knowledge based on git-blame:
onesounds: 40%
Yusyuriv: 5%

Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml

Activity based on git-commit:

Jack251970 onesounds
APR
MAR 25 additions & 20 deletions
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Yusyuriv: 80%

Flow.Launcher/Resources/CustomControlTemplate.xaml

Activity based on git-commit:

Jack251970 onesounds
APR
MAR 15 additions & 5 deletions
FEB 31 additions & 14 deletions
JAN
DEC
NOV

Knowledge based on git-blame:
onesounds: 100%

Flow.Launcher/Resources/Dark.xaml

Activity based on git-commit:

Jack251970 onesounds
APR
MAR 14 additions & 9 deletions
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
onesounds: 100%

Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs

Activity based on git-commit:

Jack251970 onesounds
APR
MAR 2 additions & 1 deletions
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Yusyuriv: 96%

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Activity based on git-commit:

Jack251970 onesounds
APR
MAR 44 additions & 20 deletions 43 additions & 62 deletions
FEB 1 additions & 1 deletions
JAN 8 additions & 1 deletions
DEC
NOV

Knowledge based on git-blame:
onesounds: 67%
Yusyuriv: 33%

Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml

Activity based on git-commit:

Jack251970 onesounds
APR
MAR
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Yusyuriv: 65%
onesounds: 35%

Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs

Activity based on git-commit:

Jack251970 onesounds
APR
MAR 4 additions & 4 deletions
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Yusyuriv: 57%
onesounds: 30%

Flow.Launcher/ViewModel/PluginViewModel.cs

Activity based on git-commit:

Jack251970 onesounds
APR
MAR 94 additions & 57 deletions
FEB 31 additions & 37 deletions
JAN
DEC
NOV

Knowledge based on git-blame:
Yusyuriv: 19%

To learn more about /:\ gitStream - Visit our Docs

Copy link
Contributor

coderabbitai bot commented Apr 4, 2025

📝 Walkthrough

Walkthrough

This pull request implements extensive updates to the Flow Launcher application. It adds new UI string resources and revises existing ones to reflect clearer display mode and search delay instructions. Several XAML files have been updated with additional controls, converters, and reorganized layouts. In the view models and settings, display mode properties and search delay settings have been restructured by switching from enumeration types to integer-based configurations. Obsolete files and components related to the previous search delay implementation have been removed.

Changes

File(s) Summary of Changes
Flow.Launcher/Languages/en.xaml Added new string resources (FilterComboboxLabel, DisplayModeOnOff, DisplayModePriority, DisplayModeSearchDelay); updated key and value for search delay tip.
Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml Added namespace for converters; introduced BooleanToVisibilityConverter; added new StackPanel elements (PriorityControl, SearchDelayControl); renamed ToggleSwitch to OnOffControl; removed obsolete UI elements.
Flow.Launcher/Resources/CustomControlTemplate.xaml Updated ContentDialog style—switched dynamic resource references for foreground/background; altered padding and row height; revised button grid assignments and margins in visual states.
Flow.Launcher/Resources/Dark.xaml Modified ContentDialogOverlayBG color from #4D000000 to #58000000 (increased opacity).
Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs Introduced new enum DisplayMode and class DisplayModeData; added properties (SelectedDisplayMode, IsOnOffSelected, IsPrioritySelected, IsSearchDelaySelected); implemented methods (OpenHelperAsync, UpdateDisplayModeFromSelection) to handle display mode changes.
Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml Added an ExCard component with a toggle switch and nested card for configuring search delay settings via a ComboBox.
Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml Included new XML namespace; added a ComboBox for selecting display modes and a Button to trigger help via OpenHelperCommand; restructured layout with a StackPanel and additional label elements.
Flow.Launcher/ViewModel/PluginViewModel.cs Updated Priority property to support both getting and setting (invokes ChangePriority when altered); modified instantiation of BottomPart2 to use InstalledPluginDisplayBottomData; removed BottomPart3.
Flow.Launcher/Infrastructure/UserSettings/PluginSettings.cs Changed properties DefaultSearchDelayTime and SearchDelayTime from nullable enum types to nullable integers (int?).
Flow.Launcher/Infrastructure/UserSettings/Settings.cs Removed enum-based SearchDelayTime; added an integer property SearchDelayTime with a default value (150) and introduced SearchDelayTimeRange list with predefined delay values.
Flow.Launcher/Plugin/PluginMetadata.cs Updated SearchDelayTime property from a nullable enum to a nullable integer and revised the XML documentation to reflect delay times in milliseconds.
Flow.Launcher/Plugin/SearchDelayTime.cs,
Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml,
Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml.cs,
Flow.Launcher/SearchDelayTimeWindow.xaml,
Flow.Launcher/SearchDelayTimeWindow.xaml.cs
Removed obsolete files and controls for handling search delay settings.
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs Refactored SearchDelayTimeData class by removing inheritance from a generic type; added static GetValues method; updated SearchDelayTimes property and simplified getter for SearchDelayTime.
Flow.Launcher/ViewModel/MainViewModel.cs Simplified logic in QueryTaskAsync by directly using the plugin’s SearchDelayTime or default setting as the delay value without switch-case mapping.
Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json Updated "SearchDelayTime" value from the descriptive string "VeryLong" to the integer value 450.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SettingsVM
    participant UI
    participant Dialog

    User->>UI: Select display mode via ComboBox
    UI->>SettingsVM: Update SelectedDisplayMode
    SettingsVM->>SettingsVM: Execute UpdateDisplayModeFromSelection()
    SettingsVM-->>UI: Update control visibilities (OnOff, Priority, SearchDelay)

    User->>UI: Click Help Button
    UI->>SettingsVM: Trigger OpenHelperCommand
    SettingsVM->>Dialog: Open helper dialog (ContentDialog)
    Dialog-->>SettingsVM: Return help information
    SettingsVM-->>UI: Display help dialog to user
Loading

Possibly related PRs

  • Support Placeholder Text & Toggle Resize Mode #3396: The changes in the main PR, which involve updates to string resources related to search delay and the addition of new UI elements, are related to the retrieved PR, which introduces placeholder text functionality and modifies UI elements for better user interaction, particularly in the context of search settings. Both PRs enhance the user interface and user experience regarding search functionalities.
  • Input Smooth & Search delay #3350: The changes in the main PR, which involve updates to string resources related to search delay settings, are directly related to the retrieved PR, as both address the implementation and user interface aspects of search delay functionality, including the addition of new string resources and properties that enhance user interaction with search delay settings.

Poem

I'm a bunny in code, so spry and keen,
Hoping through changes in our digital scene.
With toggles and delays, my burrow's redefined,
New settings and styles, a joy to find.
Coding carrots crunch in rhythmic time,
Celebrating these changes with a happy rhyme! 🐇✨


📜 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 d09899e and c351a38.

📒 Files selected for processing (2)
  • Flow.Launcher/ViewModel/MainViewModel.cs (1 hunks)
  • Flow.Launcher/ViewModel/PluginViewModel.cs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • Flow.Launcher/ViewModel/MainViewModel.cs
  • Flow.Launcher/ViewModel/PluginViewModel.cs

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

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

🧹 Nitpick comments (8)
Flow.Launcher/Resources/Dark.xaml (1)

116-116: Overlay Color Opacity Increased
The ContentDialogOverlayBG resource now uses #58000000 (previously #4D000000), which increases its opacity. This should yield a more pronounced overlay effect when dialogs are displayed. Please verify that the enhanced opacity maintains sufficient contrast and integrates well with related UI elements (e.g., dialogs in the settings and plugin pages).

Flow.Launcher/ViewModel/PluginViewModel.cs (1)

130-142: Unused private field _priority should be removed.

The new implementation of the Priority property includes a private backing field _priority that is declared but never used. The getter still directly accesses PluginPair.Metadata.Priority and the setter calls ChangePriority without using the backing field.

- //public int Priority => PluginPair.Metadata.Priority;
- private int _priority;
+ //public int Priority => PluginPair.Metadata.Priority;
  public int Priority
  {
      get => PluginPair.Metadata.Priority;
      set
      {
          if (PluginPair.Metadata.Priority != value)
          {
              ChangePriority(value);
          }
      }
  }
Flow.Launcher/Resources/Controls/InstalledPluginSearchDelayCombobox.xaml.cs (1)

20-21: Translate Korean comments to English for consistency.

The code contains Korean comments that should be translated to English for better maintainability and consistency.

- // 초기 값 설정
+ // Set initial value
  int currentDelayMs = GetCurrentDelayMs(viewModel);

...

- // SearchDelayTime enum 값을 int로 변환
+ // Convert SearchDelayTime enum value to int
  SearchDelayTime? delayTime = viewModel.PluginPair.Metadata.SearchDelayTime;

...

- return 0; // ̸Å|°ª
+ return 0; // Default value

Also applies to: 35-36, 41-42

Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml (1)

68-73: Enhance help button with a tooltip.

The help button uses a symbol font character () which might not be immediately intuitive to all users. Adding a tooltip would improve usability.

  <Button
      Width="34"
      Height="34" FontFamily="{DynamicResource SymbolThemeFontFamily}"
      Margin="0 0 20 0"
      Content="&#xe9ce;"
-     FontSize="14" Click="Help_Click"/>
+     FontSize="14" Click="Help_Click"
+     ToolTip="{DynamicResource helpButtonTooltip}"
+     ToolTipService.InitialShowDelay="200"
+     ToolTipService.Placement="Top"/>
Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs (1)

44-85: Consider moving dialog content to XAML resources.

The help dialog content is constructed programmatically, which works but makes it harder to maintain and style. Consider defining this content as a XAML resource or UserControl for better separation of concerns.

// Example of how to improve this:
private async void Help_Click(object sender, RoutedEventArgs e)
{
    // Create the dialog using a resource
    var helpDialog = new ContentDialog()
    {
        Content = Application.Current.Resources["HelpDialogContent"],
        PrimaryButtonText = (string)Application.Current.Resources["commonOK"],
        CornerRadius = new CornerRadius(8),
        Style = (Style)Application.Current.Resources["ContentDialog"]
    };
    
    await helpDialog.ShowAsync();
}

// Then define the content in a resource dictionary:
// <DataTemplate x:Key="HelpDialogContent">
//     <StackPanel>
//         <!-- Help content here -->
//     </StackPanel>
// </DataTemplate>
Flow.Launcher/Resources/CustomControlTemplate.xaml (1)

3586-3586: Potentially redundant margin

You're still using the dynamic resource ContentDialogPadding for the Grid margin, but have removed it from the parent Border. This might lead to inconsistent spacing behavior.

Consider whether you want padding to be applied at the Grid level or at the Border level to maintain a consistent spacing approach.

Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml (1)

55-94: Consider removing commented code.

While it's sometimes useful to keep old code temporarily during development, you should remove this commented-out code before finalizing the PR. It makes the codebase cleaner and more maintainable.

Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs (1)

32-52: Consider using constants for display mode strings.

The hard-coded strings "OnOff", "Priority", and "SearchDelay" appear in multiple places. Using constants or an enum would make the code more maintainable and less prone to typos.

+ public static class DisplayModes
+ {
+     public const string OnOff = "OnOff";
+     public const string Priority = "Priority";
+     public const string SearchDelay = "SearchDelay";
+ }

public void UpdateDisplayModeFromSelection()
{
    switch (SelectedDisplayMode)
    {
-        case "OnOff":
+        case DisplayModes.OnOff:
            IsOnOffSelected = true;
            IsPrioritySelected = false;
            IsSearchDelaySelected = false;
            break;
-        case "Priority":
+        case DisplayModes.Priority:
            IsOnOffSelected = false;
            IsPrioritySelected = true;
            IsSearchDelaySelected = false;
            break;
-        case "SearchDelay":
+        case DisplayModes.SearchDelay:
            IsOnOffSelected = false;
            IsPrioritySelected = false;
            IsSearchDelaySelected = true;
            break;
    }
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4eba415 and b81f9be.

📒 Files selected for processing (12)
  • Flow.Launcher/Converters/StringEqualityToVisibilityConverter.cs (1 hunks)
  • Flow.Launcher/Languages/en.xaml (1 hunks)
  • Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml (4 hunks)
  • Flow.Launcher/Resources/Controls/InstalledPluginSearchDelayCombobox.xaml (1 hunks)
  • Flow.Launcher/Resources/Controls/InstalledPluginSearchDelayCombobox.xaml.cs (1 hunks)
  • Flow.Launcher/Resources/CustomControlTemplate.xaml (7 hunks)
  • Flow.Launcher/Resources/Dark.xaml (1 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs (1 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (1 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml (2 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs (2 hunks)
  • Flow.Launcher/ViewModel/PluginViewModel.cs (1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs (2)
Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs (3)
  • SettingsPanePluginsViewModel (13-150)
  • SettingsPanePluginsViewModel (122-125)
  • UpdateDisplayModeFromSelection (32-52)
Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs (1)
  • SettingsPanePlugins_OnKeyDown (43-47)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
🔇 Additional comments (20)
Flow.Launcher/Resources/Controls/InstalledPluginSearchDelayCombobox.xaml (1)

1-39: New UserControl looks well-structured for delay selection.

This new UserControl implements a search delay combobox that will be used in the plugin management UI. The component is cleanly structured with proper XAML namespaces and data binding setup.

A few observations:

  • The TextBlock is set to Visibility="Collapsed" - is this intentional for this view, or will it be made visible conditionally?
  • The ComboBox has a fixed width of 100, which might limit display if option text is longer in some languages.

Please confirm that the hidden TextBlock is intentional, or if it's meant to be shown conditionally through a trigger or binding.

Flow.Launcher/Converters/StringEqualityToVisibilityConverter.cs (1)

1-23: Well-implemented visibility converter for string comparison.

This converter follows best practices for implementing IValueConverter:

  • Properly handles null values by returning Visibility.Collapsed
  • Uses efficient string comparison
  • Clear implementation of the Convert method

The ConvertBack method appropriately throws NotImplementedException since the conversion is likely only needed in one direction.

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (1)

199-218: New search delay settings section integrates well with existing UI.

The new ExCard for search delay settings is properly implemented with:

  • Toggle switch to enable/disable search delay functionality
  • Nested card with combobox for selecting delay time
  • Appropriate dynamic resources for localization
  • Consistent styling with the rest of the settings page

This addition effectively restores the "Search Delay" field to the General page as mentioned in the PR objectives.

Flow.Launcher/Languages/en.xaml (1)

137-140: Added localization strings for new UI components.

The new string resources provide localization support for the advanced settings interface mentioned in the PR objectives:

  • FilterComboboxLabel for the combobox label
  • EnabledCombobox, PriorityCombobox, and SearchDelayCombobox for display modes

These additions support the PR's goal of enhancing the plugin page with a ComboBox for switching controls.

Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml (2)

47-67: Display mode selection UI is well-implemented.

The ComboBox for selecting display modes provides a clear and intuitive way for users to switch between different views. The binding to the ViewModel's SelectedDisplayMode property ensures proper state management.


119-123: Border styling improves visual consistency.

Adding a Border with Background around the ListBox improves the visual consistency of the UI.

Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs (1)

29-35: Selection change handler correctly updates the view model.

The DisplayModeComboBox_SelectionChanged method properly delegates to the view model's UpdateDisplayModeFromSelection method, ensuring the state is updated when the user changes the display mode.

Flow.Launcher/Resources/CustomControlTemplate.xaml (5)

3574-3578: Consider the implications of fixed sizing

You've changed the DialogSpace padding from a dynamic resource to a fixed value of 0, and changed the second row height from Auto to a fixed 80. While this creates a more consistent layout, it could create issues if:

  1. Content needs different padding based on themes/user preferences
  2. The button area needs more than 80px of height on certain displays or with certain content

Consider whether this dialog will be used in contexts where the button row might need more height, or where padding should be theme-dependent.


3629-3631: Good styling separation for button area

The addition of a separate styled Border for the button area with specific background, border and corner radius creates a clear visual distinction for the command area.


3784-3790: Consistent button positioning changes

The changes to Grid.Column, ColumnSpan and margins create a more consistent button layout in the PrimaryVisible state.


3802-3813: Visual state consistency maintained

You've made similar positioning and margin changes across multiple visual states, ensuring consistent behavior regardless of which buttons are visible.


3821-3835: Complete visual state pattern

The changes to the CloseVisible state complete the pattern of updates across all visual states, maintaining consistency in the UI.

Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml (4)

10-10: Added namespace for converters looks good.

The addition of the converters namespace is appropriate for integrating the StringEqualityToVisibilityConverter needed for the display mode switching feature.


15-17: Converter resource implementation looks correct.

The StringEqualityToVisibilityConverter resource is properly defined and will be used to control visibility of UI elements based on the current display mode.


115-131: Search Delay control implementation looks good.

The Search Delay section is well-structured and correctly uses the custom InstalledPluginSearchDelayCombobox component. The visibility binding is properly set up to show this control only when the SearchDelay mode is selected.


133-142: ToggleSwitch visibility binding is correctly implemented.

The OnOffControl now has proper visibility binding based on the selected display mode, which aligns with the PR objectives for the control swap feature.

Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs (4)

17-30: SelectedDisplayMode property looks good.

The property is well-implemented with proper change notification and triggers the UpdateDisplayModeFromSelection method when changed.


54-67: Boolean properties for display mode selection look good.

The IsOnOffSelected, IsPrioritySelected, and IsSearchDelaySelected properties are well-implemented with proper change notification and call UpdateDisplayMode when changed.

Also applies to: 69-82, 84-97


99-111: CurrentDisplayMode property implementation is correct.

This property provides the current display mode to the UI elements through bindings and handles change notification appropriately.


113-121: UpdateDisplayMode method has a potential logical issue.

If multiple boolean properties are set to true (which shouldn't happen but is technically possible), the priority order is OnOff > Priority > SearchDelay. Consider adding validation to ensure only one mode is selected at a time or adding an else clause to handle invalid states.

private void UpdateDisplayMode()
{
    if (IsOnOffSelected)
        CurrentDisplayMode = "OnOff";
    else if (IsPrioritySelected)
        CurrentDisplayMode = "Priority";
    else if (IsSearchDelaySelected)
        CurrentDisplayMode = "SearchDelay";
+   else
+       // Set a default or log a warning about invalid state
+       CurrentDisplayMode = "OnOff";
}

This comment has been minimized.

@Jack251970 Jack251970 added this to the 1.20.0 milestone Apr 5, 2025
@Jack251970 Jack251970 added kind/ui related to UI, icons, themes, etc kind/ux related to user experience labels Apr 5, 2025

This comment has been minimized.

This comment has been minimized.

@Jack251970 Jack251970 added the Dev branch only An issue or fix for the Dev branch build label Apr 7, 2025

This comment has been minimized.

This comment has been minimized.

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 (1)
Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml (1)

78-97: Good implementation of the Search Delay control.

The SearchDelayControl successfully restores the "Search Delay" field as mentioned in the PR objectives, with:

  • Clear visibility binding to IsSearchDelaySelected
  • Appropriate tooltip and labeling
  • NumberBox with proper minimum/maximum constraints
  • Two-way binding to PluginSearchDelayTime

Consider adding the ValueChanged event handler to this NumberBox as well to handle potential NaN values consistently across all number inputs.

                                SpinButtonPlacementMode="Inline"
                                ToolTip="{DynamicResource searchDelayToolTip}"
-                               Value="{Binding PluginSearchDelayTime, Mode=TwoWay}" />
+                               Value="{Binding PluginSearchDelayTime, Mode=TwoWay}"
+                               ValueChanged="NumberBox_OnValueChanged" />
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6726828 and 65f48e3.

📒 Files selected for processing (2)
  • Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml (4 hunks)
  • Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml.cs (1 hunks)
🔇 Additional comments (7)
Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml (5)

5-6: Good addition of the converters namespace.

Adding the converters namespace enables proper visibility management for the new display mode feature.


15-17: LGTM: Well-structured resource addition.

The BooleanToVisibilityConverter is appropriately added to the UserControl.Resources section, making it available throughout the control.


56-76: Nicely implemented Priority control with proper binding.

The PriorityControl implementation includes:

  • Correct visibility binding using the converter
  • Proper labeling with tooltip
  • NumberBox with appropriate constraints and two-way binding to Priority
  • Event handler for value changes

This effectively implements the requested priority control swapping feature.


99-106: LGTM: Toggle switch improvements and visibility control.

The ToggleSwitch has been enhanced with:

  • An explicit name for better code organization
  • Appropriate visibility binding for display mode switching
  • Good comment explaining the ordering relationship with other controls

This supports the new control swapping feature while maintaining existing functionality.


135-135: Fixed: BottomPart2 ContentControl is now properly uncommented.

The ContentControl for BottomPart2 has been restored, resolving the issue identified in the previous review.

Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml.cs (2)

1-2: Good addition of the required namespace.

The ModernWpf.Controls namespace is correctly imported to support the NumberBox control.


12-18: LGTM: Well-implemented validation for NumberBox inputs.

The NumberBox_OnValueChanged method provides essential validation by:

  • Checking for NaN values
  • Setting a default value of 0 when an invalid input is detected

This prevents UI errors from invalid user inputs and ensures consistent behavior.

- Adjust Numberbox Style
- Add small change value(10)
- Adjust strings

This comment has been minimized.

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 (1)
Flow.Launcher/Resources/CustomControlTemplate.xaml (1)

3800-3807: Refined button positioning in different dialog states

The updates to the button visibility states (PrimaryVisible, SecondaryVisible, CloseVisible) include:

  • Repositioned buttons to use columns 1-2 instead of 0-2
  • Removed margins between buttons for a cleaner look
  • Updated grid positioning for a more balanced layout

Note that in the CloseVisible state (line 3849), the CloseButton is set to hidden, which seems counterintuitive. Consider reviewing this logic to ensure the button is properly displayed when needed.

- <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="Visibility">
-   <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
- </ObjectAnimationUsingKeyFrames>
+ <!-- Ensure CloseButton is visible in CloseVisible state -->

Also applies to: 3819-3826, 3838-3851

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 65f48e3 and e955e47.

📒 Files selected for processing (7)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1 hunks)
  • Flow.Launcher/Languages/en.xaml (3 hunks)
  • Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml (4 hunks)
  • Flow.Launcher/Resources/CustomControlTemplate.xaml (9 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (3 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs (2 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs
  • Flow.Launcher/Languages/en.xaml
  • Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml
🧰 Additional context used
🧬 Code Definitions (1)
Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs (2)
Flow.Launcher/SettingPages/ViewModels/DropdownDataGeneric.cs (2)
  • DropdownDataGeneric (7-35)
  • UpdateLabels (28-34)
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (1)
  • UpdateEnumDropdownLocalizations (163-169)
🔇 Additional comments (18)
Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs (7)

22-26: LGTM: DisplayModeData and DisplayModes implementation

The implementation of DisplayModeData as a subclass of DropdownDataGeneric and the initialization of DisplayModes using the GetValues method correctly leverages the existing dropdown framework. This approach ensures consistency with other dropdowns in the application.


27-40: LGTM: SelectedDisplayMode property with change notification

The SelectedDisplayMode property is properly implemented with change tracking and calls UpdateDisplayModeFromSelection() when the value changes. This ensures that the UI stays in sync with the selected display mode.


42-82: LGTM: Boolean tracking properties for each display mode

The three boolean properties (IsOnOffSelected, IsPrioritySelected, IsSearchDelaySelected) are correctly implemented with proper change notification, which will enable binding to visibility properties in the XAML.


114-156: Content dialog structure follows best practices

The OpenHelperAsync method creates a well-structured dialog with clear headings and explanations for Priority and Search Delay features. The implementation uses the ContentDialog pattern correctly.

One suggestion to consider - the dialog appears to use hard-coded strings retrieved from resources. For localization flexibility, you might want to:

-                        Text = (string)Application.Current.Resources["priority"],
+                        Text = App.API.GetTranslation("priority"),

This would ensure consistency with the localization approach used elsewhere.


158-161: LGTM: UpdateEnumDropdownLocalizations method

This method ensures that display mode labels are updated when the language changes, maintaining UI consistency.


163-183: LGTM: UpdateDisplayModeFromSelection implementation

The method properly handles the mutual exclusivity of display modes, ensuring that only one mode is active at a time. The switch statement provides a clean approach to handling the different display modes.


186-191: LGTM: DisplayMode enum definition

The DisplayMode enum is appropriately defined with the three modes mentioned in the PR objectives (OnOff, Priority, and SearchDelay). This enables the combo box at the top for switching controls as requested.

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (1)

199-226: LGTM: Search delay configuration UI components

The ExCard implementation for search delay settings follows the established pattern in the codebase. The structure with a toggle switch and nested card for detailed settings provides a clean, intuitive UI.

The NumberBox for search delay time has appropriate constraints:

  • Minimum: 0
  • Maximum: 1000
  • SmallChange: 10
  • Validation mode: InvalidInputOverwritten

This implementation successfully restores the "Search Delay" field on the General page as mentioned in the PR objectives.

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (3)

148-160: LGTM: SearchDelayTimeValue property implementation

The SearchDelayTimeValue property correctly updates the Settings.SearchDelayTime value and triggers property change notifications for both itself and the display property. This ensures the UI stays in sync with changes to the delay value.


161-161: LGTM: SearchDelayTimeDisplay property

The computed property provides a formatted string with "ms" suffix, making the value more user-friendly in the UI where needed.


163-169: LGTM: Updated UpdateEnumDropdownLocalizations method

The method has been updated to remove any references to the previous SearchDelayTimes dropdown, reflecting the shift from an enum-based approach to a direct integer value for search delay time.

Flow.Launcher/Resources/CustomControlTemplate.xaml (7)

1506-1506: LGTM: Updating placeholder color for consistency

This change sets the placeholder text to use the "CustomContextDisabled" color when the placeholder foreground is null, which provides better accessibility in disabled state.


2692-2705: Improved TextBox styling with nested borders

The changes implement a more refined TextBox appearance for the NumberBox component by using nested borders with different styling properties. This creates a visual hierarchy with an outer border (CustomTextBoxOutline) and an inner border (CustomTextBoxInline), providing a more polished look that aligns with the plugin page control enhancements described in the PR.


2793-2804: Enhanced focus state styling for TextBox

The focus state styling has been improved by applying different visual treatments to the inner and outer borders. When focused, the inner border now has a 2px bottom border while the outer border maintains its appearance, creating a subtle but effective focus indicator.


3538-3539: Updated ContentDialog color resources

The ContentDialog's foreground and background colors now use more specific dynamic resources (PopupTextColor and PopupBGColor) rather than the generic content dialog resources. This change provides better consistency with the new popup styling throughout the application.


3586-3586: Removed padding from dialog content area

Setting the padding to 0 instead of using the ContentDialogPadding resource removes spacing around the content area, allowing for more control over the internal layout of dialog content. This aligns with the PR objective of enhancing the plugin page's Dialog controls.


3590-3590: Fixed height for button row in ContentDialog

Changed the button row height from Auto to a fixed 80px, ensuring consistent spacing for the button area regardless of content. This creates a more predictable layout for the Help dialog mentioned in the PR.


3641-3687: Redesigned ContentDialog button area

The button area in the ContentDialog has been completely redesigned with:

  • Consistent horizontal padding (26px on each side)
  • A dedicated background color and top border
  • Rounded bottom corners (8px radius) to match the dialog shape
  • Improved button positioning with a 4-column grid for more flexible layouts

These changes improve the visual appeal and usability of the dialog buttons, supporting the PR's goal of adding a help button that opens an information dialog.

This comment has been minimized.

This comment has been minimized.

@Jack251970 Jack251970 requested a review from Copilot April 8, 2025 13:07

This comment has been minimized.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 13 out of 22 changed files in this pull request and generated no comments.

Files not reviewed (9)
  • Flow.Launcher/Languages/en.xaml: Language not supported
  • Flow.Launcher/PriorityChangeWindow.xaml: Language not supported
  • Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml: Language not supported
  • Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml: Language not supported
  • Flow.Launcher/Resources/CustomControlTemplate.xaml: Language not supported
  • Flow.Launcher/Resources/Dark.xaml: Language not supported
  • Flow.Launcher/SearchDelayTimeWindow.xaml: Language not supported
  • Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml: Language not supported
  • Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml: Language not supported
Comments suppressed due to low confidence (1)

Flow.Launcher/ViewModel/MainViewModel.cs:1260

  • The removal of the mapping from enum values to milliseconds now assumes that both plugin.Metadata.SearchDelayTime and Settings.SearchDelayTime are stored as millisecond values. Please verify that these values are always provided in ms to avoid unintended delays.
var searchDelayTime = plugin.Metadata.SearchDelayTime ?? Settings.SearchDelayTime;

Jack251970
Jack251970 previously approved these changes Apr 8, 2025
@Jack251970 Jack251970 changed the title Plugin Page Control Swap Feature Plugin Page Control Swap Feature & Restore "Search Delay" Field in General Page Apr 8, 2025
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: 2

🧹 Nitpick comments (1)
Flow.Launcher/ViewModel/PluginViewModel.cs (1)

90-118: Consider notifying property changes in setters.

Neither the Priority nor PluginSearchDelayTime property setters call OnPropertyChanged. While two-way bindings may update correctly, explicit notifications would ensure UI consistency.

public int Priority
{
    get => PluginPair.Metadata.Priority;
    set
    {
        PluginPair.Metadata.Priority = value;
        PluginSettingsObject.Priority = value;
+       OnPropertyChanged();
    }
}

public double PluginSearchDelayTime
{
    get => PluginPair.Metadata.SearchDelayTime == null ?
        double.NaN :
        PluginPair.Metadata.SearchDelayTime.Value;
    set
    {
        if (double.IsNaN(value))
        {
            PluginPair.Metadata.SearchDelayTime = null;
            PluginSettingsObject.SearchDelayTime = null;
        }
        else
        {
            PluginPair.Metadata.SearchDelayTime = (int)value;
            PluginSettingsObject.SearchDelayTime = (int)value;
        }
+       OnPropertyChanged();
+       OnPropertyChanged(nameof(SearchDelayTimeText));
    }
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 970bb3a and c33fae9.

📒 Files selected for processing (3)
  • Flow.Launcher/Languages/en.xaml (3 hunks)
  • Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml (4 hunks)
  • Flow.Launcher/ViewModel/PluginViewModel.cs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher/Languages/en.xaml
🧰 Additional context used
🧬 Code Definitions (1)
Flow.Launcher/ViewModel/PluginViewModel.cs (2)
Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs (3)
  • Plugin (90-97)
  • Plugin (99-103)
  • Plugin (106-131)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1)
  • Settings (16-437)
🔇 Additional comments (9)
Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml (5)

6-6: LGTM: Namespace addition for converters.

The addition of the converters namespace is appropriate as it's needed for the BooleanToVisibilityConverter used throughout the file.


15-17: LGTM: UserControl resources setup.

Adding the BooleanToVisibilityConverter as a resource at the UserControl level is a clean approach and follows standard WPF practices.


56-76: LGTM: Priority control implementation.

The PriorityControl implementation is well-structured with:

  • Appropriate visibility binding to the display mode
  • Clear labeling with proper styling
  • NumberBox with validation constraints and two-way binding
  • Event handler for value changes

This addresses the previous review comment about missing data binding for the Priority NumberBox.


104-110: LGTM: Toggle switch control with display mode.

The toggle switch has been properly named and its visibility is correctly bound to the IsOnOffSelected property. The comment above it explains the positioning logic.


139-139: LGTM: ContentControl for BottomPart2 has been uncommented.

This change properly restores the ContentControl for BottomPart2, addressing the previous review comment about a mismatch between the XAML and ViewModel.

Flow.Launcher/ViewModel/PluginViewModel.cs (4)

18-19: LGTM: Settings service initialization.

Properly retrieving the Settings service from the IoC container ensures consistent access to application settings.


90-98: LGTM: Priority property implementation.

The Priority property implementation is good - it reads from and writes to both the runtime metadata and settings objects, maintaining consistency.


127-127: LGTM: Updated BottomPart2 initialization.

The BottomPart2 property now correctly initializes with InstalledPluginDisplayBottomData, matching the uncommented ContentControl in the XAML file.


155-156: LGTM: Added properties for search delay settings.

These new properties provide the SearchDelayControl with access to global settings, allowing it to show whether search delay is enabled and the default delay value.

Copy link
Contributor

@Jack251970 Jack251970 left a comment

Choose a reason for hiding this comment

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

👍

This comment has been minimized.

@onesounds onesounds enabled auto-merge April 8, 2025 13:35
Copy link

github-actions bot commented Apr 8, 2025

@check-spelling-bot Report

🔴 Please review

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

❌ Errors Count
❌ forbidden-pattern 22
⚠️ 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.

@onesounds onesounds merged commit d33e751 into Flow-Launcher:dev Apr 8, 2025
4 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Apr 9, 2025
@jjw24 jjw24 removed the Dev branch only An issue or fix for the Dev branch build label Apr 10, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request kind/ui related to UI, icons, themes, etc kind/ux related to user experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants