import type { ReactNode } from "react"; import { StatusBadge } from "~/components/console/status-badge.tsx"; import { cn } from "~/lib/utils.ts"; /** 分区内锚点 id:`<分区>-<节>`,URL hash 写作 `#<分区>/<节>` */ export const anchorId = (section: string, anchor: string) => `settings-${section}-${anchor}`; /** 设置分区里的一节:标题 + 一句说明 + 未保存提示 + 内容;带锚点 */ export function SettingsBlock({ section, anchor, title, description, dirty, actions, plain, children, }: { section: string; anchor: string; title: string; description?: ReactNode; dirty?: boolean; actions?: ReactNode; /** 不包卡片(内容自带 DataTable 卡片时用) */ plain?: boolean; children: ReactNode; }) { const id = anchorId(section, anchor); return (

{title} {dirty ? 未保存 : null}

{description ?

{description}

: null}
{actions ?
{actions}
: null}
{children}
); }