import { REWRITE_STYLES } from './SelectionBubble' // RewritePreview shows the result of a tone-rewrite before it touches the // document: the writer's original passage, the model's rewrite beneath it, and // accept/cancel. It mirrors the SuggestionCard's warm, bilingual chrome. While // the model runs it shows a breathing dot; on failure it offers a gentle retry. export type RewriteStatus = 'loading' | 'ready' | 'error' interface Props { style: string // the chosen rewrite style key (for the header label) status: RewriteStatus original: string rewrite: string cardStyle: React.CSSProperties onAccept: () => void onCancel: () => void onRetry: () => void } const CJK = "'Nunito','PingFang SC','Microsoft YaHei','Noto Sans CJK SC',sans-serif" export function RewritePreview({ style, status, original, rewrite, cardStyle, onAccept, onCancel, onRetry, }: Props) { const meta = REWRITE_STYLES.find((s) => s.value === style) ?? REWRITE_STYLES[0] return (
{original}
{status === 'loading' && (改写失败,请再试一次 · Couldn’t rewrite — try again
{rewrite}