/* Copyright 2026 Marimo. All rights reserved. */ import { BoxIcon, XIcon } from "lucide-react"; import { useEffect, useState } from "react"; import { useEvent } from "react-use-event-hook"; import { useAlertActions, useAlerts } from "@/core/alerts/state"; import { Banner } from "@/plugins/impl/common/error-banner"; import { Button } from "../../ui/button"; export const StartupLogsAlert: React.FC = () => { const { startupLogsAlert } = useAlerts(); const { clearStartupLogsAlert } = useAlertActions(); const [hasCleared, setHasCleared] = useState(false); const status = startupLogsAlert?.status; const handleClear = useEvent(() => { clearStartupLogsAlert(); setHasCleared(true); }); const isDone = status === "done"; const isRunning = status === "start" || status === "append"; useEffect(() => { let timeout: number | undefined; if (isDone) { // Dismiss after 5 seconds timeout = window.setTimeout(() => handleClear(), 5000); } return () => { if (timeout) { window.clearTimeout(timeout); } }; }, [isDone]); if (startupLogsAlert === null || hasCleared) { return null; } return (
{isRunning ? "Initializing..." : "Initialized"}
              {startupLogsAlert.content || "Starting startup script..."}
            
); };