common.tsx

553 B v1.0
// 设置面板共享类型与组件
import type { ReactNode } from 'react';
import type { AppSettings, User } from '../../types';

export interface PanelProps {
  user: User;
  settings: AppSettings;
  updateSettings: (patch: unknown) => void;
  flushSettings: () => Promise<void>;
  showToast: (message: string, type?: 'info' | 'error') => void;
}

export function PanelHeader({ title, desc }: { title: ReactNode; desc?: string }) {
  return (
    <div className="panel-heading">
      <h2>{title}</h2>
      {desc && <p>{desc}</p>}
    </div>
  );
}