Launch Notes: MTG Collection Tracker with Scan-to-Log Workflow

2025-10-07 | 3 min read

Our trade show “cart” experiment just matured into a true Magic: The Gathering collection tracker. You can still scan cards in seconds, but the destination is no longer a checkout list—it is the canonical record of your finishing details, condition notes, acquisition history, and locations. This is the foundation we will use for upcoming profile-backed libraries, analytics, and insurance‑grade exports.

At-a-glance: what shipped

  • Collection-aware context everywhere - the old ScanCartProvider/floating button is gone. A new CollectionProvider keeps state site-wide, exposes a compact "recent additions" tray, and powers both the scanner and the dedicated manager at /collection.
  • Expanded item model - every entry now tracks finish, condition, language, quantity, tags, and a structured acquisition object (pricePaid, currency, acquiredAt, source, location). We keep ISO timestamps (addedAt, updatedAt) so you can diff or export chronologically.
  • Shareable public URLs - /api/collections persists a JSON snapshot under content/collections/*.json and returns an ID. Anyone with the link (/collection?collection=abc123) can open a read-only copy that hydrates into their local tracker.
  • Collection manager UI - /collection lists the entire library with editing controls: adjust finish/condition, set quantities with +/- buttons, log purchase info, drop notes, tags, and quick-link to card pages or TCGplayer price checks.
  • Scanner + quick search rewired - adding from OCR or fast search now routes through useCollection(), populating defaults (near_mint, finish inferred from pricing metadata) and incrementing existing records instead of toggling a foil checkbox.
  • Snapshot sidebar - the scanner page shows a "Collection Snapshot" panel with totals, recent additions, and one-click sharing. It is designed for mobile trade floors where you want a read-only dashboard and a quick link to the full manager.

Update: Compact manager view (2025-10-06)

  • Added a compact row mode toggle at the top of /collection, defaulting to summary rows so even 5,000+ card libraries stay scannable. The legacy layout is still available via the "Expanded rows" option.
  • Each row now shows finish, condition, quantity controls, and valuation inline, with quick access to card/price links. Deeper metadata (language, acquisition history, notes, tags) lives in a collapsible detail grid to reduce vertical sprawl.
  • Collapsed detail state is tracked per card so you can expand only the entries you are actively editing without losing context when navigating around the page.
  • The compact design keeps the same inline styling approach as the rest of the tracker, ensuring trade-show tablets and desktop binders share a consistent editing experience.

Technical deep dive

Data model & storage

  • Replaced ScanCartItem with CollectionItem (lib/collection-types.ts). Important additions: printId, finish, condition, language, acquisition, notes, tags, addedAt, updatedAt.
  • CollectionProvider (formerly ScanCartContext) handles sanitisation, localStorage persistence (takescake-collection), merge semantics, and exposes helpers for every editable field (setFinish, setCondition, setLanguage, setAcquisition, setTags, setQuantity, removeItem, etc.).
  • Share endpoints renamed to /api/collections and /api/collections/[id]. Storage moved from content/scan-carts/* to content/collections/* and gained optional metadata fields.

UI refresh

  • Scanner CTA, quick search buttons, and card detail pages now render AddToCollectionButton. It provides finish toggles, condition selector, quantity field, and calls addItem({ printId, finish, condition, quantity }).
  • CollectionSidebar replaces the cart sidebar with stats, recents, share/load actions, and a link to /collection.
  • RecentCollectionTray floats bottom-right (desktop/tablet) showing the newest entry with an “Open collection” button—fulfilling the “always visible” requirement without the commerce-style cart bubble.
  • Navigation now includes Collection as a first-class destination.

Scanner behaviour changes

  • CardScanner chooses a finish by inspecting tcgcsv subType + pricing availability, then calls addItem with finish, condition: 'near_mint', and a unique composite key (printId + finish).
  • “Add to cart” language, console logging, and foil checkbox logic were removed. All strings now describe the collection tracker.

Compatibility & migration

  • Old localStorage entries under takescake-scan-cart are ignored; users start fresh with the richer schema. Legacy content/scan-carts/*.json files were deleted.
  • API consumers expecting /api/scan-carts should switch to /api/collections.
  • Card pricing helpers (lib/build-collection-pricing.ts) and API responses (/api/cards/versions, /api/cards/scan) now emit CollectionPricing.

What’s next

  1. Authentication + profile-backed persistence so collections follow users across devices without manual sharing.
  2. Smart grouping (decks vs binders), bulk edits, and CSV/portfolio exports.
  3. Alerts for mismatched finishes/conditions when you scan variants we already know about.
  4. Insurance/export bundles that include acquisition history, photos, and valuation snapshots.

Let us know what data points you still track elsewhere—we’re structuring the schema now so we can deliver stable APIs alongside the UI. Happy cataloguing!

Related Posts