Something went wrong. Try again.
Blog Built with AT Protocol skiddle.id
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254---import Shell from '../layouts/shell.astro';import type { Project } from '../types/projects';import projects from '../data/projects';
export const prerender = true;// Sort projects by year (descending). Items without year go last.const sortedProjects: Project[] = [...projects].sort((a, b) => (b.year ?? 0) - (a.year ?? 0));// Devicon alias mapping to improve CDN resolutionconst deviconAliases: Record<string, string> = { js: 'javascript', ts: 'typescript', node: 'nodejs', 'cloudflare workers': 'cloudflareworkers', 'cloudflare-workers': 'cloudflareworkers', githubactions: 'githubactions', hono: 'hono', // no devicon; handled by fallbacks turso: 'turso', // no devicon; handled by fallbacks libsql: 'libsql', // no devicon; handled by fallbacks};function iconKey(raw: string) { const k = String(raw).toLowerCase(); return deviconAliases[k] ?? k;}function simpleSlug(raw: string) { return String(raw).toLowerCase().replace(/[^a-z0-9]/g, '');}function statusClass(status?: string) { const base = 'px-2 py-0.5 text-xs border rounded-full'; if (!status) return `${base} border-muted text-[var(--color-white)]/70`; const s = status.toLowerCase(); if (s === 'completed') return `${base} border-[color:#16a34a]/40 text-[color:#22c55e]`; // green if (s === 'in-progress') return `${base} border-[color:#f59e0b]/40 text-[color:#fbbf24]`; // amber if (s === 'in-services') return `${base} border-[color:#06b6d4]/40 text-[color:#22d3ee]`; // cyan if (s === 'archived') return `${base} border-[color:#6b7280]/40 text-[color:#9ca3af]`; // gray return `${base} border-muted text-[var(--color-white)]/70`;}function formatCategory(cat?: string) { if (!cat) return ''; return cat.slice(0,1).toUpperCase() + cat.slice(1);}---<Shell title="Projects — Open Source" description="A curated list of my open‑source projects with links to repos and demos."> <section class="flex flex-col gap-4 md:gap-6 px-4 sm:px-5 md:px-0"> <p class="max-w-[70ch] text-[color:var(--color-white)]/90"> Explore my open‑source work. Contributions and feedback are welcome! </p>
<!-- Filters --> {(() => { const categories = Array.from(new Set(sortedProjects.map(p => p.category).filter(Boolean))); const techstack = Array.from(new Set(sortedProjects.flatMap(p => [ ...(p.tech?.languages ?? []), ...(p.tech?.frameworks ?? []), ...(p.tech?.tools ?? []), ...(p.tech?.platforms ?? []), ...(p.tech?.databases ?? []), ]).map(String))); return ( <div class="flex flex-col gap-3"> <div class="flex items-center gap-2 flex-nowrap overflow-x-auto whitespace-nowrap pr-2 -mx-1 px-1 [-ms-overflow-style:none] [scrollbar-width:none]" style="scrollbar-width: none;"> <span class="text-xs text-[var(--color-white)]/60">Category:</span> <button class="filter-cat px-3 py-1 text-[13px] md:text-xs md:py-0.5 border border-muted rounded-full text-[var(--color-white)]/80" data-cat="all" aria-pressed="true">All</button> {categories.map(cat => ( <button class="filter-cat px-3 py-1 text-[13px] md:text-xs md:py-0.5 border border-muted rounded-full text-[var(--color-white)]/70" data-cat={String(cat)} aria-pressed="false">{formatCategory(String(cat))}</button> ))} </div> <div class="flex items-center gap-2"> <label for="tech-select" class="text-xs text-[var(--color-white)]/60">Tech:</label> <select id="tech-select" class="appearance-none bg-white text-black border border-muted rounded px-2 py-1 text-xs focus:outline-none focus:border-[var(--color-primary)]"> <option value="all">All</option> {techstack.map(l => ( <option value={String(l)}>{String(l)}</option> ))} </select> </div> </div> ); })()}
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2 md:gap-3"> {sortedProjects.map((p: Project) => ( <article data-category={p.category ?? ''} data-langs={[ ...(p.tech?.languages ?? []), ...(p.tech?.frameworks ?? []), ...(p.tech?.tools ?? []), ...(p.tech?.platforms ?? []), ...(p.tech?.databases ?? []), ].join(',')} class={`project-card border rounded-lg p-2 md:p-3 flex flex-col gap-2 md:gap-3 bg-[color:oklch(var(--color-gray)_/_0.15)] transition-colors hover:border-[var(--color-base03)] hover:outline outline-1 outline-offset-2 outline-[color:var(--color-base03)]/20 ${p.featured ? 'border-[color:gold]/40' : 'border-muted'}` }> <header class="flex flex-col sm:flex-row sm:items-center justify-between gap-2 md:gap-3"> <div class="flex items-center gap-2 flex-wrap"> {(() => { const href = p.homepage ?? p.github; return href ? ( <a href={href} target="_blank" rel="noopener noreferrer" class="font-semibold text-[var(--color-primary)] hover:underline underline-offset-4">{p.name}</a> ) : ( <h2 class="font-semibold text-[var(--color-primary)]">{p.name}</h2> ); })()} {p.featured && ( <span title="Featured" class="px-2 py-0.5 text-xs rounded-full text-[gold] border border-[color:gold]/60">★</span> )} {p.status && (<span class={statusClass(p.status)}>{p.status}</span>)} {p.category && ( <span class="px-2 py-0.5 text-xs border border-muted rounded-full text-[var(--color-white)]/70">{formatCategory(p.category)}</span> )} </div> {p.year && (<span class="px-2 py-0.5 text-xs border border-muted rounded-full text-[var(--color-white)]/80">{p.year}</span>)} </header>
{p.tags && p.tags.length ? ( <div class="flex flex-wrap items-center gap-2 text-xs"> {p.tags.map((t) => ( <span class="px-2 py-0.5 border border-muted rounded-full text-[var(--color-white)]/70">{t}</span> ))} </div> ) : null}
{(() => { const stack = [ ...(p.tech?.languages ?? []), ...(p.tech?.frameworks ?? []), ...(p.tech?.tools ?? []), ...(p.tech?.platforms ?? []), ...(p.tech?.databases ?? []), ]; return stack.length ? ( <div class="flex flex-wrap items-center gap-2 md:gap-3 text-xs" aria-label="Tech stack"> {stack.map((lang) => { const key = iconKey(lang); const orig = `https://cdn.jsdelivr.net/gh/devicons/devicon/icons/${key}/${key}-original.svg`; const plain = `https://cdn.jsdelivr.net/gh/devicons/devicon/icons/${key}/${key}-plain.svg`; const simp = `https://cdn.simpleicons.org/${simpleSlug(key)}`; const local = `/icons/${simpleSlug(key)}.svg`; const fallbacks = [plain, simp, local].join('|'); return ( <img src={orig} data-fallbacks={fallbacks} data-label={String(lang)} title={String(lang)} alt={`${lang} icon`} width="32" height="32" class="w-6 h-6 md:w-8 md:h-8 icon-with-fallback" loading="lazy" /> ); })} </div> ) : null; })()}
<p class="text-sm text-[var(--color-white)]/85 leading-relaxed">{p.description}</p> {p.highlights && p.highlights.length ? ( <ul class="mt-1 ml-4 list-disc text-[var(--color-white)]/75 text-sm"> {p.highlights.map((h) => (<li>{h}</li>))} </ul> ) : null}
<div class="mt-auto flex items-center gap-2 pt-2"> {p.homepage && ( <a class="inline-flex items-center gap-1 rounded-md border border-muted px-3 py-1 text-sm text-[var(--color-primary)] hover:text-base0E hover:border-base0E transition-colors" href={p.homepage} target="_blank" rel="noopener noreferrer"> <span>Live</span> </a> )} {p.github && ( <a class="inline-flex items-center gap-1 rounded-md border border-muted px-3 py-1 text-sm text-[var(--color-primary)] hover:text-base0E hover:border-base0E transition-colors" href={p.github} target="_blank" rel="noopener noreferrer"> <span>Repo</span> </a> )} </div> </article> ))} </div> </section></Shell>
<script> // Simple client-side filters for category and languages const $$ = (s) => Array.from(document.querySelectorAll(s)); function getTechSelect(): HTMLSelectElement | null { const el = document.getElementById('tech-select'); return el instanceof HTMLSelectElement ? el : null; } function applyFilters() { const activeCatBtn = document.querySelector('.filter-cat[aria-pressed="true"]'); const techSelect = getTechSelect(); const activeCat = activeCatBtn?.getAttribute('data-cat') ?? 'all'; const activeLang = techSelect?.value ?? 'all';
$$('.project-card').forEach((card) => { const cat = card.getAttribute('data-category') || ''; const langs = (card.getAttribute('data-langs') || '').toLowerCase().split(',').filter(Boolean); const catOk = activeCat === 'all' || cat === activeCat; const langOk = activeLang === 'all' || langs.includes(String(activeLang).toLowerCase()); card.classList.toggle('hidden', !(catOk && langOk)); }); }
function setExclusivePressed(selector, target) { $$(selector).forEach((btn) => btn.setAttribute('aria-pressed', btn === target ? 'true' : 'false')); }
document.addEventListener('click', (e) => { const target = e.target as Element | null; const btn = target ? (target.closest('.filter-cat, .filter-lang') as HTMLElement | null) : null; if (!btn) return; if (btn.classList.contains('filter-cat')) setExclusivePressed('.filter-cat', btn); applyFilters(); });
document.addEventListener('DOMContentLoaded', applyFilters); const techSelectInit = getTechSelect(); if (techSelectInit) { techSelectInit.addEventListener('change', applyFilters); } function attachIconFallbacks() { document.querySelectorAll('img.icon-with-fallback').forEach((imgEl) => { const img = imgEl as HTMLImageElement; const fallbacks = (img.getAttribute('data-fallbacks') || '').split('|').filter(Boolean); const label = img.getAttribute('data-label') || ''; let idx = 0; function onerr() { if (idx < fallbacks.length) { img.src = fallbacks[idx++]; } else { img.removeEventListener('error', onerr); const monogram = document.createElement('span'); monogram.className = 'inline-flex items-center justify-center w-6 h-6 md:w-8 md:h-8 rounded border border-muted text-[var(--color-white)]/70 text-[10px] md:text-xs'; monogram.textContent = (label.trim()[0] || '?').toUpperCase(); img.replaceWith(monogram); } } img.addEventListener('error', onerr); }); } document.addEventListener('DOMContentLoaded', attachIconFallbacks);</script>
<style is:global> .filter-cat[aria-pressed="true"], .filter-lang[aria-pressed="true"] { background: color-mix(in oklch, var(--color-primary) 18%, transparent); border-color: var(--color-primary); color: var(--color-primary); } .filter-cat, .filter-lang { transition: background-color .15s ease, border-color .15s ease, color .15s ease; } .filter-cat:hover, .filter-lang:hover { border-color: var(--color-primary); color: var(--color-primary); } .filter-cat:focus-visible, .filter-lang:focus-visible { outline: 2px solid color-mix(in oklch, var(--color-primary) 60%, transparent); outline-offset: 2px; border-color: var(--color-primary); }</style>