Show info icon only for generic diagrams

This commit is contained in:
1ilit 2024-06-30 13:22:34 +03:00
parent 810afe4bc0
commit 85ccb19d8f
2 changed files with 25 additions and 18 deletions

View File

@ -1,7 +1,7 @@
import { Collapse, Button, Popover } from "@douyinfe/semi-ui"; import { Collapse, Button, Popover } from "@douyinfe/semi-ui";
import { IconPlus, IconInfoCircle } from "@douyinfe/semi-icons"; import { IconPlus, IconInfoCircle } from "@douyinfe/semi-icons";
import { useSelect, useTypes } from "../../../hooks"; import { useSelect, useTables, useTypes } from "../../../hooks";
import { ObjectType } from "../../../data/constants"; import { DB, ObjectType } from "../../../data/constants";
import Searchbar from "./SearchBar"; import Searchbar from "./SearchBar";
import Empty from "../Empty"; import Empty from "../Empty";
import TypeInfo from "./TypeInfo"; import TypeInfo from "./TypeInfo";
@ -10,6 +10,7 @@ import { useTranslation } from "react-i18next";
export default function TypesTab() { export default function TypesTab() {
const { types, addType } = useTypes(); const { types, addType } = useTypes();
const { selectedElement, setSelectedElement } = useSelect(); const { selectedElement, setSelectedElement } = useSelect();
const { database } = useTables();
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
@ -21,21 +22,23 @@ export default function TypesTab() {
{t("add_type")} {t("add_type")}
</Button> </Button>
</div> </div>
<Popover {database === DB.GENERIC && (
content={ <Popover
<div className="w-[240px] text-sm space-y-2 popover-theme"> content={
{t("types_info") <div className="w-[240px] text-sm space-y-2 popover-theme">
.split("\n") {t("types_info")
.map((line, index) => ( .split("\n")
<div key={index}>{line}</div> .map((line, index) => (
))} <div key={index}>{line}</div>
</div> ))}
} </div>
showArrow }
position="rightTop" showArrow
> position="rightTop"
<Button theme="borderless" icon={<IconInfoCircle />} /> >
</Popover> <Button theme="borderless" icon={<IconInfoCircle />} />
</Popover>
)}
</div> </div>
{types.length <= 0 ? ( {types.length <= 0 ? (
<Empty title={t("no_types")} text={t("no_types_text")} /> <Empty title={t("no_types")} text={t("no_types_text")} />

View File

@ -112,7 +112,7 @@ const en = {
this_will_appear_as_is: "*This will appear in the generated script as is.", this_will_appear_as_is: "*This will appear in the generated script as is.",
comment: "Comment", comment: "Comment",
add_field: "Add field", add_field: "Add field",
values: "values", values: "Values",
size: "Size", size: "Size",
precision: "Precision", precision: "Precision",
set_precision: "Set precision: (size, digits)", set_precision: "Set precision: (size, digits)",
@ -216,6 +216,10 @@ const en = {
generic: "Generic", generic: "Generic",
generic_description: generic_description:
"Generic diagrams can be exported to any SQL flavor but support few data types.", "Generic diagrams can be exported to any SQL flavor but support few data types.",
enums: "Enums",
add_enum: "Add enum",
edit_enum: "Edit enum",
delete_enum: "Delete enum",
}, },
}; };