chore: add prettier and format code files

This commit is contained in:
Steven
2023-05-19 20:05:38 +08:00
parent 9f6d50f4c8
commit 3c057cfa8b
71 changed files with 530 additions and 1290 deletions

View File

@ -1,18 +1,9 @@
import {
useConversationStore,
useConnectionStore,
useMessageStore,
} from "@/store";
import { CreatorRole } from "@/types";
import { generateUUID } from "@/utils";
import { useConversationStore, useConnectionStore, useMessageStore } from "@/store";
import useDarkMode from "@/hooks/useDarkmode";
import Icon from "./Icon";
// examples are used to show some examples to the user.
const examples = [
"Give me an example schema about employee",
"How to create a view in MySQL?",
];
const examples = ["Give me an example schema about employee", "How to create a view in MySQL?"];
interface Props {
className?: string;
@ -27,38 +18,22 @@ const EmptyView = (props: Props) => {
const isDarkMode = useDarkMode();
const handleExampleClick = async (content: string) => {
let conversation = conversationStore.getConversationById(
conversationStore.currentConversationId
);
let conversation = conversationStore.getConversationById(conversationStore.currentConversationId);
if (!conversation) {
const currentConnectionCtx = connectionStore.currentConnectionCtx;
if (!currentConnectionCtx) {
conversation = conversationStore.createConversation();
} else {
conversation = conversationStore.createConversation(
currentConnectionCtx.connection.id,
currentConnectionCtx.database?.name
);
conversation = conversationStore.createConversation(currentConnectionCtx.connection.id, currentConnectionCtx.database?.name);
}
}
await sendMessage(content);
};
return (
<div
className={`${
className || ""
} w-full h-full flex flex-col justify-start items-center`}
>
<div className={`${className || ""} w-full h-full flex flex-col justify-start items-center`}>
<div className="w-96 max-w-full font-medium leading-loose mb-8">
<img
src={
isDarkMode
? "/chat-logo-and-text-dark-mode.webp"
: "/chat-logo-and-text.webp"
}
alt="sql-chat-logo"
/>
<img src={isDarkMode ? "/chat-logo-and-text-dark-mode.webp" : "/chat-logo-and-text.webp"} alt="sql-chat-logo" />
</div>
<div className="w-full grid grid-cols-2 sm:grid-cols-3 gap-4">
<div className="w-full flex flex-col justify-start items-center">