Skip to content

Commit

Permalink
fix(web): fix function list folder name display (#1561)
Browse files Browse the repository at this point in the history
  • Loading branch information
newfish-cmyk authored Oct 7, 2023
1 parent f360709 commit 1f7d6af
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions web/src/pages/app/functions/mods/FunctionPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,30 +222,31 @@ export default function FunctionList() {
if (item.children?.length) {
fileType = FileType.folder;
}
const level = item.level || item?.name.split("/").length - 1;
const nameParts = item.name.split("/");
const level = item.level || nameParts.length - 1;
const itemDisplay = (() => {
if (
item.children?.length ||
isFuncList ||
commonSettings.funcListDisplay === "name" ||
!item.desc
) {
return <span>{item.name.split("/")[level]}</span>;
return <span>{nameParts[nameParts.length - 1]}</span>;
} else if (commonSettings.funcListDisplay === "desc") {
return <span>{item.desc}</span>;
} else if (commonSettings.funcListDisplay === "desc-name") {
return (
<span className="flex items-center">
<span>{item.desc}</span>
<div className="ml-1 translate-y-[1px] scale-[.85] opacity-75">{` ${
item.name.split("/")[level]
nameParts[nameParts.length - 1]
}`}</div>
</span>
);
} else {
return (
<span className="flex items-center">
<span>{item.name.split("/")[level]}</span>
<span>{nameParts[nameParts.length - 1]}</span>
<div className="ml-1 translate-y-[1px] scale-[.85] opacity-75">{` ${item.desc}`}</div>
</span>
);
Expand Down

0 comments on commit 1f7d6af

Please sign in to comment.