import React, { useState } from 'react'; import { Button } from '@/components/ui/button'; import { Toast, ToastDescription, ToastProvider, ToastTitle, ToastViewport } from '@/components/ui/toast'; import { RefreshCw, CheckCircle, FolderOpen, Clock } from "lucide-react"; interface StatusBoxProps { rootPath: string; isWritable: boolean; lastGenerated: string | null; onGenerateNow: () => Promise<{success: boolean, message: string, timestamp?: string}>; } export function StatusBox({ rootPath, isWritable, lastGenerated, onGenerateNow }: StatusBoxProps) { const [isGenerating, setIsGenerating] = useState(false); const [toast, setToast] = useState<{open: boolean, title: string, description: string, variant: 'default' | 'destructive'}>({ open: false, title: '', description: '', variant: 'default' }); const [lastGeneratedTime, setLastGeneratedTime] = useState(lastGenerated); const handleGenerateNow = async () => { setIsGenerating(true); try { const result = await onGenerateNow(); if (result.success) { setToast({ open: true, title: 'Success', description: result.message, variant: 'default' }); if (result.timestamp) { setLastGeneratedTime(result.timestamp); } } else { setToast({ open: true, title: 'Error', description: result.message, variant: 'destructive' }); } } catch (error) { setToast({ open: true, title: 'Error', description: 'Error generating LLMS.txt. Please check server permissions.', variant: 'destructive' }); } finally { setIsGenerating(false); } }; return ( <>

LLMS.txt Status

Root Directory:
{rootPath} {isWritable ? "Writable" : "Not Writable"}
Last Generated:

{lastGeneratedTime || 'Never'}

setToast(prev => ({ ...prev, open }))} variant={toast.variant} >
{toast.title} {toast.description}
); }