diff --git a/site/src/components/Leaderboard.astro b/site/src/components/Leaderboard.astro
index 7275154..0273c4d 100644
--- a/site/src/components/Leaderboard.astro
+++ b/site/src/components/Leaderboard.astro
@@ -1,7 +1,7 @@
---
import type { Category, SiteEntry } from "../lib/data.ts";
import { isFlagged, languages, trending } from "../lib/data.ts";
-import { ago, compact, icon, num, pct } from "../lib/format.ts";
+import { ago, compact, icon, iconDef, iconUse, num, pct } from "../lib/format.ts";
interface Props {
entries: SiteEntry[];
@@ -71,6 +71,7 @@ const split = (repo: string) => {
{entries.length} {entries.length === 1 ? "repo" : "repos"}
+
{
entries.length === 0 ? (
@@ -182,12 +183,12 @@ const split = (repo: string) => {
{e.discussion_url ? (
-
+
Like
) : (
-
+
Likes open soon
)}
diff --git a/site/src/lib/format.ts b/site/src/lib/format.ts
index 2c42061..c0e12af 100644
--- a/site/src/lib/format.ts
+++ b/site/src/lib/format.ts
@@ -3,6 +3,15 @@ import octicons from "@primer/octicons";
export const icon = (name: keyof typeof octicons, cls = "") =>
octicons[name].toSVG({ "aria-hidden": "true", class: `oc ${cls}`.trim() });
+// A per-row icon is defined once with iconDef and drawn with iconUse, so 455 rows don't carry 455 copies of its path.
+export const iconDef = (name: keyof typeof octicons) =>
+ ``;
+
+export const iconUse = (name: keyof typeof octicons, cls = "") => {
+ const w = octicons[name].heights[16].width;
+ return ``;
+};
+
export const num = (n: number) => n.toLocaleString("en-US");
export const compact = (n: number) =>
|