import React, { useState, useRef, useEffect } from 'react'; import { ChevronRight, ChevronLeft, Check, Copy, Terminal, Rocket, Settings, AlertCircle, RefreshCw } from 'lucide-react'; interface OnboardingWizardProps { onComplete?: () => void; } export const OnboardingWizard: React.FC = ({ onComplete }) => { const [currentStep, setCurrentStep] = useState(1); const [webhookUrl, setWebhookUrl] = useState(''); const [copied, setCopied] = useState(false); const [isGenerating, setIsGenerating] = useState(false); const stepRef = useRef(null); // Focus management for accessibility useEffect(() => { if (stepRef.current) { stepRef.current.focus(); } }, [currentStep]); const generateWebhook = () => { setIsGenerating(true); // Simulate generation delay setTimeout(() => { const uuid = crypto.randomUUID(); setWebhookUrl(`https://logwhisperer.ai/webhook/${uuid}`); setIsGenerating(false); }, 1000); }; const copyWebhook = () => { navigator.clipboard.writeText(webhookUrl); setCopied(true); setTimeout(() => setCopied(false), 2000); }; const copyCurlCommand = () => { const command = `curl -fsSL https://logwhisperer.ai/install.sh | bash -s -- --webhook ${webhookUrl}`; navigator.clipboard.writeText(command); setCopied(true); setTimeout(() => setCopied(false), 2000); }; const nextStep = () => { if (currentStep < 3) { setCurrentStep(currentStep + 1); } else { onComplete?.(); } }; const prevStep = () => { if (currentStep > 1) { setCurrentStep(currentStep - 1); } }; const getInstallCommand = () => { return webhookUrl ? `curl -fsSL https://logwhisperer.ai/install.sh | bash -s -- --webhook ${webhookUrl}` : 'curl -fsSL https://logwhisperer.ai/install.sh | bash'; }; const steps = [ { number: 1, title: 'Benvenuto', icon: }, { number: 2, title: 'Webhook', icon: }, { number: 3, title: 'Setup', icon: }, ]; return (
{/* Section Header */}

Inizia in 3 semplici passi

Configura LogWhisperer AI sul tuo server in meno di 5 minuti.

{/* Step Indicator */} {/* Wizard Content */}
{/* Step 1: Welcome */} {currentStep === 1 && (

Benvenuto su LogWhisperer AI

Il tuo assistente DevOps personale che monitora i log del server e ti avvisa immediatamente quando qualcosa va storto, suggerendoti il comando esatto per risolvere il problema.

Cosa succederà:

  • 1. Genereremo un webhook URL univoco per il tuo account
  • 2. Installerai uno script leggero sul tuo server
  • 3. Inizierai a ricevere notifiche intelligenti su Telegram

⏱️ Tempo stimato: 5 minuti

💰 Nessuna carta di credito richiesta

)} {/* Step 2: Webhook Generation */} {currentStep === 2 && (

Genera il tuo Webhook

Clicca il pulsante qui sotto per generare il tuo webhook URL univoco. Questo URL riceverà i log dal tuo server.

{!webhookUrl ? (
) : (
Il tuo webhook URL:
{webhookUrl}

Webhook generato con successo! Procedi allo step successivo per installare lo script.

)}
)} {/* Step 3: Setup Instructions */} {currentStep === 3 && (

Installa sul tuo Server

Esegui questo comando sul tuo server per installare LogWhisperer. Lo script configurerà automaticamente il monitoraggio dei log.

Comando di installazione:
{getInstallCommand()}

Istruzioni:

  1. 1 Connettiti al tuo server via SSH
  2. 2 Esegui il comando copiato sopra
  3. 3 Segui la configurazione guidata
  4. 4 Controlla Telegram per il messaggio di conferma

Nota: Lo script richiede privilegi sudo per installare il servizio di sistema. Nessun dato sensibile viene inviato durante l'installazione.

)} {/* Navigation Buttons */}
); }; export default OnboardingWizard;