initial: novel-app snapshot

This commit is contained in:
omo
2026-08-17 17:11:30 +08:00
commit 1ae06209ac
34 changed files with 2821 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
/* Status badge renderer (Bootstrap pill). */
import { escapeHtml } from "../utils.js";
const COLOR_MAP = {
// chapter / job statuses
pending: "secondary",
outlined: "info",
drafting: "warning",
done: "success",
reviewed: "primary",
running: "warning",
failed: "danger",
// novel statuses
planning: "secondary",
outlining: "info",
reviewing: "primary",
completed: "success",
// character statuses
alive: "success",
dead: "dark",
unknown: "secondary",
// foreshadowing statuses
planted: "info",
resolved: "success",
missed: "danger",
};
const LABEL_MAP = {
pending: "待处理",
outlined: "已列纲",
drafting: "写作中",
done: "已完成",
reviewed: "已审阅",
running: "运行中",
failed: "失败",
planning: "筹划中",
outlining: "大纲中",
reviewing: "审阅中",
completed: "完本",
alive: "存活",
dead: "死亡",
unknown: "未知",
planted: "已埋设",
resolved: "已回收",
missed: "已遗漏",
};
/** Return a badge HTML string for a status. */
export function statusBadge(status) {
const key = String(status || "pending");
const color = COLOR_MAP[key] || "secondary";
const label = LABEL_MAP[key] || key;
return `<span class="badge text-bg-${color}">${escapeHtml(label)}</span>`;
}