import { Tabs, TabPane } from "@douyinfe/semi-ui"; import { Tab } from "../../data/constants"; import { useLayout, useSelect, useDiagram } from "../../hooks"; import RelationshipsTab from "./RelationshipsTab/RelationshipsTab"; import TypesTab from "./TypesTab/TypesTab"; import Issues from "./Issues"; import AreasTab from "./AreasTab/AreasTab"; import NotesTab from "./NotesTab/NotesTab"; import TablesTab from "./TablesTab/TablesTab"; import { useTranslation } from "react-i18next"; import { useMemo } from "react"; import { databases } from "../../data/databases"; import EnumsTab from "./EnumsTab/EnumsTab"; export default function SidePanel({ width, resize, setResize }) { const { layout } = useLayout(); const { selectedElement, setSelectedElement } = useSelect(); const { database } = useDiagram(); const { t } = useTranslation(); const tabList = useMemo(() => { const tabs = [ { tab: t("tables"), itemKey: Tab.TABLES, component: }, { tab: t("relationships"), itemKey: Tab.RELATIONSHIPS, component: , }, { tab: t("subject_areas"), itemKey: Tab.AREAS, component: }, { tab: t("notes"), itemKey: Tab.NOTES, component: }, ]; if (databases[database].hasTypes) { tabs.push({ tab: t("types"), itemKey: Tab.TYPES, component: , }); } if (databases[database].hasEnums) { tabs.push({ tab: t("enums"), itemKey: Tab.ENUMS, component: , }); } return tabs; }, [t, database]); return (
setSelectedElement((prev) => ({ ...prev, currentTab: key })) } collapsible > {tabList.length && tabList.map((tab) => (
{tab.component}
))}
{layout.issues && (
)}
e.isPrimary && setResize(true)} >
); }