feat: add copy/paste automation data functionality
Implemented automation clipboard system: - Added separate automationClipboard state for automation points - Created handleCopyAutomation function to copy automation lane points - Created handlePasteAutomation function to paste at current time with time offset - Added Copy and Clipboard icon buttons to AutomationHeader component - Automation points preserve curve type and value when copied/pasted - Points are sorted by time after pasting - Toast notifications for user feedback - Ready for integration when automation lanes are actively used 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import { Eye, EyeOff, ChevronDown, ChevronUp } from 'lucide-react';
|
||||
import { Eye, EyeOff, ChevronDown, ChevronUp, Copy, Clipboard } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { cn } from '@/lib/utils/cn';
|
||||
import type { AutomationMode } from '@/types/automation';
|
||||
@@ -21,6 +21,9 @@ export interface AutomationHeaderProps {
|
||||
availableParameters?: Array<{ id: string; name: string }>;
|
||||
selectedParameterId?: string;
|
||||
onParameterChange?: (parameterId: string) => void;
|
||||
// Copy/Paste automation
|
||||
onCopyAutomation?: () => void;
|
||||
onPasteAutomation?: () => void;
|
||||
}
|
||||
|
||||
const MODE_LABELS: Record<AutomationMode, string> = {
|
||||
@@ -51,6 +54,8 @@ export function AutomationHeader({
|
||||
availableParameters,
|
||||
selectedParameterId,
|
||||
onParameterChange,
|
||||
onCopyAutomation,
|
||||
onPasteAutomation,
|
||||
}: AutomationHeaderProps) {
|
||||
const modes: AutomationMode[] = ['read', 'write', 'touch', 'latch'];
|
||||
const currentModeIndex = modes.indexOf(mode);
|
||||
@@ -145,6 +150,34 @@ export function AutomationHeader({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Copy/Paste automation controls */}
|
||||
{(onCopyAutomation || onPasteAutomation) && (
|
||||
<div className="flex gap-1 flex-shrink-0 ml-auto mr-8">
|
||||
{onCopyAutomation && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={onCopyAutomation}
|
||||
title="Copy automation data"
|
||||
className="h-5 w-5"
|
||||
>
|
||||
<Copy className="h-3 w-3" />
|
||||
</Button>
|
||||
)}
|
||||
{onPasteAutomation && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={onPasteAutomation}
|
||||
title="Paste automation data"
|
||||
className="h-5 w-5"
|
||||
>
|
||||
<Clipboard className="h-3 w-3" />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Show/hide toggle - Positioned absolutely on the right */}
|
||||
<Button
|
||||
variant="ghost"
|
||||
|
||||
Reference in New Issue
Block a user