import React, { useEffect, useRef, useState } from 'react'; import { MirrorBlock } from '../../service/company-id/company-id.interface'; import { GRADIENT, MONO, SANS } from './theme'; const ENGINE_DOT: Record = { chatgpt: 'bg-[#10a37f]', gemini: 'bg-[#4285f4]', }; export interface AnswerBlockProps { block: MirrorBlock; value: string; confirmed: boolean; populating: boolean; onChange: (value: string) => void; onConfirm: () => void; onFixIt: () => void; onReopen: () => void; registerTextarea: (node: HTMLTextAreaElement | null) => void; } export function AnswerBlock({ block, value, confirmed, populating, onChange, onConfirm, onFixIt, onReopen, registerTextarea, }: AnswerBlockProps): JSX.Element { const hasValue = value.trim().length > 0; const localRef = useRef(null); useEffect(() => { const node = localRef.current; if (!node) return; node.style.height = 'auto'; node.style.height = `${node.scrollHeight}px`; }, [value]); return (
{block.label}
{confirmed && ( )}
{block.engines.map(engine => ( { if (!confirmed) onChange(text); }} /> ))}
{confirmed ? ( ) : ( <> {block.silent && !hasValue && (
Your site doesn't say. Add your official version.
)}