import React, { useState } from 'react'; import { RecorderService } from '../services/recorder.service'; import { PlayerService } from '../services/player.service'; const recorder = new RecorderService(); const player = new PlayerService(); const App: React.FC = () => { const [recording, setRecording] = useState(false); const [basicCode, setBasicCode] = useState(''); const handleStartRecording = async () => { setRecording(true); await recorder.startRecording(); }; const handleStopRecording = async () => { setRecording(false); const code = await recorder.stopRecording(); setBasicCode(code); // Save to file const blob = new Blob([code], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'automation.bas'; a.click(); }; const handlePlayback = async () => { try { await player.executeBasicCode(basicCode); } catch (error) { console.error('Playback error:', error); } }; return (
{basicCode}