From 3587b014b6404a1034792076852788cf2b0d7c12 Mon Sep 17 00:00:00 2001 From: Visal In Date: Tue, 19 Mar 2024 16:40:19 +0700 Subject: [PATCH] fix: non-login user should not see remote option --- src/app/connect/connection-list.tsx | 1 + src/app/connect/saved-connection.tsx | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/connect/connection-list.tsx b/src/app/connect/connection-list.tsx index 546c39b0..abf98d14 100644 --- a/src/app/connect/connection-list.tsx +++ b/src/app/connect/connection-list.tsx @@ -164,6 +164,7 @@ export default function ConnectionList({ if (showAddConnection) { return ( setShowAddConnection(false)} onSaveComplete={onSaveComplete} /> diff --git a/src/app/connect/saved-connection.tsx b/src/app/connect/saved-connection.tsx index 35f11e15..68def16e 100644 --- a/src/app/connect/saved-connection.tsx +++ b/src/app/connect/saved-connection.tsx @@ -11,18 +11,25 @@ import { } from "@/app/connect/saved-connection-storage"; import SavedConnectionConfig from "./saved-connection-config"; import { createDatabase } from "@/lib/api/fetch-databases"; +import { User } from "lucia"; type SaveConnectionStep = "storage" | "config"; export default function SaveConnection({ + user, onSaveComplete, onClose, }: Readonly<{ + user: User | null; onSaveComplete: (storageType: SavedConnectionItem) => void; onClose: () => void; }>) { - const [storage, setStorage] = useState(); - const [step, setStep] = useState("storage"); + const [storage, setStorage] = useState( + user ? undefined : "local" + ); + const [step, setStep] = useState( + user ? "storage" : "config" + ); const [loading, setLoading] = useState(false); const onConnectionTypeSelected = useCallback(