diff --git a/package.json b/package.json index 16174cb2..bf2e4bfb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "libsql-studio", - "version": "0.2.1", + "version": "0.2.2", "private": true, "scripts": { "dev": "next dev", diff --git a/src/app/connect/connection-list.tsx b/src/app/connect/connection-list.tsx index dfe04efc..546c39b0 100644 --- a/src/app/connect/connection-list.tsx +++ b/src/app/connect/connection-list.tsx @@ -18,6 +18,7 @@ import RemoveSavedConnection from "./saved-remove-connection"; import ConnectionItemCard from "./saved-connection-card"; import { getDatabases } from "@/lib/api/fetch-databases"; import { User } from "lucia"; +import QuickConnect from "./quick-connect"; function ConnectionListSection({ data, @@ -69,6 +70,7 @@ function ConnectionListSection({ export default function ConnectionList({ user, }: Readonly<{ user: User | null }>) { + const [quickConnect, setQuickConnect] = useState(false); const [showAddConnection, setShowAddConnection] = useState(false); const [removeConnection, setRemoveConnection] = useState(); @@ -168,6 +170,10 @@ export default function ConnectionList({ ); } + if (quickConnect) { + return setQuickConnect(false)} />; + } + return ( <>
@@ -180,7 +186,14 @@ export default function ConnectionList({ New Connection - +
{removeConnection && ( diff --git a/src/app/connect/quick-connect.tsx b/src/app/connect/quick-connect.tsx new file mode 100644 index 00000000..eba2897a --- /dev/null +++ b/src/app/connect/quick-connect.tsx @@ -0,0 +1,44 @@ +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; +import ConnectionDialogContent from "./saved-connection-content"; +import { useCallback, useState } from "react"; +import useConnect from "@/hooks/use-connect"; + +export default function QuickConnect({ + onClose, +}: Readonly<{ onClose: () => void }>) { + const [url, setURL] = useState(""); + const [token, setToken] = useState(""); + const connect = useConnect(); + + const onConnect = useCallback(() => { + connect(url, token); + }, [connect, url, token]); + + return ( + +
+
URL
+ setURL(e.currentTarget.value)} + /> +
+ +
+
Token
+