polish(admin): 抽出后台控件包并统一各页布局与交互

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-16 19:03:21 +08:00
parent cfc6c1403b
commit f73d2a89e8
23 changed files with 1720 additions and 1412 deletions

View File

@@ -0,0 +1,38 @@
import type { ReactNode } from "react";
export type AdminStatusTone = "ok" | "warn" | "danger" | "muted" | "accent";
const toneClass: Record<AdminStatusTone, string> = {
ok: "is-ok",
warn: "is-warn",
danger: "is-danger",
muted: "is-muted",
accent: "is-accent",
};
/** 待审 / 已发布 / 已拒绝 / 草稿 / 已删除 等状态粒 */
export default function AdminStatusChip({
children,
tone = "muted",
className = "",
}: {
children: ReactNode;
tone?: AdminStatusTone;
className?: string;
}) {
return (
<span className={`admin-status ${toneClass[tone]} ${className}`.trim()}>{children}</span>
);
}
/** 内容状态 → 文案 + tone */
export function contentStatusChip(
status: string,
deleted: boolean
): { label: string; tone: AdminStatusTone } {
if (deleted) return { label: "已删除", tone: "danger" };
if (status === "pending") return { label: "待审", tone: "warn" };
if (status === "rejected") return { label: "已拒绝", tone: "danger" };
if (status === "published") return { label: "已发布", tone: "ok" };
return { label: status, tone: "muted" };
}