import { useMemo } from "react" import { useTranslation } from "react-i18next" import { AutomationEngine, AutomationMode } from "../../services/automation-engine" import { AutomationLaneComponent } from "./automation-lane" import { AutomationPanel } from "./automation-panel" interface AutomationViewProps { automationEngine: AutomationEngine currentTime: number pixelsPerSecond?: number laneHeight?: number totalWidth?: number } export function AutomationView({ automationEngine, currentTime, pixelsPerSecond = 50, laneHeight = 60, totalWidth = 2000, }: AutomationViewProps) { const { t } = useTranslation() const state = automationEngine.getState() const visibleLanes = useMemo(() => Array.from(state.lanes.values()).filter((lane) => lane.isVisible), [state.lanes]) const handleModeChange = (mode: AutomationMode) => { automationEngine.setMode(mode) } const handleStartRecording = () => { automationEngine.startRecording() } const handleStopRecording = () => { automationEngine.stopRecording() } const handleAddLane = (channelId: string, parameterId: string) => { const lane = automationEngine.createLane(channelId, parameterId) automationEngine.toggleLaneVisibility(lane.id) } const handleClearLane = (laneId: string) => { const lane = state.lanes.get(laneId) if (lane) { // Оставляем только первую точку const firstPoint = lane.points[0] if (firstPoint) { lane.points = [firstPoint] } } } const handlePointsChange = (laneId: string, points: any[]) => { const lane = state.lanes.get(laneId) if (lane) { lane.points = points } } const handleVisibilityToggle = (laneId: string) => { automationEngine.toggleLaneVisibility(laneId) } return (
{t("fairlightAudio.automationView.noLanesVisible")}
{t("fairlightAudio.automationView.addLanePrompt")}