"""Render the card deck — gallery of completed thought cards.""" from __future__ import annotations def render_deck(cards: list[dict]) -> str: """Render the card deck as a scrollable gallery.""" if not cards: return """

Your deck is empty. Complete a thought record to add your first card.

""" card_elements = [] for card in reversed(cards[-10:]): # Show last 10, newest first distortions = card.get("distortions", []) tag = distortions[0] if distortions else "—" date = card.get("date", "") thought = card.get("automatic_thought", "")[:40] reframe = card.get("balanced_thought", "")[:40] card_elements.append(f"""
{tag}
{date}
"{thought}..."
→ "{reframe}..."
""") return f"""
🃏 Your Deck ({len(cards)} cards)
{''.join(card_elements)}
"""