Add filename search filter to photo gallery - #11
Merged
Merged
Conversation
Adds a debounced filename search box in the app header (next to the Refresh button) that filters RAW files by name substring match. - backend/database.py: add `filename_search` LIKE param to get_photos() and get_photo_count() - backend/main.py: expose `filename_search` query param on /api/photos and /api/photos/count endpoints - frontend/src/hooks/usePhotos.js: include filename_search in buildParams - frontend/src/App.jsx: add debounced search input (300ms) with clear button; filename_search wired into filters state - frontend/src/components/Toolbar.jsx: include filename_search in hasFilters check; support onClearAll prop to also reset search input https://claude.ai/code/session_01Rz1mnmLosnStLBTjSv5Wx4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a filename search feature to the photo gallery, allowing users to filter photos by searching for substrings in their filenames. The search includes a debounced input field with a clear button and integrates seamlessly with existing filters.
Key Changes
Frontend:
filename_searchfilter state to the filters objectuseRefto manage the timeronClearAllcallback for resetting all filters including the search inputusePhotoshook to includefilename_searchin API query parametersBackend:
get_photos()function indatabase.pyto support case-insensitive filename substring search using SQL LIKE with proper escapingget_photo_count()function to apply the same filename filter for accurate count resultsfilename_searchquery parameter to both/photosand/photos/countendpoints inmain.pywith validation (max 255 characters)Implementation Details
%and_) to prevent unintended wildcard matchinghttps://claude.ai/code/session_01Rz1mnmLosnStLBTjSv5Wx4