import { useState, useEffect } from "react"; import { Collapse, Badge } from "@douyinfe/semi-ui"; import { arrayIsEqual } from "../../utils/utils"; import { getIssues } from "../../utils/issues"; import { useEnums, useSettings, useDiagram, useTypes } from "../../hooks"; import { useTranslation } from "react-i18next"; export default function Issues() { const { types } = useTypes(); const { t } = useTranslation(); const { settings } = useSettings(); const { enums } = useEnums(); const { tables, relationships, database } = useDiagram(); const [issues, setIssues] = useState([]); useEffect(() => { const findIssues = async () => { const newIssues = getIssues({ tables: tables, relationships: relationships, types: types, database: database, enums: enums, }); if (!arrayIsEqual(newIssues, issues)) { setIssues(newIssues); } }; findIssues(); }, [tables, relationships, issues, types, database, enums]); return ( 0 ? "danger" : "primary"} count={settings.strictMode ? null : issues.length} overflowCount={99} className="mt-1" >
{t("issues")}
} itemKey="1" >
{settings.strictMode ? (
{t("strict_mode_is_on_no_issues")}
) : issues.length > 0 ? ( <> {issues.map((e, i) => (
{e}
))} ) : (
{t("no_issues")}
)}
); }