Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3de891b200 | ||
|
|
1e7ab57b0a | ||
|
|
31d0a48aaf |
@@ -17,7 +17,6 @@ Case studies distinguish implemented behavior, recorded acceptance, public relea
|
||||
|
||||
## Public tools and experiments
|
||||
|
||||
- [DeepSeek Primetime](https://code.knickqueue.win/publish-bot/DeepSeekPrimetime): Windows pricing/schedule dashboard with a signed policy feed and cache-freshness handling.
|
||||
- [UniClik](https://code.knickqueue.win/publish-bot/UniClik): Windows context-menu interaction utility with isolated input and accessibility work.
|
||||
- [WindowsVolumeSteps](https://code.knickqueue.win/publish-bot/WindowsVolumeSteps): native volume increments with a per-user installer. The public v0.1.1 release is distinct from newer Command Console development.
|
||||
- [ATS native simulator controller](https://code.knickqueue.win/publish-bot/ats-native-fsd): experimental telemetry/geometry control and incident replay in a driving simulator.
|
||||
|
||||
@@ -157,7 +157,6 @@
|
||||
}
|
||||
],
|
||||
"tools": [
|
||||
{"name": "DeepSeek Primetime", "status": "Released · v0.2.0", "description": "A Windows tray utility for pricing and schedule visibility, with a signed policy feed, atomic cache and explicit stale-data behavior.", "url": "https://code.knickqueue.win/publish-bot/DeepSeekPrimetime", "tag": "C# · Python · signed policy"},
|
||||
{"name": "UniClik", "status": "Preview · v0.1.0", "description": "Hold, hover and release for Windows context menus. Input hooks and accessibility probing run separately so slow providers do not block input.", "url": "https://code.knickqueue.win/publish-bot/UniClik", "tag": "C# · Win32 · UI Automation"},
|
||||
{"name": "WindowsVolumeSteps", "status": "Public release · v0.1.1", "description": "Two-point snapping for native Windows volume controls, packaged with a per-user installer. Newer Command Console development has a separate release state.", "url": "https://code.knickqueue.win/publish-bot/WindowsVolumeSteps", "tag": "C++ · Windhawk integration"}
|
||||
],
|
||||
|
||||
+66
-3
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+40
-21
@@ -15,32 +15,51 @@
|
||||
});
|
||||
const list = document.querySelector("[data-public-source]");
|
||||
if (!list) return;
|
||||
// The featured projects and source links are already HTML. This is optional enrichment.
|
||||
// The static links in the homepage are the no-JavaScript fallback. When the public API
|
||||
// answers, the list is rebuilt from the repository list itself, so a project published to
|
||||
// publish-bot appears here on the next page load with no rebuild or deploy.
|
||||
const LABELS = { portfolio: "Portfolio source", "ats-native-fsd": "ATS native simulator controller" };
|
||||
const PAGE = 50, MAX_PAGES = 4;
|
||||
const sameOriginUrl = value => {
|
||||
try { const url = new URL(value, location.origin); return url.origin === location.origin && url.protocol === "https:" ? url.href : null; }
|
||||
catch { return null; }
|
||||
};
|
||||
const stamp = value => {
|
||||
const date = new Date(value);
|
||||
return Number.isNaN(date.valueOf()) ? "" : date.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
||||
};
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), 8000);
|
||||
fetch("/api/v1/users/publish-bot/repos?limit=50&sort=updated", {credentials:"omit",headers:{Accept:"application/json"},signal:controller.signal})
|
||||
.then(response => { if (!response.ok) throw new Error("Public listing unavailable"); return response.json(); })
|
||||
.then(repos => {
|
||||
if (!Array.isArray(repos)) return;
|
||||
const known = new Set([...list.querySelectorAll("a")].map(a => a.dataset.repo));
|
||||
for (const repo of repos) {
|
||||
if (repo.private !== false || repo.empty || repo.name === "repo-relay-test" || known.has(repo.name)) continue;
|
||||
const url = sameOriginUrl(repo.html_url);
|
||||
if (!url) continue;
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.dataset.repo = repo.name;
|
||||
link.append(document.createTextNode(repo.name));
|
||||
const meta = document.createElement("span");
|
||||
meta.textContent = repo.language || "Public repository";
|
||||
link.append(meta);
|
||||
list.append(link);
|
||||
}
|
||||
})
|
||||
.catch(() => { /* Existing source links remain useful when the API is unavailable. */ })
|
||||
const fetchPage = page => fetch(`/api/v1/users/publish-bot/repos?limit=${PAGE}&page=${page}&sort=updated`, { credentials: "omit", headers: { Accept: "application/json" }, signal: controller.signal })
|
||||
.then(response => { if (!response.ok) throw new Error("Public listing unavailable"); return response.json(); });
|
||||
(async () => {
|
||||
const repos = [];
|
||||
for (let page = 1; page <= MAX_PAGES; page++) {
|
||||
const batch = await fetchPage(page);
|
||||
if (!Array.isArray(batch) || batch.length === 0) break;
|
||||
repos.push(...batch);
|
||||
if (batch.length < PAGE) break;
|
||||
}
|
||||
const active = repos
|
||||
.filter(repo => repo.private === false && !repo.empty && !repo.archived)
|
||||
.sort((a, b) => String(b.updated_at).localeCompare(String(a.updated_at)));
|
||||
if (!active.length) return;
|
||||
const rows = document.createDocumentFragment();
|
||||
for (const repo of active) {
|
||||
const url = sameOriginUrl(repo.html_url);
|
||||
if (!url) continue;
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.dataset.repo = repo.name;
|
||||
if (repo.description) link.title = repo.description;
|
||||
link.append(document.createTextNode(LABELS[repo.name] || repo.name));
|
||||
const meta = document.createElement("span");
|
||||
const updated = stamp(repo.updated_at);
|
||||
meta.textContent = [repo.language || "Public repository", updated && `updated ${updated}`].filter(Boolean).join(" · ");
|
||||
link.append(meta);
|
||||
rows.append(link);
|
||||
}
|
||||
if (rows.childElementCount) list.replaceChildren(rows);
|
||||
})().catch(() => { /* Existing source links remain useful when the API is unavailable. */ })
|
||||
.finally(() => clearTimeout(timeout));
|
||||
})();
|
||||
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
/* Showcase additions for the repository homepage. Tokens come from portfolio.css. */
|
||||
.portfolio .showcase-hero{padding:74px 0 8px;max-width:900px}
|
||||
.portfolio .showcase-hero h1{margin-top:22px}
|
||||
.portfolio .stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;margin:38px 0 0;padding:20px 0 0;border-top:1px solid var(--line)}
|
||||
.portfolio .stats div{margin:0}
|
||||
.portfolio .stats dt{font:11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;text-transform:uppercase;letter-spacing:.16em;color:var(--quiet)}
|
||||
.portfolio .stats dd{margin:7px 0 0;font-size:26px;line-height:1.1;letter-spacing:-.03em;color:var(--ink)}
|
||||
.portfolio .repo-label{font:11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;text-transform:uppercase;letter-spacing:.14em;color:var(--quiet)}
|
||||
.portfolio .repo-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:20px 0 14px}
|
||||
.portfolio .repo-search{flex:1 1 260px;min-height:42px;padding:10px 14px;background:var(--surface);border:1px solid var(--line);border-radius:4px;color:var(--ink);font-size:13px}
|
||||
.portfolio .repo-search::placeholder{color:var(--quiet)}
|
||||
.portfolio .repo-sort{min-height:42px;padding:9px 12px;background:var(--surface);border:1px solid var(--line);border-radius:4px;color:var(--ink);font-size:13px}
|
||||
.portfolio .repo-status{margin:0 0 16px;font-size:12px;color:var(--quiet)}
|
||||
.portfolio .repo-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
|
||||
.portfolio .repo-card{display:flex;flex-direction:column;gap:10px;padding:18px 18px 16px;border:1px solid var(--line);border-radius:6px;background:linear-gradient(180deg,#101d25,#0c161d);transition:border-color .15s ease,transform .15s ease}
|
||||
.portfolio .repo-card:hover{border-color:#4c6d7c;transform:translateY(-1px)}
|
||||
.portfolio .repo-head{display:flex;align-items:center;gap:10px;justify-content:space-between}
|
||||
.portfolio .repo-head h3{font-size:16px;letter-spacing:-.015em;margin:0;font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
|
||||
.portfolio .repo-head h3 a{color:var(--ink)}
|
||||
.portfolio .repo-head h3 a:hover{color:var(--ice)}
|
||||
.portfolio .repo-flag{font:10px/1 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.08em;text-transform:uppercase;padding:3px 7px;border:1px solid var(--line);border-radius:3px;color:var(--quiet)}
|
||||
.portfolio .repo-desc{margin:0;font-size:13px;line-height:1.6;color:var(--muted);min-height:4.6em}
|
||||
.portfolio .repo-topics{display:flex;gap:6px;flex-wrap:wrap}
|
||||
.portfolio .repo-topics span{font:10px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.04em;padding:3px 8px;border:1px solid var(--line);border-radius:99px;color:var(--quiet)}
|
||||
.portfolio .repo-meta{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:auto;font-size:11px;color:var(--quiet)}
|
||||
.portfolio .repo-meta .lang{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--muted)}
|
||||
.portfolio .repo-meta .lang i{display:inline-block;width:9px;height:9px;border-radius:50%}
|
||||
.portfolio .repo-meta .tag{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--ice)}
|
||||
.portfolio .repo-links{display:flex;gap:14px;flex-wrap:wrap;font-size:11px;padding-top:10px;border-top:1px solid #1d2b34}
|
||||
.portfolio .repo-links a{border-bottom:1px solid #4d6272;padding-bottom:1px;color:var(--muted)}
|
||||
.portfolio .repo-links a:hover{color:var(--ice);border-color:var(--ice)}
|
||||
.portfolio .language-bars{display:grid;gap:9px;max-width:620px;margin-top:20px}
|
||||
.portfolio .lang-row{display:grid;grid-template-columns:130px minmax(0,1fr) 34px;gap:12px;align-items:center;font-size:12px;color:var(--muted);background:none;border:0;padding:0;text-align:left;cursor:pointer;font-family:inherit}
|
||||
.portfolio .lang-row:hover{color:var(--ice)}
|
||||
.portfolio .lang-row .bar{display:block;height:6px;border-radius:99px;background:#1a2730;overflow:hidden}
|
||||
.portfolio .lang-row .bar i{display:block;height:100%;border-radius:99px}
|
||||
.portfolio .lang-row b{font-weight:600;color:var(--quiet);text-align:right}
|
||||
.portfolio .case-links{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:20px}
|
||||
.portfolio .case-links a{display:block;padding:13px;border:1px solid var(--line);border-radius:5px;font-size:13px}
|
||||
.portfolio .case-links a:hover{border-color:#4c6d7c}
|
||||
.portfolio .case-links span{display:block;margin-top:5px;font-size:10px;line-height:1.5;color:var(--quiet)}
|
||||
@media(max-width:900px){.portfolio .repo-grid{grid-template-columns:1fr}.portfolio .case-links{grid-template-columns:repeat(2,minmax(0,1fr))}.portfolio .stats{grid-template-columns:1fr 1fr}}
|
||||
@media(max-width:560px){.portfolio .stats{grid-template-columns:1fr}.portfolio .case-links{grid-template-columns:1fr}.portfolio .lang-row{grid-template-columns:104px minmax(0,1fr) 30px}}
|
||||
Vendored
+229
@@ -0,0 +1,229 @@
|
||||
(() => {
|
||||
"use strict";
|
||||
// The homepage is generated from the repository list itself: every public, non-empty repository
|
||||
// is rendered as a card, with its own description, language, last commit and latest release.
|
||||
// Adding a repository needs no rebuild — it appears on the next page load.
|
||||
const grid = document.querySelector("[data-repo-grid]");
|
||||
if (!grid) return;
|
||||
const ORG = "publish-bot";
|
||||
const PAGE = 50, MAX_PAGES = 4, ENRICH_LIMIT = 40;
|
||||
const LANG_COLORS = {
|
||||
"Python": "#3572A5", "C#": "#178600", "C++": "#f34b7d", "JavaScript": "#f1e05a",
|
||||
"TypeScript": "#3178c6", "Go": "#00ADD8", "Rust": "#dea584", "Java": "#b07219",
|
||||
"Ruby": "#701516", "Shell": "#89e051", "HTML": "#e34c26", "CSS": "#563d7c",
|
||||
"C": "#555555", "Kotlin": "#A97BFF", "Swift": "#F05138", "PHP": "#4F5D95",
|
||||
"Dockerfile": "#384d54", "PowerShell": "#012456", "Makefile": "#427819", "Lua": "#000080"
|
||||
};
|
||||
const statusEl = document.querySelector("[data-repo-status]");
|
||||
const searchEl = document.querySelector("[data-repo-search]");
|
||||
const sortEl = document.querySelector("[data-repo-sort]");
|
||||
const langBox = document.querySelector("[data-lang-bars]");
|
||||
const stats = {
|
||||
repos: document.querySelector('[data-stat="repos"]'),
|
||||
languages: document.querySelector('[data-stat="languages"]'),
|
||||
updated: document.querySelector('[data-stat="updated"]')
|
||||
};
|
||||
|
||||
const node = (tag, cls, text) => {
|
||||
const n = document.createElement(tag);
|
||||
if (cls) n.className = cls;
|
||||
if (text != null) n.textContent = text;
|
||||
return n;
|
||||
};
|
||||
const day = 864e5;
|
||||
const shortDate = value => {
|
||||
const d = new Date(value);
|
||||
return Number.isNaN(d.valueOf()) ? "" : d.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
||||
};
|
||||
const relative = value => {
|
||||
const t = Date.parse(value);
|
||||
if (Number.isNaN(t)) return "";
|
||||
const delta = t - Date.now(), abs = Math.abs(delta);
|
||||
const rtf = new Intl.RelativeTimeFormat("en-US", { numeric: "auto" });
|
||||
if (abs < 6e4) return "just now";
|
||||
if (abs < 36e5) return rtf.format(Math.round(delta / 6e4), "minute");
|
||||
if (abs < day) return rtf.format(Math.round(delta / 36e5), "hour");
|
||||
if (abs < 30 * day) return rtf.format(Math.round(delta / day), "day");
|
||||
if (abs < 365 * day) return rtf.format(Math.round(delta / (30 * day)), "month");
|
||||
return rtf.format(Math.round(delta / (365 * day)), "year");
|
||||
};
|
||||
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), 15000);
|
||||
const api = path => fetch(`/api/v1${path}`, { credentials: "omit", headers: { Accept: "application/json" }, signal: controller.signal })
|
||||
.then(response => { if (!response.ok) throw new Error("API " + response.status); return response.json(); });
|
||||
|
||||
const repos = [];
|
||||
const extra = new Map(); // name -> { release, commit }
|
||||
let view = [];
|
||||
|
||||
const searchable = repo => [repo.name, repo.description, repo.language, ...(repo.topics || [])]
|
||||
.filter(Boolean).join(" ").toLowerCase();
|
||||
const activity = repo => {
|
||||
const info = extra.get(repo.name);
|
||||
return (info && info.commit) || repo.updated_at || "";
|
||||
};
|
||||
|
||||
async function load() {
|
||||
for (let page = 1; page <= MAX_PAGES; page++) {
|
||||
const batch = await api(`/users/${ORG}/repos?limit=${PAGE}&page=${page}&sort=updated`);
|
||||
if (!Array.isArray(batch) || batch.length === 0) break;
|
||||
repos.push(...batch);
|
||||
if (batch.length < PAGE) break;
|
||||
}
|
||||
const active = repos.filter(repo => repo.private === false && !repo.empty);
|
||||
await Promise.all(active.slice(0, ENRICH_LIMIT).map(async repo => {
|
||||
const info = { release: null, commit: null };
|
||||
const name = encodeURIComponent(repo.name);
|
||||
try {
|
||||
const releases = await api(`/repos/${ORG}/${name}/releases?limit=1`);
|
||||
const first = Array.isArray(releases) && releases[0];
|
||||
if (first) info.release = { tag: first.tag_name, url: first.html_url, at: first.published_at || first.created_at };
|
||||
} catch { /* repositories without releases are normal */ }
|
||||
try {
|
||||
const commits = await api(`/repos/${ORG}/${name}/commits?limit=1&stat=false`);
|
||||
const commit = Array.isArray(commits) && commits[0];
|
||||
if (commit) info.commit = (commit.commit && (commit.commit.committer || commit.commit.author) || {}).date || null;
|
||||
} catch { /* empty repositories have no commits */ }
|
||||
extra.set(repo.name, info);
|
||||
}));
|
||||
}
|
||||
|
||||
function renderStats() {
|
||||
const active = repos.filter(repo => repo.private === false && !repo.empty && !repo.archived);
|
||||
const languages = new Set(active.map(repo => repo.language).filter(Boolean));
|
||||
const stamps = active.map(activity).filter(Boolean).sort();
|
||||
if (stats.repos) stats.repos.textContent = String(active.length);
|
||||
if (stats.languages) stats.languages.textContent = String(languages.size);
|
||||
if (stats.updated) stats.updated.textContent = stamps.length ? shortDate(stamps[stamps.length - 1]) : "—";
|
||||
}
|
||||
|
||||
function card(repo) {
|
||||
const info = extra.get(repo.name) || {};
|
||||
const article = node("article", "repo-card");
|
||||
article.dataset.name = repo.name;
|
||||
|
||||
const head = node("div", "repo-head");
|
||||
const heading = node("h3");
|
||||
const link = node("a", null, repo.name);
|
||||
link.href = repo.html_url;
|
||||
heading.append(link);
|
||||
head.append(heading);
|
||||
if (repo.archived) head.append(node("span", "repo-flag", "Archived"));
|
||||
article.append(head);
|
||||
|
||||
article.append(node("p", "repo-desc", repo.description || "Public repository on code.knickqueue.win."));
|
||||
|
||||
if (repo.topics && repo.topics.length) {
|
||||
const topics = node("div", "repo-topics");
|
||||
repo.topics.slice(0, 4).forEach(topic => topics.append(node("span", null, topic)));
|
||||
article.append(topics);
|
||||
}
|
||||
|
||||
const meta = node("div", "repo-meta");
|
||||
if (repo.language) {
|
||||
const lang = node("span", "lang");
|
||||
const dot = node("i");
|
||||
dot.style.background = LANG_COLORS[repo.language] || "#738590";
|
||||
lang.append(dot, document.createTextNode(repo.language));
|
||||
meta.append(lang);
|
||||
}
|
||||
const last = activity(repo);
|
||||
meta.append(node("span", null, last ? `last commit ${relative(last)}` : "no commits yet"));
|
||||
if (repo.stars_count) meta.append(node("span", null, `★ ${repo.stars_count}`));
|
||||
if (repo.forks_count) meta.append(node("span", null, `⑂ ${repo.forks_count}`));
|
||||
if (info.release) meta.append(node("span", "tag", info.release.tag));
|
||||
article.append(meta);
|
||||
|
||||
const links = node("div", "repo-links");
|
||||
const source = node("a", null, "Source ↗");
|
||||
source.href = repo.html_url;
|
||||
links.append(source);
|
||||
if (info.release) {
|
||||
const release = node("a", null, "Releases ↗");
|
||||
release.href = `${repo.html_url}/releases`;
|
||||
links.append(release);
|
||||
}
|
||||
const issues = node("a", null, "Issues ↗");
|
||||
issues.href = `${repo.html_url}/issues`;
|
||||
links.append(issues);
|
||||
article.append(links);
|
||||
|
||||
return article;
|
||||
}
|
||||
|
||||
function ordered(list) {
|
||||
const mode = sortEl ? sortEl.value : "updated";
|
||||
const copy = [...list];
|
||||
if (mode === "name") return copy.sort((a, b) => a.name.localeCompare(b.name, "en", { sensitivity: "base" }));
|
||||
if (mode === "language") return copy.sort((a, b) => String(a.language || "~").localeCompare(String(b.language || "~")) || a.name.localeCompare(b.name));
|
||||
return copy.sort((a, b) => String(activity(b)).localeCompare(String(activity(a))));
|
||||
}
|
||||
|
||||
function renderGrid() {
|
||||
const query = (searchEl ? searchEl.value : "").trim().toLowerCase();
|
||||
const pool = repos.filter(repo => repo.private === false && !repo.empty && !repo.archived);
|
||||
view = ordered(pool.filter(repo => !query || searchable(repo).includes(query)));
|
||||
const rows = document.createDocumentFragment();
|
||||
view.forEach(repo => rows.append(card(repo)));
|
||||
grid.replaceChildren(rows);
|
||||
if (statusEl) {
|
||||
statusEl.textContent = !pool.length
|
||||
? "No public repositories reported by the API."
|
||||
: query
|
||||
? `${view.length} of ${pool.length} repositories match “${searchEl.value.trim()}”.`
|
||||
: `${pool.length} public ${pool.length === 1 ? "repository" : "repositories"}, most recent activity first.`;
|
||||
}
|
||||
}
|
||||
|
||||
function renderLanguages() {
|
||||
if (!langBox) return;
|
||||
const counts = new Map();
|
||||
repos.filter(repo => repo.private === false && !repo.empty && !repo.archived).forEach(repo => {
|
||||
if (!repo.language) return;
|
||||
counts.set(repo.language, (counts.get(repo.language) || 0) + 1);
|
||||
});
|
||||
const rows = [...counts.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
|
||||
if (!rows.length) { langBox.hidden = true; return; }
|
||||
const max = rows[0][1];
|
||||
const frag = document.createDocumentFragment();
|
||||
rows.forEach(([language, count]) => {
|
||||
const row = node("button", "lang-row");
|
||||
row.type = "button";
|
||||
row.title = `Show ${language} repositories`;
|
||||
row.append(node("span", null, language));
|
||||
const bar = node("span", "bar");
|
||||
const fill = node("i");
|
||||
fill.style.width = `${Math.round((count / max) * 100)}%`;
|
||||
fill.style.background = LANG_COLORS[language] || "#9ae4f0";
|
||||
bar.append(fill);
|
||||
row.append(bar, node("b", null, String(count)));
|
||||
row.addEventListener("click", () => {
|
||||
if (!searchEl) return;
|
||||
searchEl.value = language;
|
||||
renderGrid();
|
||||
document.getElementById("repos")?.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
});
|
||||
frag.append(row);
|
||||
});
|
||||
langBox.replaceChildren(frag);
|
||||
}
|
||||
|
||||
load()
|
||||
.then(() => {
|
||||
renderStats();
|
||||
renderLanguages();
|
||||
renderGrid();
|
||||
if (searchEl) searchEl.addEventListener("input", renderGrid);
|
||||
if (sortEl) sortEl.addEventListener("change", renderGrid);
|
||||
})
|
||||
.catch(() => {
|
||||
if (statusEl) {
|
||||
statusEl.textContent = "The repository list could not be loaded. ";
|
||||
const fallback = node("a", null, "Open the repository browser instead ↗");
|
||||
fallback.href = "https://code.knickqueue.win/explore/repos";
|
||||
statusEl.append(fallback);
|
||||
}
|
||||
})
|
||||
.finally(() => clearTimeout(timeout));
|
||||
})();
|
||||
Vendored
+63
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,62 @@
|
||||
{{MASTHEAD}}
|
||||
<main id="main">
|
||||
<div class="wrap">
|
||||
<section class="showcase-hero" aria-labelledby="hero-title">
|
||||
<p class="eyebrow">code.knickqueue.win / public repositories</p>
|
||||
<h1 id="hero-title">Every repository,<br><em>as it stands.</em></h1>
|
||||
<p class="intro">Public source for the tools, platforms and experiments I run on my own infrastructure. This page is built from the repositories themselves — each card carries the repository's own description, language, last commit and latest release, so nothing here can drift from what is actually published.</p>
|
||||
<div class="actions">
|
||||
<a class="button primary" href="https://code.knickqueue.win/explore/repos">Browse on Gitea ↗</a>
|
||||
<a class="text-link" href="#repos">Jump to repositories ↓</a>
|
||||
<a class="text-link" href="mailto:{{EMAIL}}">Get in touch ↗</a>
|
||||
</div>
|
||||
<dl class="stats" data-repo-stats>
|
||||
<div><dt>Repositories</dt><dd data-stat="repos">—</dd></div>
|
||||
<div><dt>Languages</dt><dd data-stat="languages">—</dd></div>
|
||||
<div><dt>Last commit</dt><dd data-stat="updated">—</dd></div>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="content-section" id="repos" aria-labelledby="repos-title">
|
||||
<div class="section-heading">
|
||||
<div><p class="eyebrow">01 / repositories</p><h2 id="repos-title">Source, releases and current state.</h2></div>
|
||||
<p>Every public repository on this instance, newest activity first.</p>
|
||||
</div>
|
||||
<div class="repo-toolbar">
|
||||
<label class="repo-label" for="repo-search">Filter</label>
|
||||
<input class="repo-search" id="repo-search" type="search" placeholder="name, language, topic…" autocomplete="off" data-repo-search>
|
||||
<label class="repo-label" for="repo-sort">Sort</label>
|
||||
<select class="repo-sort" id="repo-sort" data-repo-sort>
|
||||
<option value="updated">Recently updated</option>
|
||||
<option value="name">Name</option>
|
||||
<option value="language">Language</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="repo-status" role="status" data-repo-status>Loading repositories…</p>
|
||||
<div class="repo-grid" data-repo-grid></div>
|
||||
<noscript><p class="repo-status">This list is built in the browser from the public API. With JavaScript disabled, use <a href="https://code.knickqueue.win/explore/repos">the repository browser</a>.</p></noscript>
|
||||
</section>
|
||||
|
||||
<section class="content-section" id="languages" aria-labelledby="languages-title">
|
||||
<div class="section-heading">
|
||||
<div><p class="eyebrow">02 / languages</p><h2 id="languages-title">What it is built with.</h2></div>
|
||||
<p>Counted from the primary language each repository reports.</p>
|
||||
</div>
|
||||
<div class="language-bars" data-lang-bars></div>
|
||||
</section>
|
||||
|
||||
<section class="content-section" id="case-studies" aria-labelledby="case-title">
|
||||
<div class="section-heading">
|
||||
<div><p class="eyebrow">03 / case studies</p><h2 id="case-title">The engineering behind four of them.</h2></div>
|
||||
<p>Longer write-ups on the systems where the boundary was the hard part.</p>
|
||||
</div>
|
||||
<div class="case-links">{{CASE_LINKS}}</div>
|
||||
</section>
|
||||
|
||||
<section class="contact-panel" aria-labelledby="contact-title">
|
||||
<div><p class="eyebrow">Let's talk</p><h2 id="contact-title">Building something that needs to hold up?</h2><p>Software, systems and platform engineering. Based in Port Saint Lucie, Florida.</p></div>
|
||||
<div class="actions"><a class="button primary" href="mailto:{{EMAIL}}">Get in touch ↗</a><a class="text-link" href="https://knickqueue.win/Resume_2026.pdf">Résumé ↗</a></div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
{{FOOTER}}
|
||||
+40
-21
@@ -15,32 +15,51 @@
|
||||
});
|
||||
const list = document.querySelector("[data-public-source]");
|
||||
if (!list) return;
|
||||
// The featured projects and source links are already HTML. This is optional enrichment.
|
||||
// The static links in the homepage are the no-JavaScript fallback. When the public API
|
||||
// answers, the list is rebuilt from the repository list itself, so a project published to
|
||||
// publish-bot appears here on the next page load with no rebuild or deploy.
|
||||
const LABELS = { portfolio: "Portfolio source", "ats-native-fsd": "ATS native simulator controller" };
|
||||
const PAGE = 50, MAX_PAGES = 4;
|
||||
const sameOriginUrl = value => {
|
||||
try { const url = new URL(value, location.origin); return url.origin === location.origin && url.protocol === "https:" ? url.href : null; }
|
||||
catch { return null; }
|
||||
};
|
||||
const stamp = value => {
|
||||
const date = new Date(value);
|
||||
return Number.isNaN(date.valueOf()) ? "" : date.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
||||
};
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), 8000);
|
||||
fetch("/api/v1/users/publish-bot/repos?limit=50&sort=updated", {credentials:"omit",headers:{Accept:"application/json"},signal:controller.signal})
|
||||
.then(response => { if (!response.ok) throw new Error("Public listing unavailable"); return response.json(); })
|
||||
.then(repos => {
|
||||
if (!Array.isArray(repos)) return;
|
||||
const known = new Set([...list.querySelectorAll("a")].map(a => a.dataset.repo));
|
||||
for (const repo of repos) {
|
||||
if (repo.private !== false || repo.empty || repo.name === "repo-relay-test" || known.has(repo.name)) continue;
|
||||
const url = sameOriginUrl(repo.html_url);
|
||||
if (!url) continue;
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.dataset.repo = repo.name;
|
||||
link.append(document.createTextNode(repo.name));
|
||||
const meta = document.createElement("span");
|
||||
meta.textContent = repo.language || "Public repository";
|
||||
link.append(meta);
|
||||
list.append(link);
|
||||
}
|
||||
})
|
||||
.catch(() => { /* Existing source links remain useful when the API is unavailable. */ })
|
||||
const fetchPage = page => fetch(`/api/v1/users/publish-bot/repos?limit=${PAGE}&page=${page}&sort=updated`, { credentials: "omit", headers: { Accept: "application/json" }, signal: controller.signal })
|
||||
.then(response => { if (!response.ok) throw new Error("Public listing unavailable"); return response.json(); });
|
||||
(async () => {
|
||||
const repos = [];
|
||||
for (let page = 1; page <= MAX_PAGES; page++) {
|
||||
const batch = await fetchPage(page);
|
||||
if (!Array.isArray(batch) || batch.length === 0) break;
|
||||
repos.push(...batch);
|
||||
if (batch.length < PAGE) break;
|
||||
}
|
||||
const active = repos
|
||||
.filter(repo => repo.private === false && !repo.empty && !repo.archived)
|
||||
.sort((a, b) => String(b.updated_at).localeCompare(String(a.updated_at)));
|
||||
if (!active.length) return;
|
||||
const rows = document.createDocumentFragment();
|
||||
for (const repo of active) {
|
||||
const url = sameOriginUrl(repo.html_url);
|
||||
if (!url) continue;
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.dataset.repo = repo.name;
|
||||
if (repo.description) link.title = repo.description;
|
||||
link.append(document.createTextNode(LABELS[repo.name] || repo.name));
|
||||
const meta = document.createElement("span");
|
||||
const updated = stamp(repo.updated_at);
|
||||
meta.textContent = [repo.language || "Public repository", updated && `updated ${updated}`].filter(Boolean).join(" · ");
|
||||
link.append(meta);
|
||||
rows.append(link);
|
||||
}
|
||||
if (rows.childElementCount) list.replaceChildren(rows);
|
||||
})().catch(() => { /* Existing source links remain useful when the API is unavailable. */ })
|
||||
.finally(() => clearTimeout(timeout));
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/* Showcase additions for the repository homepage. Tokens come from portfolio.css. */
|
||||
.portfolio .showcase-hero{padding:74px 0 8px;max-width:900px}
|
||||
.portfolio .showcase-hero h1{margin-top:22px}
|
||||
.portfolio .stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;margin:38px 0 0;padding:20px 0 0;border-top:1px solid var(--line)}
|
||||
.portfolio .stats div{margin:0}
|
||||
.portfolio .stats dt{font:11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;text-transform:uppercase;letter-spacing:.16em;color:var(--quiet)}
|
||||
.portfolio .stats dd{margin:7px 0 0;font-size:26px;line-height:1.1;letter-spacing:-.03em;color:var(--ink)}
|
||||
.portfolio .repo-label{font:11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;text-transform:uppercase;letter-spacing:.14em;color:var(--quiet)}
|
||||
.portfolio .repo-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:20px 0 14px}
|
||||
.portfolio .repo-search{flex:1 1 260px;min-height:42px;padding:10px 14px;background:var(--surface);border:1px solid var(--line);border-radius:4px;color:var(--ink);font-size:13px}
|
||||
.portfolio .repo-search::placeholder{color:var(--quiet)}
|
||||
.portfolio .repo-sort{min-height:42px;padding:9px 12px;background:var(--surface);border:1px solid var(--line);border-radius:4px;color:var(--ink);font-size:13px}
|
||||
.portfolio .repo-status{margin:0 0 16px;font-size:12px;color:var(--quiet)}
|
||||
.portfolio .repo-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
|
||||
.portfolio .repo-card{display:flex;flex-direction:column;gap:10px;padding:18px 18px 16px;border:1px solid var(--line);border-radius:6px;background:linear-gradient(180deg,#101d25,#0c161d);transition:border-color .15s ease,transform .15s ease}
|
||||
.portfolio .repo-card:hover{border-color:#4c6d7c;transform:translateY(-1px)}
|
||||
.portfolio .repo-head{display:flex;align-items:center;gap:10px;justify-content:space-between}
|
||||
.portfolio .repo-head h3{font-size:16px;letter-spacing:-.015em;margin:0;font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
|
||||
.portfolio .repo-head h3 a{color:var(--ink)}
|
||||
.portfolio .repo-head h3 a:hover{color:var(--ice)}
|
||||
.portfolio .repo-flag{font:10px/1 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.08em;text-transform:uppercase;padding:3px 7px;border:1px solid var(--line);border-radius:3px;color:var(--quiet)}
|
||||
.portfolio .repo-desc{margin:0;font-size:13px;line-height:1.6;color:var(--muted);min-height:4.6em}
|
||||
.portfolio .repo-topics{display:flex;gap:6px;flex-wrap:wrap}
|
||||
.portfolio .repo-topics span{font:10px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.04em;padding:3px 8px;border:1px solid var(--line);border-radius:99px;color:var(--quiet)}
|
||||
.portfolio .repo-meta{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:auto;font-size:11px;color:var(--quiet)}
|
||||
.portfolio .repo-meta .lang{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--muted)}
|
||||
.portfolio .repo-meta .lang i{display:inline-block;width:9px;height:9px;border-radius:50%}
|
||||
.portfolio .repo-meta .tag{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--ice)}
|
||||
.portfolio .repo-links{display:flex;gap:14px;flex-wrap:wrap;font-size:11px;padding-top:10px;border-top:1px solid #1d2b34}
|
||||
.portfolio .repo-links a{border-bottom:1px solid #4d6272;padding-bottom:1px;color:var(--muted)}
|
||||
.portfolio .repo-links a:hover{color:var(--ice);border-color:var(--ice)}
|
||||
.portfolio .language-bars{display:grid;gap:9px;max-width:620px;margin-top:20px}
|
||||
.portfolio .lang-row{display:grid;grid-template-columns:130px minmax(0,1fr) 34px;gap:12px;align-items:center;font-size:12px;color:var(--muted);background:none;border:0;padding:0;text-align:left;cursor:pointer;font-family:inherit}
|
||||
.portfolio .lang-row:hover{color:var(--ice)}
|
||||
.portfolio .lang-row .bar{display:block;height:6px;border-radius:99px;background:#1a2730;overflow:hidden}
|
||||
.portfolio .lang-row .bar i{display:block;height:100%;border-radius:99px}
|
||||
.portfolio .lang-row b{font-weight:600;color:var(--quiet);text-align:right}
|
||||
.portfolio .case-links{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:20px}
|
||||
.portfolio .case-links a{display:block;padding:13px;border:1px solid var(--line);border-radius:5px;font-size:13px}
|
||||
.portfolio .case-links a:hover{border-color:#4c6d7c}
|
||||
.portfolio .case-links span{display:block;margin-top:5px;font-size:10px;line-height:1.5;color:var(--quiet)}
|
||||
@media(max-width:900px){.portfolio .repo-grid{grid-template-columns:1fr}.portfolio .case-links{grid-template-columns:repeat(2,minmax(0,1fr))}.portfolio .stats{grid-template-columns:1fr 1fr}}
|
||||
@media(max-width:560px){.portfolio .stats{grid-template-columns:1fr}.portfolio .case-links{grid-template-columns:1fr}.portfolio .lang-row{grid-template-columns:104px minmax(0,1fr) 30px}}
|
||||
@@ -0,0 +1,229 @@
|
||||
(() => {
|
||||
"use strict";
|
||||
// The homepage is generated from the repository list itself: every public, non-empty repository
|
||||
// is rendered as a card, with its own description, language, last commit and latest release.
|
||||
// Adding a repository needs no rebuild — it appears on the next page load.
|
||||
const grid = document.querySelector("[data-repo-grid]");
|
||||
if (!grid) return;
|
||||
const ORG = "publish-bot";
|
||||
const PAGE = 50, MAX_PAGES = 4, ENRICH_LIMIT = 40;
|
||||
const LANG_COLORS = {
|
||||
"Python": "#3572A5", "C#": "#178600", "C++": "#f34b7d", "JavaScript": "#f1e05a",
|
||||
"TypeScript": "#3178c6", "Go": "#00ADD8", "Rust": "#dea584", "Java": "#b07219",
|
||||
"Ruby": "#701516", "Shell": "#89e051", "HTML": "#e34c26", "CSS": "#563d7c",
|
||||
"C": "#555555", "Kotlin": "#A97BFF", "Swift": "#F05138", "PHP": "#4F5D95",
|
||||
"Dockerfile": "#384d54", "PowerShell": "#012456", "Makefile": "#427819", "Lua": "#000080"
|
||||
};
|
||||
const statusEl = document.querySelector("[data-repo-status]");
|
||||
const searchEl = document.querySelector("[data-repo-search]");
|
||||
const sortEl = document.querySelector("[data-repo-sort]");
|
||||
const langBox = document.querySelector("[data-lang-bars]");
|
||||
const stats = {
|
||||
repos: document.querySelector('[data-stat="repos"]'),
|
||||
languages: document.querySelector('[data-stat="languages"]'),
|
||||
updated: document.querySelector('[data-stat="updated"]')
|
||||
};
|
||||
|
||||
const node = (tag, cls, text) => {
|
||||
const n = document.createElement(tag);
|
||||
if (cls) n.className = cls;
|
||||
if (text != null) n.textContent = text;
|
||||
return n;
|
||||
};
|
||||
const day = 864e5;
|
||||
const shortDate = value => {
|
||||
const d = new Date(value);
|
||||
return Number.isNaN(d.valueOf()) ? "" : d.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
||||
};
|
||||
const relative = value => {
|
||||
const t = Date.parse(value);
|
||||
if (Number.isNaN(t)) return "";
|
||||
const delta = t - Date.now(), abs = Math.abs(delta);
|
||||
const rtf = new Intl.RelativeTimeFormat("en-US", { numeric: "auto" });
|
||||
if (abs < 6e4) return "just now";
|
||||
if (abs < 36e5) return rtf.format(Math.round(delta / 6e4), "minute");
|
||||
if (abs < day) return rtf.format(Math.round(delta / 36e5), "hour");
|
||||
if (abs < 30 * day) return rtf.format(Math.round(delta / day), "day");
|
||||
if (abs < 365 * day) return rtf.format(Math.round(delta / (30 * day)), "month");
|
||||
return rtf.format(Math.round(delta / (365 * day)), "year");
|
||||
};
|
||||
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), 15000);
|
||||
const api = path => fetch(`/api/v1${path}`, { credentials: "omit", headers: { Accept: "application/json" }, signal: controller.signal })
|
||||
.then(response => { if (!response.ok) throw new Error("API " + response.status); return response.json(); });
|
||||
|
||||
const repos = [];
|
||||
const extra = new Map(); // name -> { release, commit }
|
||||
let view = [];
|
||||
|
||||
const searchable = repo => [repo.name, repo.description, repo.language, ...(repo.topics || [])]
|
||||
.filter(Boolean).join(" ").toLowerCase();
|
||||
const activity = repo => {
|
||||
const info = extra.get(repo.name);
|
||||
return (info && info.commit) || repo.updated_at || "";
|
||||
};
|
||||
|
||||
async function load() {
|
||||
for (let page = 1; page <= MAX_PAGES; page++) {
|
||||
const batch = await api(`/users/${ORG}/repos?limit=${PAGE}&page=${page}&sort=updated`);
|
||||
if (!Array.isArray(batch) || batch.length === 0) break;
|
||||
repos.push(...batch);
|
||||
if (batch.length < PAGE) break;
|
||||
}
|
||||
const active = repos.filter(repo => repo.private === false && !repo.empty);
|
||||
await Promise.all(active.slice(0, ENRICH_LIMIT).map(async repo => {
|
||||
const info = { release: null, commit: null };
|
||||
const name = encodeURIComponent(repo.name);
|
||||
try {
|
||||
const releases = await api(`/repos/${ORG}/${name}/releases?limit=1`);
|
||||
const first = Array.isArray(releases) && releases[0];
|
||||
if (first) info.release = { tag: first.tag_name, url: first.html_url, at: first.published_at || first.created_at };
|
||||
} catch { /* repositories without releases are normal */ }
|
||||
try {
|
||||
const commits = await api(`/repos/${ORG}/${name}/commits?limit=1&stat=false`);
|
||||
const commit = Array.isArray(commits) && commits[0];
|
||||
if (commit) info.commit = (commit.commit && (commit.commit.committer || commit.commit.author) || {}).date || null;
|
||||
} catch { /* empty repositories have no commits */ }
|
||||
extra.set(repo.name, info);
|
||||
}));
|
||||
}
|
||||
|
||||
function renderStats() {
|
||||
const active = repos.filter(repo => repo.private === false && !repo.empty && !repo.archived);
|
||||
const languages = new Set(active.map(repo => repo.language).filter(Boolean));
|
||||
const stamps = active.map(activity).filter(Boolean).sort();
|
||||
if (stats.repos) stats.repos.textContent = String(active.length);
|
||||
if (stats.languages) stats.languages.textContent = String(languages.size);
|
||||
if (stats.updated) stats.updated.textContent = stamps.length ? shortDate(stamps[stamps.length - 1]) : "—";
|
||||
}
|
||||
|
||||
function card(repo) {
|
||||
const info = extra.get(repo.name) || {};
|
||||
const article = node("article", "repo-card");
|
||||
article.dataset.name = repo.name;
|
||||
|
||||
const head = node("div", "repo-head");
|
||||
const heading = node("h3");
|
||||
const link = node("a", null, repo.name);
|
||||
link.href = repo.html_url;
|
||||
heading.append(link);
|
||||
head.append(heading);
|
||||
if (repo.archived) head.append(node("span", "repo-flag", "Archived"));
|
||||
article.append(head);
|
||||
|
||||
article.append(node("p", "repo-desc", repo.description || "Public repository on code.knickqueue.win."));
|
||||
|
||||
if (repo.topics && repo.topics.length) {
|
||||
const topics = node("div", "repo-topics");
|
||||
repo.topics.slice(0, 4).forEach(topic => topics.append(node("span", null, topic)));
|
||||
article.append(topics);
|
||||
}
|
||||
|
||||
const meta = node("div", "repo-meta");
|
||||
if (repo.language) {
|
||||
const lang = node("span", "lang");
|
||||
const dot = node("i");
|
||||
dot.style.background = LANG_COLORS[repo.language] || "#738590";
|
||||
lang.append(dot, document.createTextNode(repo.language));
|
||||
meta.append(lang);
|
||||
}
|
||||
const last = activity(repo);
|
||||
meta.append(node("span", null, last ? `last commit ${relative(last)}` : "no commits yet"));
|
||||
if (repo.stars_count) meta.append(node("span", null, `★ ${repo.stars_count}`));
|
||||
if (repo.forks_count) meta.append(node("span", null, `⑂ ${repo.forks_count}`));
|
||||
if (info.release) meta.append(node("span", "tag", info.release.tag));
|
||||
article.append(meta);
|
||||
|
||||
const links = node("div", "repo-links");
|
||||
const source = node("a", null, "Source ↗");
|
||||
source.href = repo.html_url;
|
||||
links.append(source);
|
||||
if (info.release) {
|
||||
const release = node("a", null, "Releases ↗");
|
||||
release.href = `${repo.html_url}/releases`;
|
||||
links.append(release);
|
||||
}
|
||||
const issues = node("a", null, "Issues ↗");
|
||||
issues.href = `${repo.html_url}/issues`;
|
||||
links.append(issues);
|
||||
article.append(links);
|
||||
|
||||
return article;
|
||||
}
|
||||
|
||||
function ordered(list) {
|
||||
const mode = sortEl ? sortEl.value : "updated";
|
||||
const copy = [...list];
|
||||
if (mode === "name") return copy.sort((a, b) => a.name.localeCompare(b.name, "en", { sensitivity: "base" }));
|
||||
if (mode === "language") return copy.sort((a, b) => String(a.language || "~").localeCompare(String(b.language || "~")) || a.name.localeCompare(b.name));
|
||||
return copy.sort((a, b) => String(activity(b)).localeCompare(String(activity(a))));
|
||||
}
|
||||
|
||||
function renderGrid() {
|
||||
const query = (searchEl ? searchEl.value : "").trim().toLowerCase();
|
||||
const pool = repos.filter(repo => repo.private === false && !repo.empty && !repo.archived);
|
||||
view = ordered(pool.filter(repo => !query || searchable(repo).includes(query)));
|
||||
const rows = document.createDocumentFragment();
|
||||
view.forEach(repo => rows.append(card(repo)));
|
||||
grid.replaceChildren(rows);
|
||||
if (statusEl) {
|
||||
statusEl.textContent = !pool.length
|
||||
? "No public repositories reported by the API."
|
||||
: query
|
||||
? `${view.length} of ${pool.length} repositories match “${searchEl.value.trim()}”.`
|
||||
: `${pool.length} public ${pool.length === 1 ? "repository" : "repositories"}, most recent activity first.`;
|
||||
}
|
||||
}
|
||||
|
||||
function renderLanguages() {
|
||||
if (!langBox) return;
|
||||
const counts = new Map();
|
||||
repos.filter(repo => repo.private === false && !repo.empty && !repo.archived).forEach(repo => {
|
||||
if (!repo.language) return;
|
||||
counts.set(repo.language, (counts.get(repo.language) || 0) + 1);
|
||||
});
|
||||
const rows = [...counts.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
|
||||
if (!rows.length) { langBox.hidden = true; return; }
|
||||
const max = rows[0][1];
|
||||
const frag = document.createDocumentFragment();
|
||||
rows.forEach(([language, count]) => {
|
||||
const row = node("button", "lang-row");
|
||||
row.type = "button";
|
||||
row.title = `Show ${language} repositories`;
|
||||
row.append(node("span", null, language));
|
||||
const bar = node("span", "bar");
|
||||
const fill = node("i");
|
||||
fill.style.width = `${Math.round((count / max) * 100)}%`;
|
||||
fill.style.background = LANG_COLORS[language] || "#9ae4f0";
|
||||
bar.append(fill);
|
||||
row.append(bar, node("b", null, String(count)));
|
||||
row.addEventListener("click", () => {
|
||||
if (!searchEl) return;
|
||||
searchEl.value = language;
|
||||
renderGrid();
|
||||
document.getElementById("repos")?.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
});
|
||||
frag.append(row);
|
||||
});
|
||||
langBox.replaceChildren(frag);
|
||||
}
|
||||
|
||||
load()
|
||||
.then(() => {
|
||||
renderStats();
|
||||
renderLanguages();
|
||||
renderGrid();
|
||||
if (searchEl) searchEl.addEventListener("input", renderGrid);
|
||||
if (sortEl) sortEl.addEventListener("change", renderGrid);
|
||||
})
|
||||
.catch(() => {
|
||||
if (statusEl) {
|
||||
statusEl.textContent = "The repository list could not be loaded. ";
|
||||
const fallback = node("a", null, "Open the repository browser instead ↗");
|
||||
fallback.href = "https://code.knickqueue.win/explore/repos";
|
||||
statusEl.append(fallback);
|
||||
}
|
||||
})
|
||||
.finally(() => clearTimeout(timeout));
|
||||
})();
|
||||
+17
-6
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user