Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function baseHTML(title: string, content: string, cssPath: string = "styles.css"
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${escapeHTML(title)}</title>
<link rel="icon" type="image/svg+xml" href="${basePath}vortex_logo.svg">
<link rel="stylesheet" href="${cssPath}">
<script>${THEME_SCRIPT}</script>
</head>
Expand Down Expand Up @@ -110,16 +111,32 @@ function escapeHTML(str: string): string {
.replace(/"/g, "&quot;");
}

function indexPage(rfcs: RFC[], liveReload: boolean = false): string {
const sorted = [...rfcs].sort((a, b) => a.number.localeCompare(b.number));
function indexPage(rfcs: RFC[], repoUrl: string | null, liveReload: boolean = false): string {
// Sort in reverse numeric order (newest first)
const sorted = [...rfcs].sort((a, b) => b.number.localeCompare(a.number));

const list = sorted.map(rfc => {
const dateStr = rfc.git.accepted ? formatDate(rfc.git.accepted.date) : "";

let authorHTML = "";
if (rfc.git.author && rfc.git.accepted) {
const commitUrl = repoUrl ? `${repoUrl}/commit/${rfc.git.accepted.hash}` : `https://github.com/${rfc.git.author.login}`;
authorHTML = `
<a href="${commitUrl}" class="rfc-author-link" title="${rfc.git.author.login}">
<img src="${rfc.git.author.avatarUrl}" alt="${rfc.git.author.login}" class="rfc-author-avatar">
<span class="rfc-author-name">${rfc.git.author.login}</span>
</a>`;
}

const list = sorted.map(rfc => `
return `
<li>
<a href="rfc/${rfc.number}.html" class="rfc-item">
<span class="rfc-number">RFC ${rfc.number}</span>
<span class="rfc-title">${escapeHTML(rfc.title)}</span>
</a>
</li>`).join("\n");
<span class="rfc-date">${dateStr}</span>
</a>${authorHTML}
</li>`;
}).join("\n");

const content = `
<h1>Request for Comments</h1>
Expand Down Expand Up @@ -374,7 +391,7 @@ async function build(liveReload: boolean = false): Promise<number> {
}

// Generate index page
const indexHTML = indexPage(rfcs, liveReload);
const indexHTML = indexPage(rfcs, repoUrl, liveReload);
await Bun.write("dist/index.html", indexHTML);
console.log("Generated dist/index.html");

Expand Down
68 changes: 59 additions & 9 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,32 @@ th {
}

.rfc-list li {
border-bottom: 1px solid var(--border);
margin-bottom: 0;
display: flex;
align-items: center;
gap: 1rem;
padding: 0.75rem 1rem;
margin: 0 -1rem;
border-radius: 4px;
transition: box-shadow 0.15s ease, background 0.15s ease;
}

.rfc-list li:hover {
background: var(--bg-alt);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rfc-list li:last-child {
border-bottom: none;
:root[data-theme="dark"] .rfc-list li:hover {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.rfc-item {
display: block;
padding: 1rem 0;
display: flex;
align-items: center;
gap: 1rem;
flex: 1;
text-decoration: none;
color: var(--fg);
transition: background 0.1s ease;
min-width: 0;
}

.rfc-item:hover {
Expand All @@ -262,12 +274,50 @@ th {
.rfc-item .rfc-number {
color: var(--fg-muted);
font-size: 0.875rem;
flex-shrink: 0;
width: 5rem;
}

.rfc-item .rfc-title {
display: block;
font-weight: 500;
margin-top: 0.25rem;
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.rfc-item .rfc-date {
color: var(--fg-muted);
font-size: 0.875rem;
flex-shrink: 0;
}

.rfc-author-link {
display: flex;
align-items: center;
gap: 0.5rem;
color: var(--fg-muted);
text-decoration: none;
flex-shrink: 0;
}

.rfc-author-link:hover {
color: var(--link);
}

.rfc-author-link:hover .rfc-author-name {
text-decoration: underline;
}

.rfc-author-avatar {
width: 24px;
height: 24px;
border-radius: 50%;
}

.rfc-author-name {
font-size: 0.875rem;
}

/* RFC page specific */
Expand Down