1
0
mirror of https://github.com/avinal/avinal.github.io.git synced 2026-07-03 23:30:09 +05:30

feat: add contributions page

Assisted by Claude Code

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
2026-05-02 18:17:37 +05:30
parent 5fa9a10203
commit 99f3fb5ec8
2 changed files with 1638 additions and 0 deletions
File diff suppressed because it is too large Load Diff
+606
View File
@@ -0,0 +1,606 @@
---
import BaseLayout from "@/layouts/BaseLayout.astro";
import contribData from "@/data/contributions.json";
interface Contribution {
project: string;
projectUrl: string;
platform: string;
type: string;
kind: string;
title: string;
url: string;
date: string;
status?: string;
description?: string;
relatedIssue?: string;
}
const contributions = (contribData as Contribution[]).sort(
(a, b) => new Date(b.date).getTime() - new Date(a.date).getTime(),
);
const totalCount = contributions.length;
const projects = [...new Set(contributions.map((c) => c.project))];
const types = [...new Set(contributions.map((c) => c.type))];
const kinds = [...new Set(contributions.map((c) => c.kind))];
const platforms = [...new Set(contributions.map((c) => c.platform))];
const mergedCount = contributions.filter((c) => c.status === "merged").length;
function fmtDate(iso: string) {
const d = new Date(iso);
return `${d.getDate()} ${d.toLocaleString("en-US", { month: "short" })} ${d.getFullYear()}`;
}
const typeLabels: Record<string, string> = {
code: "Code",
docs: "Docs",
infra: "Infra",
};
const kindLabels: Record<string, string> = {
pr: "PR",
issue: "Issue",
commit: "Commit",
patch: "Patch",
};
const statusColors: Record<string, string> = {
merged: "badge-merged",
open: "badge-open",
closed: "badge-closed",
};
const platformIcons: Record<string, string> = {
github: `<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"/>`,
gitlab: `<path d="M22.65 14.39L12 22.13 1.35 14.39a.84.84 0 0 1-.3-.94l1.22-3.78 2.44-7.51A.42.42 0 0 1 4.82 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.49h8.1l2.44-7.51A.42.42 0 0 1 18.6 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.51L23 13.45a.84.84 0 0 1-.35.94z"/>`,
sourceware: `<circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>`,
gerrit: `<path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/>`,
other: `<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>`,
};
function platformIcon(p: string): string {
return platformIcons[p] ?? platformIcons.other;
}
const collectionLd = {
"@context": "https://schema.org",
"@type": "CollectionPage",
name: "Open Source Contributions",
description: "Open source contributions across GitHub, GitLab, Sourceware, and other platforms.",
url: "https://avinal.space/contributions",
author: {
"@type": "Person",
name: "Avinal Kumar",
url: "https://avinal.space",
},
};
---
<BaseLayout
title="Contributions"
description="Open source contributions across GitHub, GitLab, Sourceware, and other platforms"
jsonLd={collectionLd}
>
<div class="contrib-page">
<header class="contrib-header">
<h1>Contributions</h1>
<p class="contrib-desc">
A curated selection of my open source contributions across projects and platforms. This list represents only a portion of my overall work — PRs, patches, commits, and issues that I consider meaningful.
</p>
</header>
<div class="stats-bar" id="stats-bar">
<div class="stat stat-contributions">
<svg class="stat-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><line x1="1.05" y1="12" x2="7" y2="12"/><line x1="17.01" y1="12" x2="22.96" y2="12"/></svg>
<span class="stat-value" id="stat-showing">{totalCount}</span>
<span class="stat-label">contributions</span>
</div>
<div class="stat stat-projects">
<svg class="stat-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>
<span class="stat-value">{projects.length}</span>
<span class="stat-label">projects</span>
</div>
<div class="stat stat-merged">
<svg class="stat-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/></svg>
<span class="stat-value">{mergedCount}</span>
<span class="stat-label">merged</span>
</div>
<div class="stat stat-platforms">
<svg class="stat-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>
<span class="stat-value">{platforms.length}</span>
<span class="stat-label">platforms</span>
</div>
</div>
<div class="filter-bar" id="filter-bar">
<select class="filter-select" data-filter="project" aria-label="Filter by project">
<option value="">All projects</option>
{projects.sort().map((p) => (
<option value={p}>{p}</option>
))}
</select>
<select class="filter-select" data-filter="type" aria-label="Filter by type">
<option value="">All types</option>
{types.map((t) => (
<option value={t}>{typeLabels[t] ?? t}</option>
))}
</select>
<select class="filter-select" data-filter="kind" aria-label="Filter by kind">
<option value="">All kinds</option>
{kinds.map((k) => (
<option value={k}>{kindLabels[k] ?? k}</option>
))}
</select>
<select class="filter-select" data-filter="platform" aria-label="Filter by platform">
<option value="">All platforms</option>
{platforms.map((p) => (
<option value={p}>{p}</option>
))}
</select>
<button class="filter-clear" id="clear-filters" style="display:none;">Clear</button>
</div>
<div class="timeline" id="timeline">
{contributions.map((c) => (
<div
class={`tl-entry ct-${c.type}`}
data-project={c.project}
data-type={c.type}
data-kind={c.kind}
data-platform={c.platform}
>
<div class="tl-label-cell">
<span class="tl-type-label">{typeLabels[c.type] ?? c.type}</span>
</div>
<div class="tl-rail-cell">
<div class="tl-dot" />
</div>
<div class="tl-card">
<div class="tl-card-header">
<div class="tl-dates">
{fmtDate(c.date)}
<span class="tl-platform">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><Fragment set:html={platformIcon(c.platform)} /></svg>
<a href={c.projectUrl} class="project-link" target="_blank" rel="noopener noreferrer">{c.project}</a>
</span>
</div>
<h3 class="tl-title">
<a href={c.url} class="contrib-link" target="_blank" rel="noopener noreferrer">{c.title}</a>
</h3>
</div>
<div class="badge-row">
{c.status && (
<span class={`badge ${statusColors[c.status] ?? ""}`}>{c.status}</span>
)}
<span class="badge badge-kind">{kindLabels[c.kind] ?? c.kind}</span>
</div>
{c.description && <p class="contrib-description">{c.description}</p>}
{c.relatedIssue && (
<a href={c.relatedIssue} class="related-issue-link" target="_blank" rel="noopener noreferrer">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
Related issue
</a>
)}
</div>
</div>
))}
</div>
<p class="empty-state" id="empty-state" style="display:none;">
No contributions match the current filters.
</p>
</div>
</BaseLayout>
<style>
.contrib-page {
max-width: var(--max-w-page);
margin-inline: auto;
}
.contrib-header {
margin-bottom: var(--space-8);
}
.contrib-header h1 {
margin-bottom: var(--space-3);
}
.contrib-desc {
font-size: var(--text-lg);
color: var(--text-secondary);
line-height: var(--leading-relaxed);
max-width: var(--max-w-prose);
}
/* ---- Stats ---- */
.stats-bar {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: var(--space-3);
margin-bottom: var(--space-6);
}
.stat {
display: flex;
flex-direction: column;
align-items: center;
gap: var(--space-2);
padding: var(--space-4) var(--space-3);
border: 1px solid var(--border);
background: var(--bg-surface);
transition: border-color var(--duration-fast) var(--ease-out),
box-shadow var(--duration-fast) var(--ease-out);
}
.stat:hover {
border-color: var(--stat-color);
box-shadow: var(--shadow);
}
.stat-icon {
opacity: 0.4;
transition: opacity var(--duration-fast) var(--ease-out),
color var(--duration-fast) var(--ease-out);
}
.stat:hover .stat-icon {
opacity: 1;
color: var(--stat-color);
}
.stat-contributions { --stat-color: var(--accent); }
.stat-projects { --stat-color: #8b5cf6; }
.stat-merged { --stat-color: #10b981; }
.stat-platforms { --stat-color: #f59e0b; }
.stat-value {
font-size: var(--text-2xl);
font-weight: 800;
font-variant-numeric: tabular-nums;
color: var(--text);
line-height: 1;
transition: color var(--duration-fast) var(--ease-out);
}
.stat:hover .stat-value {
color: var(--stat-color);
}
.stat-label {
font-size: var(--text-xs);
font-weight: 500;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.06em;
}
/* ---- Filters ---- */
.filter-bar {
display: flex;
align-items: center;
gap: var(--space-3);
flex-wrap: wrap;
margin-bottom: var(--space-8);
}
.filter-select {
font-family: inherit;
font-size: var(--text-sm);
font-weight: 500;
color: var(--text-secondary);
background: var(--bg-surface);
border: 1px solid var(--border);
padding: var(--space-2) var(--space-3);
padding-right: var(--space-6);
cursor: pointer;
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 8px center;
transition: border-color var(--duration-fast) var(--ease-out);
}
.filter-select:hover,
.filter-select:focus-visible {
border-color: var(--accent);
outline: none;
}
.filter-select.has-value {
color: var(--text);
border-color: var(--accent);
}
.filter-clear {
font-family: inherit;
font-size: var(--text-xs);
font-weight: 500;
color: var(--text-muted);
background: transparent;
border: 1px solid var(--border);
padding: var(--space-2) var(--space-3);
cursor: pointer;
transition: all var(--duration-fast) var(--ease-out);
}
.filter-clear:hover {
color: var(--text);
border-color: var(--text-muted);
}
/* ---- Timeline ---- */
.timeline {
display: flex;
flex-direction: column;
gap: var(--space-1);
position: relative;
}
.tl-entry {
display: grid;
grid-template-columns: 64px 24px 1fr;
gap: 0 var(--space-2);
position: relative;
}
.tl-entry[data-hidden] {
display: none;
}
.tl-label-cell {
display: flex;
align-items: flex-start;
justify-content: flex-end;
padding-top: var(--space-5);
padding-right: var(--space-2);
}
.tl-type-label {
font-size: 9px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
white-space: nowrap;
}
.ct-code .tl-type-label { color: var(--accent); }
.ct-docs .tl-type-label { color: #10b981; }
.ct-infra .tl-type-label { color: #f59e0b; }
.tl-rail-cell {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.tl-dot {
width: 12px;
height: 12px;
border-radius: 50%;
border: 2px solid var(--accent);
background: var(--bg);
position: relative;
z-index: 2;
margin-top: var(--space-5);
flex-shrink: 0;
}
.ct-code .tl-dot { border-color: var(--accent); }
.ct-docs .tl-dot { border-color: #10b981; }
.ct-infra .tl-dot { border-color: #f59e0b; }
.tl-rail-cell::after {
content: "";
position: absolute;
top: calc(var(--space-5) + 12px);
bottom: 0;
left: 50%;
width: 2px;
background: var(--border);
transform: translateX(-50%);
z-index: 1;
}
.tl-entry:last-child .tl-rail-cell::after { display: none; }
.tl-card {
padding: var(--space-4) var(--space-5);
border: 1px solid var(--border);
background: var(--bg-surface);
transition: border-color var(--duration-fast) var(--ease-out),
box-shadow var(--duration-fast) var(--ease-out);
}
.tl-card:hover {
border-color: var(--border-strong);
box-shadow: var(--shadow);
}
.tl-dates {
display: flex;
align-items: center;
gap: var(--space-3);
font-size: var(--text-xs);
font-weight: 500;
color: var(--text-muted);
margin-bottom: var(--space-1);
font-variant-numeric: tabular-nums;
flex-wrap: wrap;
}
.tl-platform {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: var(--text-xs);
color: var(--text-muted);
}
.project-link {
color: var(--text-muted);
text-decoration: none;
transition: color var(--duration-fast) var(--ease-out);
}
.project-link:hover {
color: var(--accent);
}
.tl-title {
font-size: var(--text-base);
font-weight: 600;
margin-bottom: var(--space-2);
}
.contrib-link {
color: var(--text);
text-decoration: none;
transition: color var(--duration-fast) var(--ease-out);
}
.contrib-link:hover {
color: var(--accent);
}
.badge-row {
display: flex;
gap: var(--space-2);
margin-bottom: var(--space-2);
}
.badge {
display: inline-flex;
align-items: center;
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
padding: 2px var(--space-2);
border: 1px solid var(--border);
color: var(--text-muted);
}
.badge-merged {
color: #10b981;
border-color: #10b981;
background: color-mix(in srgb, #10b981 10%, transparent);
}
.badge-open {
color: #f59e0b;
border-color: #f59e0b;
background: color-mix(in srgb, #f59e0b 10%, transparent);
}
.badge-closed {
color: var(--text-muted);
border-color: var(--border);
background: var(--bg-surface);
}
.badge-kind {
color: var(--text-secondary);
}
.contrib-description {
font-size: var(--text-sm);
color: var(--text-secondary);
line-height: var(--leading-relaxed);
}
.related-issue-link {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: var(--text-xs);
font-weight: 500;
color: var(--text-muted);
text-decoration: none;
transition: color var(--duration-fast) var(--ease-out);
}
.related-issue-link:hover {
color: var(--accent);
}
.empty-state {
text-align: center;
padding: var(--space-10) 0;
font-size: var(--text-lg);
color: var(--text-muted);
}
/* ---- Responsive ---- */
@media (max-width: 768px) {
.stats-bar {
grid-template-columns: repeat(2, 1fr);
}
.tl-entry {
grid-template-columns: 48px 16px 1fr;
}
.tl-type-label { font-size: 8px; }
.tl-dot {
width: 10px;
height: 10px;
}
.tl-dates {
flex-direction: column;
align-items: flex-start;
gap: var(--space-1);
}
}
</style>
<script>
const selects = document.querySelectorAll<HTMLSelectElement>(".filter-select");
const entries = document.querySelectorAll<HTMLElement>(".tl-entry[data-project]");
const clearBtn = document.getElementById("clear-filters") as HTMLButtonElement;
const showingStat = document.getElementById("stat-showing");
const emptyState = document.getElementById("empty-state");
const timeline = document.getElementById("timeline");
function applyFilters() {
const filters: Record<string, string> = {};
selects.forEach((s) => {
if (s.value) filters[s.dataset.filter!] = s.value;
s.classList.toggle("has-value", !!s.value);
});
let visible = 0;
entries.forEach((el) => {
const match = Object.entries(filters).every(
([dim, val]) => el.dataset[dim] === val,
);
if (match) {
el.removeAttribute("data-hidden");
visible++;
} else {
el.setAttribute("data-hidden", "");
}
});
if (showingStat) showingStat.textContent = String(visible);
if (emptyState) emptyState.style.display = visible === 0 ? "" : "none";
if (timeline) timeline.style.display = visible === 0 ? "none" : "";
if (clearBtn) clearBtn.style.display = Object.keys(filters).length > 0 ? "" : "none";
}
selects.forEach((s) => s.addEventListener("change", applyFilters));
if (clearBtn) {
clearBtn.addEventListener("click", () => {
selects.forEach((s) => { s.value = ""; s.classList.remove("has-value"); });
applyFilters();
});
}
</script>