import { cn } from '@/lib/utils'; import { CopyIcon, DeltaIcon, RedoIcon, UndoIcon } from './icons'; import { Button } from './ui/button'; import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; import { useCopyToClipboard } from 'usehooks-ts'; import { toast } from 'sonner'; import { UIBlock } from './block'; import { memo } from 'react'; interface BlockActionsProps { block: UIBlock; handleVersionChange: (type: 'next' | 'prev' | 'toggle' | 'latest') => void; currentVersionIndex: number; isCurrentVersion: boolean; mode: 'read-only' | 'edit' | 'diff'; } function PureBlockActions({ block, handleVersionChange, currentVersionIndex, isCurrentVersion, mode, }: BlockActionsProps) { const [_, copyToClipboard] = useCopyToClipboard(); return (
Copy to clipboard View Previous version View Next version View changes
); } export const BlockActions = memo(PureBlockActions, (prevProps, nextProps) => { if (prevProps.block.status !== nextProps.block.status) return false; if (prevProps.currentVersionIndex !== nextProps.currentVersionIndex) return false; if (prevProps.isCurrentVersion !== nextProps.isCurrentVersion) return false; return true; });