Skip to content

feat(ui): search system for features#1255

Merged
alandtse merged 7 commits into
community-shaders:devfrom
davo0411:search-bar
Jul 15, 2025
Merged

feat(ui): search system for features#1255
alandtse merged 7 commits into
community-shaders:devfrom
davo0411:search-bar

Conversation

@davo0411
Copy link
Copy Markdown
Collaborator

@davo0411 davo0411 commented Jul 14, 2025

Adds a system to search for features out of the GetFeatureList based on simple character recognition.

  • Adds a "Features" heading above the search bar to separate features from general/advanced/display
  • Moved the Feature Issues panel to this new Features heading

20C5C4~1

Summary by CodeRabbit

  • New Features

    • Added a feature search bar to the menu, allowing users to quickly filter and find features.
    • Introduced searchable settings entries for features, enabling global search across feature settings.
    • Enhanced the settings panel with improved organization, tabs for "Settings" and "About", and detailed feature information.
  • UI Improvements

    • Features are now grouped by category and color-coded by state.
    • Search bars include a custom magnifying glass icon for improved usability.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 14, 2025

Walkthrough

The changes add a nested struct and virtual method to Feature for searchable settings entries. The menu UI is enhanced with a feature search bar, filtering logic, and reorganized rendering, including categorized and collapsible feature lists. Utility functions for feature search matching and search bar drawing are introduced.

Changes

File(s) Change Summary
src/Feature.h Added nested struct SettingSearchEntry and virtual method GetSettingsSearchEntries() returning searchable settings entries.
src/Menu.cpp Added feature search bar UI, implemented feature filtering, reorganized menu rendering with categorized, collapsible lists, and enhanced feature detail tabs.
src/Menu.h Added featureSearch string member, new UI icon search, included JSON support for serialization.
src/Utils/UI.cpp Added FeatureMatchesSearch() for filtering features and DrawFeatureSearchBar() for rendering the search input UI.
src/Utils/UI.h Added forward declaration of Feature and declarations for FeatureMatchesSearch() and DrawFeatureSearchBar().

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Menu
    participant Feature

    User->>Menu: Enter search text in feature search bar
    Menu->>Menu: Filter features using FeatureMatchesSearch()
    loop For each filtered feature
        Menu->>Feature: Optionally call GetSettingsSearchEntries()
        Menu->>Menu: Filter settings entries by search query
    end
    Menu->>User: Render filtered feature list and settings in UI
Loading

Suggested reviewers

  • alandtse
  • doodlum

Poem

In the warren of menus, a search bar appears,
Letting rabbits find features without any fears.
With filters and helpers, the settings are found,
The UI now sparkles—search magic abounds!
So hop through your features, both old and new,
The search is now swift, and the carrots accrue! 🥕


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8700e7 and ec3f95d.

