Add empty enums illustration

This commit is contained in:
1ilit 2024-07-04 23:06:09 +03:00
parent a7fd4ec416
commit 3b1af3772e
2 changed files with 23 additions and 16 deletions

View File

@ -4,6 +4,7 @@ import { IconPlus } from "@douyinfe/semi-icons";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import SearchBar from "./SearchBar"; import SearchBar from "./SearchBar";
import EnumDetails from "./EnumDetails"; import EnumDetails from "./EnumDetails";
import Empty from "../Empty";
export default function EnumsTab() { export default function EnumsTab() {
const { enums, addEnum } = useEnums(); const { enums, addEnum } = useEnums();
@ -19,6 +20,9 @@ export default function EnumsTab() {
</Button> </Button>
</div> </div>
</div> </div>
{enums.length <= 0 ? (
<Empty title={t("no_enums")} text={t("no_enums_text")} />
) : (
<Collapse accordion> <Collapse accordion>
{enums.map((e, i) => ( {enums.map((e, i) => (
<Collapse.Panel <Collapse.Panel
@ -35,6 +39,7 @@ export default function EnumsTab() {
</Collapse.Panel> </Collapse.Panel>
))} ))}
</Collapse> </Collapse>
)}
</div> </div>
); );
} }

View File

@ -223,6 +223,8 @@ const en = {
enum_w_no_name: "Found enum with no name", enum_w_no_name: "Found enum with no name",
enum_w_no_values: "Found enum '{{enumName}}' with no values", enum_w_no_values: "Found enum '{{enumName}}' with no values",
duplicate_enums: "Duplicate enums with the name '{{enumName}}'", duplicate_enums: "Duplicate enums with the name '{{enumName}}'",
no_enums: "No enums",
no_enums_text: "Define enums here",
}, },
}; };