"""Placeholder SVG renderer — three variants for unknown / rate-limited / not-found users. Uses the same card wrapper + theme system as real widgets so they look consistent. """ from .themes.themes import THEMES from .utils.svg_helpers import card_wrapper, escape from .widgets.attribution import attribution_text _MESSAGES = { "building": ("Building @{u}'s widget\u2026", "This usually takes under a minute."), "rate_limited": ("Too many new users today", "Try again tomorrow."), "not_found": ("GitHub user @{u} doesn't exist", "Check the spelling of the username."), } def render(variant: str, username: str, theme: str = "dark") -> str: if variant not in _MESSAGES: raise ValueError(f"unknown placeholder variant: {variant}") title_tpl, subtitle = _MESSAGES[variant] title = title_tpl.format(u=username) palette = THEMES.get(theme, THEMES["dark"]) inner = ( f'{escape(title)}' f'{escape(subtitle)}' # The card is 120 tall and the subtitle ends around y=85, so the # footer fits inside the existing bottom padding. + attribution_text(palette, 200, 112, 0) ) return card_wrapper(inner, width=400, height=120, theme=palette)