From 81ea22ac34ee3a613aecfa858c662f9245cf0812 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Fri, 6 Mar 2026 12:35:40 +0100 Subject: [PATCH] feat: add AI usage homepage section with stats and contribution graph Full-width section for homepage builder showing 4-column stats grid, level breakdown pills, AI-involved post-graph, and link to /ai/ page. Confab-Link: http://localhost:8080/sessions/edb1b7b0-da66-4486-bd9c-d1cfa7553b88 --- _includes/components/homepage-section.njk | 2 + _includes/components/sections/ai-usage.njk | 66 ++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 _includes/components/sections/ai-usage.njk diff --git a/_includes/components/homepage-section.njk b/_includes/components/homepage-section.njk index e7b8ee0..b13070c 100644 --- a/_includes/components/homepage-section.njk +++ b/_includes/components/homepage-section.njk @@ -51,6 +51,8 @@ {% include "components/sections/lastfm.njk" ignore missing %} {% elif section.type == "posting-activity" %} {% include "components/sections/posting-activity.njk" ignore missing %} +{% elif section.type == "ai-usage" %} + {% include "components/sections/ai-usage.njk" ignore missing %} {% else %} {% endif %} diff --git a/_includes/components/sections/ai-usage.njk b/_includes/components/sections/ai-usage.njk new file mode 100644 index 0000000..e407d0e --- /dev/null +++ b/_includes/components/sections/ai-usage.njk @@ -0,0 +1,66 @@ +{# AI Usage Section — full-width AI transparency stats and contribution graph #} +{% set sectionConfig = section.config or {} %} +{% set sectionTitle = sectionConfig.title or "AI Transparency" %} +{% set stats = collections.posts | aiStats %} +{% set aiPostsList = collections.posts | aiPosts %} + +{% if stats and stats.total > 0 %} +
+

+ {{ sectionTitle }} +

+ +
+ {# Stats grid — 4 columns #} +
+
+
{{ stats.total }}
+
Total posts
+
+
+
{{ stats.aiCount }}
+
AI-involved
+
+
+
{{ stats.total - stats.aiCount }}
+
Human-only
+
+
+
{{ stats.percentage }}%
+
AI ratio
+
+
+ + {# Level breakdown #} +
+ + Level 0 (None): {{ stats.byLevel[0] }} + + + Level 1 (Editorial): {{ stats.byLevel[1] }} + + + Level 2 (Co-drafted): {{ stats.byLevel[2] }} + + + Level 3 (AI-generated): {{ stats.byLevel[3] }} + +
+ + {# Post graph — AI-involved posts highlighted #} + {% if aiPostsList and aiPostsList.length %} +

AI-Involved Posts Over Time

+

Highlighted days had posts with AI involvement (level 1+). Empty boxes represent days with no AI-involved posts.

+ {% set graphLimit = sectionConfig.limit or 1 %} + {% postGraph aiPostsList, { prefix: "ai-section", limit: graphLimit, highlightColorLight: "#d97706", highlightColorDark: "#fbbf24" } %} + {% endif %} +
+ + + View full AI transparency report + + + + +
+{% endif %}