initial: novel-app snapshot
This commit is contained in:
55
static/js/components/status-badge.js
Normal file
55
static/js/components/status-badge.js
Normal 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>`;
|
||||
}
|
||||
Reference in New Issue
Block a user