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 SearchBar from "./SearchBar";
import EnumDetails from "./EnumDetails";
import Empty from "../Empty";
export default function EnumsTab() {
const { enums, addEnum } = useEnums();
@ -19,22 +20,26 @@ export default function EnumsTab() {
</Button>
</div>
</div>
<Collapse accordion>
{enums.map((e, i) => (
<Collapse.Panel
key={`enum_${i}`}
id={`scroll_enum_${i}`}
header={
<div className="overflow-hidden text-ellipsis whitespace-nowrap">
{e.name}
</div>
}
itemKey={`${i}`}
>
<EnumDetails data={e} i={i} />
</Collapse.Panel>
))}
</Collapse>
{enums.length <= 0 ? (
<Empty title={t("no_enums")} text={t("no_enums_text")} />
) : (
<Collapse accordion>
{enums.map((e, i) => (
<Collapse.Panel
key={`enum_${i}`}
id={`scroll_enum_${i}`}
header={
<div className="overflow-hidden text-ellipsis whitespace-nowrap">
{e.name}
</div>
}
itemKey={`${i}`}
>
<EnumDetails data={e} i={i} />
</Collapse.Panel>
))}
</Collapse>
)}
</div>
);
}

View File

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