fix: enable text selection in results panel and preserve AI prompt

Add select-text to override global user-select:none on results table,
JSON view, error messages, and AI explanation. Also keep AI prompt text
after generation with a clear button.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 19:10:36 +03:00
parent 3ad0ee5cc3
commit c8ba0eac81
4 changed files with 17 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { AiSettingsPopover } from "./AiSettingsPopover";
import { useGenerateSql } from "@/hooks/use-ai";
import { Sparkles, Loader2, X } from "lucide-react";
import { Sparkles, Loader2, X, Eraser } from "lucide-react";
import { toast } from "sonner";
interface Props {
@@ -24,7 +24,6 @@ export function AiBar({ connectionId, onSqlGenerated, onClose, onExecute }: Prop
{
onSuccess: (sql) => {
onSqlGenerated(sql);
setPrompt("");
},
onError: (err) => {
toast.error("AI generation failed", { description: String(err) });
@@ -77,6 +76,18 @@ export function AiBar({ connectionId, onSqlGenerated, onClose, onExecute }: Prop
"Generate"
)}
</Button>
{prompt.trim() && (
<Button
size="sm"
variant="ghost"
className="h-6 w-6 p-0"
onClick={() => setPrompt("")}
title="Clear prompt"
disabled={generateMutation.isPending}
>
<Eraser className="h-3 w-3" />
</Button>
)}
<AiSettingsPopover />
<Button
size="sm"