import React from 'react'; import { ToolType } from '../canvas/tools'; import ColorPicker from './ColorPicker'; interface OnlineUser { userId: string; displayName: string; color: string; } interface ToolbarProps { activeTool: ToolType; onToolChange: (tool: ToolType) => void; color: string; onColorChange: (color: string) => void; strokeWidth: number; onStrokeWidthChange: (width: number) => void; zoom: number; onFitAll: () => void; onZoomIn?: () => void; onZoomOut?: () => void; canUndo: boolean; canRedo: boolean; onUndo: () => void; onRedo: () => void; onlineUsers: OnlineUser[]; onUserClick?: (userId: string, displayName: string) => void; followingUserId?: string | null; onShareClick?: () => void; onToggleLayers?: () => void; showLayers?: boolean; onToggleHelp?: () => void; onToggleActivity?: () => void; showActivity?: boolean; onExport?: () => void; onRefreshPreview?: () => void; previewRefreshing?: boolean; onToggleReview?: () => void; reviewMode?: boolean; boardName?: string; } // SVG icon components function IconSelect() { return ( ); } function IconPen() { return ( ); } function IconText() { return ( ); } function IconSticky() { return ( ); } function IconMarkdown() { return ( ); } function IconReview() { return ( ); } function IconUndo() { return ( ); } function IconRedo() { return ( ); } function IconFit() { return ( ); } function IconLayers() { return ( ); } const toolButtons: { tool: ToolType; label: string; shortcut: string; numKey: string; Icon: React.FC; hint?: string }[] = [ { tool: ToolType.SELECT, label: 'Select', shortcut: 'V', numKey: '1', Icon: IconSelect, hint: 'Click to select, drag to move, Shift+click for multi-select' }, { tool: ToolType.PEN, label: 'Draw', shortcut: 'P', numKey: '3', Icon: IconPen, hint: 'Click and drag to draw freehand' }, { tool: ToolType.TEXT, label: 'Text', shortcut: 'T', numKey: '4', Icon: IconText, hint: 'Click on the canvas to place text' }, { tool: ToolType.STICKY, label: 'Sticky', shortcut: 'S', numKey: '5', Icon: IconSticky, hint: 'Click on the canvas to place a sticky note' }, { tool: ToolType.MARKDOWN, label: 'Markdown', shortcut: 'M', numKey: '6', Icon: IconMarkdown, hint: 'Click on the canvas to place a markdown card' }, ]; const REVIEW_HINT = 'Click an object to place a comment pin. Press . to toggle.'; export default function Toolbar({ activeTool, onToolChange, color, onColorChange, strokeWidth, onStrokeWidthChange, zoom, onFitAll, onZoomIn, onZoomOut, canUndo, canRedo, onUndo, onRedo, onlineUsers, onUserClick, followingUserId, onShareClick, onToggleLayers, showLayers, onToggleHelp, onToggleActivity, showActivity, onExport, onRefreshPreview, previewRefreshing, onToggleReview, reviewMode, }: ToolbarProps) { const showStroke = activeTool === ToolType.PEN; // Determine active hint const activeToolDef = toolButtons.find((t) => t.tool === activeTool); const activeHint = reviewMode ? REVIEW_HINT : activeToolDef?.hint || ''; return (