1
0
mirror of https://github.com/avinal/avinal.github.io.git synced 2026-07-04 07:40:09 +05:30
Files
avinal.github.io/src/pages/events.astro
T
avinal ef70634b2a feat: add events page and music widget
- add music source from Listenbrainz, easter egg and evets page
- update design of resume page

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
2026-02-26 17:22:08 +05:30

323 lines
9.0 KiB
Plaintext

---
import BaseLayout from "@/layouts/BaseLayout.astro";
import eventsData from "@/data/events.json";
interface EventLink {
label: string;
url: string;
}
interface EventEntry {
name: string;
date: string;
location: string;
role: "speaker" | "attendee" | "organizer" | "mentor";
talk?: string;
description?: string;
blog?: string;
links?: EventLink[];
}
const events = (eventsData as EventEntry[]).sort(
(a, b) => new Date(b.date).getTime() - new Date(a.date).getTime(),
);
function fmtDate(iso: string) {
const d = new Date(iso);
return `${d.getDate()} ${d.toLocaleString("en-US", { month: "short" })} ${d.getFullYear()}`;
}
const roleLabels: Record<string, string> = {
speaker: "Speaker",
attendee: "Attendee",
organizer: "Organizer",
mentor: "Mentor",
};
const linkIcons: Record<string, string> = {
slides: `<rect x="2" y="3" width="20" height="14" rx="2" ry="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>`,
recording: `<polygon points="5 3 19 12 5 21 5 3"/>`,
video: `<polygon points="5 3 19 12 5 21 5 3"/>`,
photos: `<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/>`,
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"/>`,
website: `<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"/>`,
default: `<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/>`,
};
function iconForLabel(label: string): string {
const key = label.toLowerCase();
for (const [k, v] of Object.entries(linkIcons)) {
if (key.includes(k)) return v;
}
return linkIcons.default;
}
---
<BaseLayout title="Events" description="Conferences, meetups, and events attended or spoken at">
<div class="events-page">
<header class="events-header">
<h1>Events</h1>
<p class="events-desc">
Conferences, summits, and meetups I've attended or spoken at.
</p>
</header>
<div class="timeline">
{events.map((ev) => (
<div class={`tl-entry ev-${ev.role}`}>
<div class="tl-label-cell">
<span class="tl-type-label">{roleLabels[ev.role]}</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(ev.date)}
<span class="tl-location">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>
{ev.location}
</span>
</div>
<h3 class="tl-title">{ev.name}</h3>
</div>
{ev.talk && <p class="event-talk">{ev.talk}</p>}
{ev.description && <p class="event-description">{ev.description}</p>}
{((ev.links && ev.links.length > 0) || ev.blog) && (
<div class="event-links">
{ev.links?.map((link) => (
<a href={link.url} class="event-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"><Fragment set:html={iconForLabel(link.label)} /></svg>
{link.label}
</a>
))}
{ev.blog && (
<a href={ev.blog} class="event-link blog-link">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/></svg>
Blog Post
</a>
)}
</div>
)}
</div>
</div>
))}
</div>
</div>
</BaseLayout>
<style>
.events-page {
max-width: var(--max-w-page);
margin-inline: auto;
}
.events-header {
margin-bottom: var(--space-10);
}
.events-header h1 {
margin-bottom: var(--space-3);
}
.events-desc {
font-size: var(--text-lg);
color: var(--text-secondary);
line-height: var(--leading-relaxed);
max-width: var(--max-w-prose);
}
/* ---- 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-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;
}
.ev-speaker .tl-type-label { color: var(--accent); }
.ev-attendee .tl-type-label { color: #10b981; }
.ev-organizer .tl-type-label { color: #f59e0b; }
.ev-mentor .tl-type-label { color: #8b5cf6; }
.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;
}
.ev-speaker .tl-dot { border-color: var(--accent); }
.ev-attendee .tl-dot { border-color: #10b981; }
.ev-organizer .tl-dot { border-color: #f59e0b; }
.ev-mentor .tl-dot { border-color: #8b5cf6; }
.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);
border-radius: var(--radius-md);
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-location {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: var(--text-xs);
color: var(--text-muted);
}
.tl-title {
font-size: var(--text-base);
font-weight: 600;
margin-bottom: var(--space-1);
}
.event-talk {
font-size: var(--text-sm);
font-weight: 500;
font-style: italic;
color: var(--accent);
margin-bottom: var(--space-2);
}
.event-talk::before {
content: "\201C";
}
.event-talk::after {
content: "\201D";
}
.event-description {
font-size: var(--text-sm);
color: var(--text-secondary);
line-height: var(--leading-relaxed);
}
.event-links {
display: flex;
flex-wrap: wrap;
gap: var(--space-3);
margin-top: var(--space-4);
padding-top: var(--space-3);
border-top: 1px solid var(--border);
}
.event-link {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: var(--text-xs);
font-weight: 500;
color: var(--text-muted);
text-decoration: none;
padding: var(--space-1) var(--space-2);
border: 1px solid var(--border);
border-radius: var(--radius-full);
transition: all var(--duration-fast) var(--ease-out);
}
.event-link:hover {
border-color: var(--accent);
color: var(--accent);
background-color: var(--accent-subtle);
}
.blog-link {
color: var(--accent);
border-color: var(--accent);
}
/* ---- Responsive ---- */
@media (max-width: 768px) {
.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>