// Shared types and small components for Tab components import type { ReactNode } from 'react'; import { Plus } from 'lucide-react'; import type { AppConfig } from './types'; /** 所有 Tab 组件共享的 props:完整 config + 顶层 update 回调 */ export interface TabProps { config: AppConfig; update: (key: K, value: AppConfig[K]) => void; } /** 用于显示 toast 消息的回调(如切换失败提示) */ export interface ToastProps { setToast: (msg: string) => void; } /** 通用「添加 XXX」虚线按钮,统一各 Tab 样式 */ export function AddButton({ label, onClick }: { label: string; onClick: () => void }) { return ( ); } /** 简单错误/提示气泡,统一红色错误样式 */ export function ErrorBanner({ children }: { children: ReactNode }) { if (!children) return null; return (
{children}
); }