Add colorless filters, and make set listings filterable
Colorless There was no way to ask for colorless cards — the colour toggles are a 5-bit WUBRG mask where 0 already means "don't filter by colour", leaving nothing to express "no colours at all". That's exactly what you need to find a colorless commander's card pool. Adds a "C" pip to both colour rows, matching how ColorPips already renders colorless cards, backed by two explicit booleans rather than a sixth bit — a filter mask and a card's real colour mask staying the same shape is worth keeping. The two rows mean different things and both are useful: on the commander row C filters colour *identity*, which is the Commander rule; on the includes row it filters the card's own colours. A card printed colorless can still carry a coloured identity through mana symbols in its text, and it's the identity that bars it from a colorless commander's deck. Set listings News > Releases had its own card path and so couldn't be filtered. A new set_code filter (matched against printings.set_code, already ingested) lets the set browser run through search_reference instead, so every criterion works there identically rather than being reimplemented over a live Scryfall response. That alone would have cost the ability to browse an upcoming set, since search_reference only knows downloaded card data — and upcoming sets are half the point of the tab. So the browser picks a source per set: downloaded data where it exists, with the full filter panel; otherwise Scryfall directly, with the panel hidden and a line explaining why. A panel that silently does nothing would be worse than no panel. The source is decided by an *unfiltered* probe. Keying off whether the current criteria match anything would flip a properly indexed set to "live" the moment a filter excluded everything, dropping the panel exactly when it was in use.
This commit is contained in:
@@ -49,6 +49,9 @@ export function LibraryBrowser({
|
||||
const [text, setText] = useState("");
|
||||
const [commander, setCommander] = useState(0);
|
||||
const [colorsInclude, setColorsInclude] = useState(0);
|
||||
// Colourlessness can't ride in the bitmask — 0 there means "no filter".
|
||||
const [colorlessIdentity, setColorlessIdentity] = useState(false);
|
||||
const [colorlessColors, setColorlessColors] = useState(false);
|
||||
const [cmcMin, setCmcMin] = useState("");
|
||||
const [cmcMax, setCmcMax] = useState("");
|
||||
const [types, setTypes] = useState<string[]>([]);
|
||||
@@ -119,6 +122,8 @@ export function LibraryBrowser({
|
||||
text: text.trim() || null,
|
||||
commander_identity: commander || null,
|
||||
colors_include: colorsInclude || null,
|
||||
colorless_identity: colorlessIdentity,
|
||||
colorless_colors: colorlessColors,
|
||||
cmc_min: cmcMin === "" ? null : Number(cmcMin),
|
||||
cmc_max: cmcMax === "" ? null : Number(cmcMax),
|
||||
types,
|
||||
@@ -137,6 +142,8 @@ export function LibraryBrowser({
|
||||
text,
|
||||
commander,
|
||||
colorsInclude,
|
||||
colorlessIdentity,
|
||||
colorlessColors,
|
||||
cmcMin,
|
||||
cmcMax,
|
||||
types,
|
||||
@@ -538,11 +545,23 @@ export function LibraryBrowser({
|
||||
<div className={`filters-more ${filtersExpanded ? "expanded" : ""}`}>
|
||||
<div className="field">
|
||||
<label>Playable in commander (color identity ⊆)</label>
|
||||
<ColorToggles value={commander} onChange={setCommander} />
|
||||
<ColorToggles
|
||||
value={commander}
|
||||
onChange={setCommander}
|
||||
colorless={colorlessIdentity}
|
||||
onColorlessChange={setColorlessIdentity}
|
||||
colorlessTitle="Colorless commander — only cards with no color identity"
|
||||
/>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label>Includes colors</label>
|
||||
<ColorToggles value={colorsInclude} onChange={setColorsInclude} />
|
||||
<ColorToggles
|
||||
value={colorsInclude}
|
||||
onChange={setColorsInclude}
|
||||
colorless={colorlessColors}
|
||||
onColorlessChange={setColorlessColors}
|
||||
colorlessTitle="Colorless cards only"
|
||||
/>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label>Mana value</label>
|
||||
|
||||
Reference in New Issue
Block a user