mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
feat: fix sparkline calculation, redesign with domain colors, add post-graph
- Fix sparkline downward trend by extrapolating partial current month - Redesign sparkline SVG with gradient fill and responsive sizing - Apply domain-specific colors (amber/rose/emerald/purple) via currentColor - Add eleventy-plugin-post-graph for GitHub-style contribution grids - Homepage: posting activity graph in Tier 2 default layout - AI page (/ai/): stats dashboard + AI-involved posts graph injected via layout - New filters: aiPosts (filter by AI level), aiStats (total/count/percentage) Confab-Link: http://localhost:8080/sessions/956f4251-b4a9-4bc9-b214-53402ad1fe63
This commit is contained in:
@@ -106,6 +106,14 @@ withSidebar: true
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{# Posting Activity — contribution graph #}
|
||||
{% if collections.posts and collections.posts.length %}
|
||||
<section class="mb-8 sm:mb-12">
|
||||
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6">Posting Activity</h2>
|
||||
{% postGraph collections.posts %}
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{# Explore — quick links to key sections #}
|
||||
<section class="mb-8 sm:mb-12">
|
||||
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6">Explore</h2>
|
||||
|
||||
@@ -26,6 +26,54 @@ withSidebar: true
|
||||
{{ content | safe }}
|
||||
</div>
|
||||
|
||||
{# AI post-graph — shown only on the /ai/ page #}
|
||||
{% if page.url == "/ai/" and collections.posts %}
|
||||
{% set stats = collections.posts | aiStats %}
|
||||
{% set aiPostsList = collections.posts | aiPosts %}
|
||||
<section class="mt-8 sm:mt-12 p-6 rounded-xl bg-surface-50 dark:bg-surface-800/50 border border-surface-200 dark:border-surface-700">
|
||||
<h2 class="text-xl font-bold text-surface-900 dark:text-surface-100 mb-4">AI Usage Across Posts</h2>
|
||||
<div class="grid gap-4 sm:grid-cols-4 mb-6">
|
||||
<div class="text-center p-3 rounded-lg bg-white dark:bg-surface-800 border border-surface-200 dark:border-surface-700">
|
||||
<div class="text-2xl font-bold text-surface-900 dark:text-surface-100">{{ stats.total }}</div>
|
||||
<div class="text-xs text-surface-500 dark:text-surface-400">Total posts</div>
|
||||
</div>
|
||||
<div class="text-center p-3 rounded-lg bg-white dark:bg-surface-800 border border-surface-200 dark:border-surface-700">
|
||||
<div class="text-2xl font-bold text-amber-600 dark:text-amber-400">{{ stats.aiCount }}</div>
|
||||
<div class="text-xs text-surface-500 dark:text-surface-400">AI-involved</div>
|
||||
</div>
|
||||
<div class="text-center p-3 rounded-lg bg-white dark:bg-surface-800 border border-surface-200 dark:border-surface-700">
|
||||
<div class="text-2xl font-bold text-emerald-600 dark:text-emerald-400">{{ stats.total - stats.aiCount }}</div>
|
||||
<div class="text-xs text-surface-500 dark:text-surface-400">Human-only</div>
|
||||
</div>
|
||||
<div class="text-center p-3 rounded-lg bg-white dark:bg-surface-800 border border-surface-200 dark:border-surface-700">
|
||||
<div class="text-2xl font-bold text-surface-900 dark:text-surface-100">{{ stats.percentage }}%</div>
|
||||
<div class="text-xs text-surface-500 dark:text-surface-400">AI ratio</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Breakdown by level #}
|
||||
<div class="flex flex-wrap gap-3 text-sm mb-6">
|
||||
<span class="px-3 py-1 rounded-full bg-surface-100 dark:bg-surface-700 text-surface-600 dark:text-surface-300">
|
||||
Level 0 (None): {{ stats.byLevel[0] }}
|
||||
</span>
|
||||
<span class="px-3 py-1 rounded-full bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300">
|
||||
Level 1 (Editorial): {{ stats.byLevel[1] }}
|
||||
</span>
|
||||
<span class="px-3 py-1 rounded-full bg-amber-100 dark:bg-amber-900/40 text-amber-800 dark:text-amber-200">
|
||||
Level 2 (Co-drafted): {{ stats.byLevel[2] }}
|
||||
</span>
|
||||
<span class="px-3 py-1 rounded-full bg-amber-200 dark:bg-amber-900/60 text-amber-900 dark:text-amber-100">
|
||||
Level 3 (AI-generated): {{ stats.byLevel[3] }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{# Post graph showing AI posts (highlighted) on the full year grid #}
|
||||
<h3 class="text-lg font-semibold text-surface-900 dark:text-surface-100 mb-3">AI-Involved Posts Over Time</h3>
|
||||
<p class="text-sm text-surface-500 dark:text-surface-400 mb-4">Highlighted days had posts with AI involvement (level 1+). Empty boxes represent days with no AI-involved posts.</p>
|
||||
{% postGraph aiPostsList, { prefix: "ai", highlightColorLight: "#d97706", highlightColorDark: "#fbbf24" } %}
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{# AI usage disclosure #}
|
||||
{% set aiTextLevel = aiTextLevel or ai_text_level %}
|
||||
{% set aiCodeLevel = aiCodeLevel or ai_code_level %}
|
||||
|
||||
Reference in New Issue
Block a user