📒 Files selected for processing (4)
  • src/Menu.cpp (1 hunks)
  • src/Menu.h (3 hunks)
  • src/Utils/UI.cpp (2 hunks)
  • src/Utils/UI.h (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/Menu.h
  • src/Menu.cpp
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-06-24T07:17:36.604Z
Learning: When reviewing PRs, always clarify the scope if there are multiple related features or dependencies. WeatherPicker was a separate PR that was already merged, while this PR focuses specifically on WetnessEffects climate preset system enhancements.
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#1157
File: src/Feature.cpp:42-49
Timestamp: 2025-06-17T09:27:49.594Z
Learning: In src/Feature.cpp, when an obsolete feature's INI file is deleted, the feature should be silently disabled without surfacing any issues to the user. This is the intended behavior because a deleted INI file for an obsolete feature indicates that the user has properly cleaned up the obsolete feature.
src/Utils/UI.h (2)
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#1157
File: src/Feature.cpp:42-49
Timestamp: 2025-06-17T09:27:49.594Z
Learning: In src/Feature.cpp, when an obsolete feature's INI file is deleted, the feature should be silently disabled without surfacing any issues to the user. This is the intended behavior because a deleted INI file for an obsolete feature indicates that the user has properly cleaned up the obsolete feature.
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#577
File: src/Features/WetnessEffects.h:36-36
Timestamp: 2025-06-08T11:25:14.536Z
Learning: In the skyrim-community-shaders project, boolean flags in C++ structs that interface with HLSL shaders use `uint` type instead of `bool` for compatibility reasons. This ensures consistent size, alignment, and cross-platform compatibility when passing data to shader constant buffers.
src/Utils/UI.cpp (1)
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#1157
File: src/Feature.cpp:42-49
Timestamp: 2025-06-17T09:27:49.594Z
Learning: In src/Feature.cpp, when an obsolete feature's INI file is deleted, the feature should be silently disabled without surfacing any issues to the user. This is the intended behavior because a deleted INI file for an obsolete feature indicates that the user has properly cleaned up the obsolete feature.
🧬 Code Graph Analysis (1)
src/Utils/UI.h (1)
src/Menu.cpp (4)
  • feat (726-772)
  • feat (726-726)
  • feat (793-1000)
  • feat (793-793)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (4)
src/Utils/UI.h (1)

13-13: LGTM! Well-designed API additions for feature search functionality.

The forward declaration and function signatures are clean and well-documented. The API design supports both feature matching logic and UI rendering, which aligns well with the separation of concerns.

Also applies to: 454-470

src/Utils/UI.cpp (3)

8-8: LGTM! Required include for Feature class usage.

The include is properly placed and necessary for the function implementations below.


619-637: LGTM! Robust search implementation with proper case-insensitive matching.

The function correctly:

  • Handles empty search queries by returning true
  • Searches both short name and display name
  • Performs case-insensitive comparison using standard ::tolower
  • Uses efficient substring search with std::string::find

639-695: LGTM! Well-styled search bar with proper icon rendering.

The implementation correctly:

  • Uses proper ImGui styling with RAII pattern (push/pop)
  • Handles availableWidth parameter gracefully
  • Implements a clean magnifying glass icon using draw primitives
  • Uses secure string handling with strncpy_s
  • Provides appropriate visual feedback with transparent background and hover states
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @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 explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

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.

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.
@github-actions
Copy link
Copy Markdown

Using provided base ref: 21f6706
Using base ref: 21f6706
Base commit date: 2025-07-13T20:59:08-07:00 (Sunday, July 13, 2025 08:59 PM)
No actionable suggestions for changed features.

Copy link
Copy Markdown
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 (3)
src/Menu.cpp (3)

348-357: Consider searching both short name and display name.

The current implementation only searches the feature's short name. Users might expect to search by the display name they see in the UI.

Consider matching against both names:

 bool Menu::FeatureMatchesSearch(Feature* feat) const
 {
 	if (featureSearch.empty())
 		return true;
-	std::string s = feat->GetShortName();
+	std::string shortName = feat->GetShortName();
+	std::string displayName = feat->GetName();
 	std::string q = featureSearch;
-	std::transform(s.begin(), s.end(), s.begin(), ::tolower);
+	std::transform(shortName.begin(), shortName.end(), shortName.begin(), ::tolower);
+	std::transform(displayName.begin(), displayName.end(), displayName.begin(), ::tolower);
 	std::transform(q.begin(), q.end(), q.begin(), ::tolower);
-	return s.find(q) != std::string::npos;
+	return shortName.find(q) != std::string::npos || displayName.find(q) != std::string::npos;
 }

359-369: Unused settings search method.

This method is implemented but not called anywhere in the provided code. Is the settings search functionality planned for a future update?

Would you like me to help implement the settings search UI that would utilize this method?


1083-1088: Simplify lambda capture.

The lambda unnecessarily captures this when it could directly use the method reference.

 // Filter features by search string
 if (!featureSearch.empty()) {
-	auto pred = [this](Feature* feat) { return FeatureMatchesSearch(feat); };
 	auto it = std::remove_if(sortedFeatureList.begin(), sortedFeatureList.end(),
-		[pred](Feature* feat) { return !pred(feat); });
+		[this](Feature* feat) { return !FeatureMatchesSearch(feat); });
 	sortedFeatureList.erase(it, sortedFeatureList.end());
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21f6706 and c8700e7.

📒 Files selected for processing (3)
  • src/Feature.h (1 hunks)
  • src/Menu.cpp (2 hunks)
  • src/Menu.h (4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-06-24T07:17:36.604Z
Learning: When reviewing PRs, always clarify the scope if there are multiple related features or dependencies. WeatherPicker was a separate PR that was already merged, while this PR focuses specifically on WetnessEffects climate preset system enhancements.
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
src/Feature.h (1)
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#1157
File: src/Feature.cpp:42-49
Timestamp: 2025-06-17T09:27:49.594Z
Learning: In src/Feature.cpp, when an obsolete feature's INI file is deleted, the feature should be silently disabled without surfacing any issues to the user. This is the intended behavior because a deleted INI file for an obsolete feature indicates that the user has properly cleaned up the obsolete feature.
🧬 Code Graph Analysis (2)
src/Menu.h (1)
src/Menu.cpp (6)
  • feat (798-844)
  • feat (798-798)
  • feat (865-1072)
  • feat (865-865)
  • label (776-785)
  • label (776-776)
src/Menu.cpp (5)
src/State.h (2)
  • featureName (218-218)
  • featureName (219-219)
src/Utils/UI.cpp (6)
  • DrawSectionHeader (415-476)
  • DrawSectionHeader (415-415)
  • DrawCategoryHeader (350-413)
  • DrawCategoryHeader (350-350)
  • HoverTooltipWrapper (24-31)
  • HoverTooltipWrapper (33-39)
src/Utils/FileSystem.cpp (2)
  • GetFeatureIniPath (40-43)
  • GetFeatureIniPath (40-40)
src/FeatureIssues.cpp (6)
  • IsObsoleteFeature (714-718)
  • IsObsoleteFeature (714-714)
  • HasFeatureIssues (114-117)
  • HasFeatureIssues (114-114)
  • DrawFeatureIssuesUI (346-451)
  • DrawFeatureIssuesUI (346-346)
src/Feature.cpp (2)
  • GetFeatureList (197-256)
  • GetFeatureList (197-197)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (4)
src/Feature.h (1)

7-17: Well-structured foundation for settings search.

The SettingSearchEntry struct and GetSettingsSearchEntries() virtual method provide a clean interface for features to expose their settings to the search system.

src/Menu.h (1)

6-9: Clean additions for search functionality.

The header changes properly declare the necessary members and methods for the search system implementation.

Also applies to: 30-33, 63-65, 216-223

src/Menu.cpp (2)

299-346: Well-implemented search bar with custom icon.

The transparent styling and custom-drawn magnifying glass icon provide a clean, integrated appearance. Proper ImGui ID and style management ensures no conflicts.


1203-1227: Clean separation of built-in menus and features.

The rendering logic properly groups built-in settings separately from features, with the search bar positioned intuitively after the "Features" header.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 14, 2025

✅ A pre-release build is available for this PR:
Download

@alandtse alandtse merged commit a9e0204 into community-shaders:dev Jul 15, 2025
17 checks passed
alandtse pushed a commit to alandtse/open-shaders that referenced this pull request Jul 20, 2025
@davo0411 davo0411 deleted the search-bar branch December 31, 2025 04:37
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