Add a Card Search tab and fix horizontal-card (Battle/Plane) preview orientation

Card Search browses the whole downloaded card universe (not just owned
cards), reusing the Library tab's filter/group/sort/list/tiles UI; results
show ownership and offer quick "own" and "add to deck" actions.

Battles, Planes, and Phenomena store their Scryfall image portrait-shaped
with the content itself rotated, so hover/click previews now detect this
(a new `horizontal` flag threaded through ingest and every card query, with
graceful fallback for a reference.db built before the column existed) and
rotate the image back into place. Single-faced and non-DFC cases are
verified fixed; a double-faced Battle's front face still needs another pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 20:55:17 -05:00
parent 3c625a9830
commit 2b361c4a85
19 changed files with 1076 additions and 102 deletions

View File

@@ -147,6 +147,14 @@ pub fn search_library(db: Db, filter: LibraryFilter) -> Res<Vec<LibraryCard>> {
s.catalog()?.search_library(&filter).map_err(|e| e.to_string())
}
#[tauri::command]
pub fn search_reference(db: Db, filter: LibraryFilter, limit: usize) -> Res<Vec<LibraryCard>> {
let s = db.lock().unwrap();
s.catalog()?
.search_reference(&filter, limit)
.map_err(|e| e.to_string())
}
#[tauri::command]
pub fn get_library_stats(db: Db) -> Res<LibraryStats> {
let s = db.lock().unwrap();
@@ -159,6 +167,12 @@ pub fn get_library_facets(db: Db) -> Res<LibraryFacets> {
s.catalog()?.library_facets().map_err(|e| e.to_string())
}
#[tauri::command]
pub fn get_reference_facets(db: Db) -> Res<LibraryFacets> {
let s = db.lock().unwrap();
s.catalog()?.reference_facets().map_err(|e| e.to_string())
}
#[tauri::command]
pub fn list_decks(db: Db) -> Res<Vec<Deck>> {
let s = db.lock().unwrap();

View File

@@ -30,8 +30,10 @@ pub fn run() {
commands::set_owned,
commands::set_location,
commands::search_library,
commands::search_reference,
commands::get_library_stats,
commands::get_library_facets,
commands::get_reference_facets,
commands::list_decks,
commands::create_deck,
commands::delete_deck,