+ {dbStatus === "idle" &&
}
+ {dbStatus === "error" && (
+
+ Couldn't initialize DuckDB 😕
+
+ )}
+ {dbStatus === "success" && (
+ <>
+
+ {
+ setQuery(value);
+ }}
+ />
+
+
+ {status === "error" && error && (
+
+ {(error as Error)?.message || "An unexpected error occurred."}
+
+ )}
+
+ {status === "loading" && (
+
+
+
+ )}
+ {data && (
+
{
+ setQuery(`select * from '${filenameWithoutExtension}'`);
+ }}
+ >
+ {}}
+ />
+
+ )}
+
+
+ >
+ )}
+
+ );
+}
+
+export function DBExplorer(props: Props) {
+ const { sha, filename, owner, name } = props;
+ const { data, status } = useDataFile(
+ {
+ sha,
+ filename,
+ owner,
+ name,
+ },
+ {
+ refetchOnWindowFocus: false,
+ retry: false,
+ }
+ );
+
+ const extension = filename.split(".").pop() || "";
+ const content = data ? data[0].content : "";
+
+ return (
+ <>
+ {status === "loading" &&