Skip to content
Open
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
11 changes: 11 additions & 0 deletions src/pages/layout.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import { GITHUB_OWNERS } from "../config.js";
import type { QueueCategory } from "../github.js";

export type Theme = "dark" | "light" | "system";

export const CATEGORY_DISPLAY: Record<QueueCategory, { label: string; color: string }> = {
"ready": { label: "Ready", color: "0e8a16" },
"needs-refinement": { label: "Needs Refinement", color: "d876e3" },
"refined": { label: "Refined", color: "0075ca" },
"needs-review-addressing": { label: "Needs Review Addressing", color: "e4e669" },
"auto-mergeable": { label: "Auto-Mergeable", color: "0e8a16" },
"needs-triage": { label: "Needs Triage", color: "d73a49" },
"needs-plan-review": { label: "Needs Plan Review", color: "c5def5" },
};

const LIGHT_THEME_VARS = `
--bg: #ffffff;
--bg-secondary: #f6f8fa;
Expand Down
12 changes: 1 addition & 11 deletions src/pages/queue.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import type { Theme } from "./layout.js";
import { PAGE_CSS, escapeHtml, repoShortName, itemLogsUrl, formatRelativeTime, htmlOpenTag, buildNav, THEME_SCRIPT, TOAST_SCRIPT, siteTitle } from "./layout.js";
import { PAGE_CSS, escapeHtml, repoShortName, itemLogsUrl, formatRelativeTime, htmlOpenTag, buildNav, THEME_SCRIPT, TOAST_SCRIPT, siteTitle, CATEGORY_DISPLAY } from "./layout.js";
import type { QueueItem, QueueCategory } from "../github.js";

const CATEGORY_DISPLAY: Record<QueueCategory, { label: string; color: string }> = {
"ready": { label: "Ready", color: "0e8a16" },
"needs-refinement": { label: "Needs Refinement", color: "d876e3" },
"refined": { label: "Refined", color: "0075ca" },
"needs-review-addressing": { label: "Needs Review Addressing", color: "e4e669" },
"auto-mergeable": { label: "Auto-Mergeable", color: "0e8a16" },
"needs-triage": { label: "Needs Triage", color: "d73a49" },
"needs-plan-review": { label: "Needs Plan Review", color: "c5def5" },
};

const CATEGORY_PRIORITY: Record<QueueCategory, number> = {
"needs-review-addressing": 0,
"auto-mergeable": 1,
Expand Down
27 changes: 4 additions & 23 deletions src/pages/repos.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,13 @@
import type { Theme } from "./layout.js";
import { PAGE_CSS, escapeHtml, htmlOpenTag, buildNav, THEME_SCRIPT, TOAST_SCRIPT, siteTitle, itemLogsUrl, formatRelativeTime } from "./layout.js";
import { PAGE_CSS, escapeHtml, htmlOpenTag, buildNav, THEME_SCRIPT, TOAST_SCRIPT, siteTitle, itemLogsUrl, formatRelativeTime, CATEGORY_DISPLAY } from "./layout.js";
import type { QueueItem, QueueCategory } from "../github.js";
import type { Repo } from "../config.js";
import type { Task } from "../db.js";

const CATEGORY_LABELS: Record<QueueCategory, string> = {
"ready": "Ready",
"needs-refinement": "Needs Refinement",
"refined": "Refined",
"needs-review-addressing": "Needs Review Addressing",
"auto-mergeable": "Auto-Mergeable",
"needs-triage": "Needs Triage",
"needs-plan-review": "Needs Plan Review",
};

const CATEGORY_COLORS: Record<QueueCategory, string> = {
"ready": "0e8a16",
"needs-refinement": "d876e3",
"refined": "0075ca",
"needs-review-addressing": "e4e669",
"auto-mergeable": "0e8a16",
"needs-triage": "d73a49",
"needs-plan-review": "c5def5",
};

function statusBadge(category: QueueCategory): string {
const label = CATEGORY_LABELS[category] ?? category;
const color = CATEGORY_COLORS[category] ?? "30363d";
const display = CATEGORY_DISPLAY[category] ?? { label: category, color: "30363d" };
const label = display.label;
const color = display.color;
const bg = `#${color}`;
const text = parseInt(color, 16) > 0x7fffff ? "#000" : "#fff";
return `<span class="repo-badge" style="background:${bg};color:${text}">${escapeHtml(label)}</span>`;
Expand Down
Loading