Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

feat: Custom Default Search Keywords - #110

Open
kipuki wants to merge 11 commits into
OMGDuke:mainfrom
kipuki:custom-search-keywords
Open

feat: Custom Default Search Keywords#110
kipuki wants to merge 11 commits into
OMGDuke:mainfrom
kipuki:custom-search-keywords

Conversation

@kipuki

@kipuki kipuki commented Apr 12, 2025

Copy link
Copy Markdown

Summary

This PR introduces the ability for users to customize the default keywords appended to game titles. This feature was originally suggested in Issue #30 , and I wanted to contribute since it's also something I personally found useful.

Changes

  • TextInputModal was created as an extension to ConfirmModal to allow users to make add text inputs. This is used to allow the user to change the default keywords.
  • Cleaned up unused imports
  • Added English localization and placeholders for other languages.
  • I believe it was necessary to change the way the change theme page was structured such that the parent would manage the state. This simplified manipulating the input value that the child textbox utilizes.
  • Added search keywords as a configurable setting. Updated the script to merge saved settings with defaults to prevent bugs when new defaults are introduced:
// Merge default with saved settings to account for newer additions.
const newSettings = { ...defaultSettings, ...savedSettings };
setSettings(newSettings)

Notes

I am still relatively new to TypeScript, but I really wanted to contribute to the project as it is one of my favorite plugins. Please let me know if there is anything you'd like me to change or improve! I hope to contribute more soon!

kipuki added 11 commits April 9, 2025 05:44
Added a TextInputModal that extends ConfirmModal to allow for text input.
This was done to prevent new settings keys from being unset as it happened with defaultSearchQuery.
Settings name for query fit as keywords fit more.
Change theme page and auto-fetch audio now use the currently set default search keywords. This change required that some refactoring be done. searchTerm state had to be lifted to the parent for better control.
Beginner mistake. Resolver could not fetch the settings because the useSettings() hook was being called from within a class function. It has now been restructured to allow the keyword to be passed through the getAudio() function.
Removed an unnecessary call to customSearch() where the search would've been peformed twice.

Renamed setInitialSearch() to defaultSearch() as the name was more clear.
@kipuki
kipuki marked this pull request as ready for review April 12, 2025 04:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant