import { useEffect, useState } from "preact/hooks"; import { t } from "../services/i18n"; import { useNoteContext } from "./react/hooks"; import "./sql_table_schemas.css"; import { SchemaResponse } from "@triliumnext/commons"; import server from "../services/server"; import Dropdown from "./react/Dropdown"; export default function SqlTableSchemas() { const { note } = useNoteContext(); const [ schemas, setSchemas ] = useState(); useEffect(() => { server.get("sql/schema").then(setSchemas); }, []); const isEnabled = note?.mime === "text/x-sqlite;schema=trilium" && schemas; return (
{isEnabled && ( <> {t("sql_table_schemas.tables")}{": "} {schemas.map(({ name, columns }) => ( <> {columns.map(column => ( ))}
{column.name} {column.type}
{" "} ))}
)}
) }