import React, { useState, useRef, useLayoutEffect, useEffect } from 'react'; import type { EditorMode, InputMethod } from '../types'; import { TaterSpritePullup } from './TaterSpritePullup'; interface AnnotationToolstripProps { inputMethod: InputMethod; onInputMethodChange: (method: InputMethod) => void; mode: EditorMode; onModeChange: (mode: EditorMode) => void; taterMode?: boolean; /** * Compact mode: used inside the sticky header lane. Buttons only expand for * the active mode (no hover expansion), gap is tightened, and the help link * is hidden. */ compact?: boolean; /** * Icon-only mode: no button ever expands to show a label, even the active * one. Used in the sticky header lane on mobile so the toolstrip stays * narrow and leaves room for the diff badges. */ iconOnly?: boolean; } export const AnnotationToolstrip: React.FC = ({ inputMethod, onInputMethodChange, mode, onModeChange, taterMode, compact = false, iconOnly = false, }) => { const [showHelp, setShowHelp] = useState(false); const [helpTab, setHelpTab] = useState<'selection' | 'plannotator'>('selection'); const [mounted, setMounted] = useState(false); // Enable transitions only after first paint useEffect(() => { requestAnimationFrame(() => setMounted(true)); }, []); return ( <>
{/* Input method group */}
onInputMethodChange('drag')} label="Select" color="primary" mounted={mounted} compact={compact} iconOnly={iconOnly} icon={ } /> onInputMethodChange('pinpoint')} label="Pinpoint" color="primary" mounted={mounted} compact={compact} iconOnly={iconOnly} icon={ } />
{/* Action mode group */}
onModeChange('selection')} label="Markup" color="secondary" mounted={mounted} compact={compact} iconOnly={iconOnly} icon={ } /> onModeChange('comment')} label="Comment" color="accent" mounted={mounted} compact={compact} iconOnly={iconOnly} icon={ } /> onModeChange('redline')} label="Redline" color="destructive" mounted={mounted} compact={compact} iconOnly={iconOnly} icon={ } /> onModeChange('quickLabel')} label="Label" color="warning" mounted={mounted} compact={compact} iconOnly={iconOnly} icon={ } />
{/* Help */} {!compact && ( )}
{/* Help Video Dialog */} {showHelp && (
setShowHelp(false)} >
e.stopPropagation()} > {taterMode && }