feat(widgets): attribution on every widget, and make it legible

Five of the seven standalone widgets and all three placeholder cards
carried no attribution at all, and where it did render it was font-size 9
at opacity 0.5 (about 2.1:1 contrast) at the bottom of a 1500px card. Each
embedded widget sits on a public profile and is the only organic
acquisition surface we have.

Shared helper so the styling can't drift again. font-size 10, opacity
0.75 (about 3.1:1), still using the theme's text_secondary so it stays
roughly 4x fainter than the user's own content. Composite output is
byte-identical in size; four standalone cards grow 16px where the footer
would otherwise collide with existing content.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
This commit is contained in:
shay
2026-08-22 16:10:26 -07:00
co-authored by Claude Opus 5
parent 06ab1c878e
commit 769cde552d
11 changed files with 150 additions and 23 deletions
+7 -1
View File
@@ -3,6 +3,7 @@
from ..models import ImpactWeek
from ..themes import THEMES
from ..utils import card_wrapper, safe_color
from .attribution import FOOTER_H, attribution_text
def render_impact_widget(weeks: list[ImpactWeek], theme_name: str = "dark", period: str = "6mo", settings: dict | None = None) -> str:
@@ -14,7 +15,9 @@ def render_impact_widget(weeks: list[ImpactWeek], theme_name: str = "dark", peri
t = THEMES[theme_name]
s = settings or {}
line_color = safe_color(s.get("line_color"), t["accent"])
w, h = 380, 200
# The summary block already ends ~12px above the card edge, which the
# footer would sit on top of, so reserve FOOTER_H for it.
w, h = 380, 200 + FOOTER_H
chart_x, chart_y = 40, 8
chart_w, chart_h = 316, 82
@@ -31,6 +34,7 @@ def render_impact_widget(weeks: list[ImpactWeek], theme_name: str = "dark", peri
<text x="0" y="14" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
font-size="9" fill="{t["text_secondary"]}">commits over {period}</text>
</g>'''
inner += attribution_text(t, 190, h - 36 - 8)
return card_wrapper(inner, w, h, t, "Impact Timeline")
max_commits = max((wk.commits for wk in weeks), default=1) or 1
@@ -92,4 +96,6 @@ def render_impact_widget(weeks: list[ImpactWeek], theme_name: str = "dark", peri
font-size="9" fill="{t["text_secondary"]}">commits over {period}</text>
</g>'''
inner += attribution_text(t, 190, h - 36 - 8)
return card_wrapper(inner, w, h, t, "Impact Timeline")