Add deck synergy suggestions, a responsive deck layout, and undoable library bulk-add
Suggestion scoring is fully offline (tribal/mechanic/archetype/mana-base signals derived at ingest, no external synergy database), with an "unusual picks" mode that surfaces underappreciated cards instead of staples. The deck page's top panels now use a CSS grid so wide windows don't waste horizontal space. Library's bulk add-to-deck can clobber existing deck quantities, so it now offers an undo (snackbar + command palette, the latter with no timeout) that restores each card's prior state exactly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,18 +30,25 @@ function subsequenceMatch(query: string, text: string): boolean {
|
||||
* Alt+/ opens a fuzzy-searchable palette of navigation commands, decks, and
|
||||
* cards. Selecting a deck switches to the Decks tab with it pre-selected;
|
||||
* selecting a card opens the existing click-to-zoom preview modal without
|
||||
* changing tabs.
|
||||
* changing tabs. When an undoable action's grace window hasn't lapsed yet,
|
||||
* an "Undo: …" entry is listed first, so Alt+/ then Enter is a fast way to
|
||||
* undo without hunting for the floating snackbar's button.
|
||||
*/
|
||||
export function CommandPalette({
|
||||
onNavigate,
|
||||
onUpdateCardData,
|
||||
onOpenLibrary,
|
||||
onNewLibrary,
|
||||
undo,
|
||||
onRunUndo,
|
||||
}: {
|
||||
onNavigate: (tab: Tab) => void;
|
||||
onUpdateCardData: () => void;
|
||||
onOpenLibrary: () => void;
|
||||
onNewLibrary: () => void;
|
||||
/** The most recent undoable action, if its window hasn't lapsed yet. */
|
||||
undo: { message: string; run: () => void | Promise<void> } | null;
|
||||
onRunUndo: () => void;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [query, setQuery] = useState("");
|
||||
@@ -83,6 +90,7 @@ export function CommandPalette({
|
||||
}
|
||||
|
||||
const staticCommands: PaletteItem[] = [
|
||||
...(undo ? [{ key: "undo", label: `Undo: ${undo.message}`, run: onRunUndo }] : []),
|
||||
{ key: "nav-add", label: "Go to Add Cards", run: () => onNavigate("add") },
|
||||
{ key: "nav-library", label: "Go to Library", run: () => onNavigate("library") },
|
||||
{ key: "nav-decks", label: "Go to Decks", run: () => onNavigate("decks") },
|
||||
|
||||
Reference in New Issue
Block a user