diff --git a/package.json b/package.json index 55a3966..62d1060 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "sqlchat", "private": false, "scripts": { - "dev": "next dev", + "dev": "next dev --turbo", "build": "next build", "export": "next export", "start": "next start", diff --git a/src/components/CodeBlock.tsx b/src/components/CodeBlock.tsx index 194f2b0..4836ce1 100644 --- a/src/components/CodeBlock.tsx +++ b/src/components/CodeBlock.tsx @@ -1,9 +1,10 @@ import { toast } from "react-hot-toast"; +import { useTranslation } from "react-i18next"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { oneDark } from "react-syntax-highlighter/dist/cjs/styles/prism"; import { useConnectionStore, useQueryStore } from "@/store"; -import { checkStatementIsSelect } from "@/utils"; import Icon from "./Icon"; +import Tooltip from "./kit/Tooltip"; interface Props { language: string; @@ -12,14 +13,14 @@ interface Props { export const CodeBlock = (props: Props) => { const { language, value } = props; + const { t } = useTranslation(); const connectionStore = useConnectionStore(); const queryStore = useQueryStore(); const currentConnectionCtx = connectionStore.currentConnectionCtx; // Only show execute button in the following situations: - // * SQL code, and it is a SELECT statement; + // * SQL code; // * Connection setup; - const showExecuteButton = - language.toUpperCase() === "SQL" && checkStatementIsSelect(value) && currentConnectionCtx?.connection && currentConnectionCtx?.database; + const showExecuteButton = currentConnectionCtx?.connection && currentConnectionCtx?.database && language.toUpperCase() === "SQL"; const copyToClipboard = () => { if (!navigator.clipboard || !navigator.clipboard.writeText) { @@ -50,19 +51,23 @@ export const CodeBlock = (props: Props) => {