You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(server): search results page with recipe cards and pictures #828
A low-priority idea from a user (C4rdninj4): a search results page for cook server that shows recipes as cards with their pictures, not just the dropdown under the search box.
Today
The search box in base.html (static/js/search.js) calls GET /api/search?q=… and lists the hits in a dropdown. Each row has a name and a path, nothing else: /api/search (handlers::recipes::search) returns only name and path. Pressing Enter does nothing unless a row is highlighted with the arrow keys, and no page lists all the results.
That works when you know which recipe you want. It's less useful when you're browsing ("something with leeks"), where the picture helps you choose.
Proposal
A GET /search?q=… page that shows the results as the same .recipe-cards the recipe index (recipes.html) uses, picture included when the recipe has one.
Pressing Enter in the search box with no row highlighted opens that page. Maybe also a "See all results" row at the bottom of the dropdown.
The dropdown stays as it is for quick jumps.
Things to keep in mind
Results come from cookcli_core::search::search and are filtered with inside_collection, like /api/search, so the page, the dropdown and cook search all find the same recipes.
Pictures go through /api/static (server/static_files.rs), like the recipe index.
--recipes-only: the page is a recipe read, so it goes in auth::middleware::RECIPE_READS.
The page strings ("N results for …", "No recipes match …") need messages in every locale (tests/locales_test.rs).
cook build web (static mode) has no server to answer /search. It could keep only the dropdown, or render the page in the browser from the search index it already loads.
Tests: a Playwright spec (typing a query and pressing Enter opens the page with cards) and a server integration test through common::with_isolated_config.
Activity
feat(server): search results page with recipe cards and pictures (coo…