import { IpcClient } from "@/ipc/ipc_client"; import { Dialog, DialogTitle } from "@radix-ui/react-dialog"; import { DialogContent, DialogHeader } from "./ui/dialog"; import { Button } from "./ui/button"; import { BugIcon, Camera } from "lucide-react"; import { useState } from "react"; import { ScreenshotSuccessDialog } from "./ScreenshotSuccessDialog"; interface BugScreenshotDialogProps { isOpen: boolean; onClose: () => void; handleReportBug: () => Promise; isLoading: boolean; } export function BugScreenshotDialog({ isOpen, onClose, handleReportBug, isLoading, }: BugScreenshotDialogProps) { const [isScreenshotSuccessOpen, setIsScreenshotSuccessOpen] = useState(false); const [screenshotError, setScreenshotError] = useState(null); const handleReportBugWithScreenshot = async () => { setScreenshotError(null); onClose(); setTimeout(async () => { try { await IpcClient.getInstance().takeScreenshot(); setIsScreenshotSuccessOpen(true); } catch (error) { setScreenshotError( error instanceof Error ? error.message : "Failed to take screenshot", ); } }, 200); // Small delay for dialog to close }; return ( Take a screenshot?

You'll get better and faster responses if you do this!

We'll still try to respond but might not be able to help as much.

{screenshotError && (

Failed to take screenshot: {screenshotError}

)}
setIsScreenshotSuccessOpen(false)} handleReportBug={handleReportBug} isLoading={isLoading} />
); }