This PR implements allowing users to take a screenshot for bug reports and addresses issue #1125 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds screenshot capture to bug reports. Users can take a screenshot that’s copied to the clipboard, then continue to file the issue. - **New Features** - New BugScreenshotDialog to take a screenshot or report without one. - ScreenshotSuccessDialog confirms capture and guides users to the GitHub issue. - HelpDialog now opens the screenshot flow; issue template includes an optional Screenshot section. - Electron IPC handler take-screenshot captures the focused window and writes the image to the clipboard; exposed via IpcClient and whitelisted in preload. <sup>Written for commit de0f9b059ae508b56c3c46664559eead3dffa413. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { DialogTitle } from "@radix-ui/react-dialog";
|
|
import { Dialog, DialogContent, DialogHeader } from "./ui/dialog";
|
|
import { Button } from "./ui/button";
|
|
import { BugIcon } from "lucide-react";
|
|
|
|
interface ScreenshotSuccessDialogProps {
|
|
isOpen: boolean;
|
|
onClose: () => void;
|
|
handleReportBug: () => Promise<void>;
|
|
isLoading: boolean;
|
|
}
|
|
|
|
export function ScreenshotSuccessDialog({
|
|
isOpen,
|
|
onClose,
|
|
handleReportBug,
|
|
isLoading,
|
|
}: ScreenshotSuccessDialogProps) {
|
|
const handleSubmit = async () => {
|
|
await handleReportBug();
|
|
onClose();
|
|
};
|
|
return (
|
|
<Dialog open={isOpen} onOpenChange={onClose}>
|
|
<DialogContent>
|
|
<DialogHeader>
|
|
<DialogTitle>
|
|
Screenshot captured to clipboard! Please paste in GitHub issue.
|
|
</DialogTitle>
|
|
</DialogHeader>
|
|
<Button
|
|
variant="default"
|
|
onClick={handleSubmit}
|
|
className="w-full py-6 border-primary/50 shadow-sm shadow-primary/10 transition-all hover:shadow-md hover:shadow-primary/15"
|
|
>
|
|
<BugIcon className="mr-2 h-5 w-5" />{" "}
|
|
{isLoading ? "Preparing Report..." : "Create GitHub issue"}
|
|
</Button>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|