fix(GenericNode): sort template fields alphabetically with special handling for "code" field to be displayed first
The changes in this commit fix the sorting of template fields in the GenericNode component. Previously, the fields were sorted alphabetically, but with this change, the "code" field is prioritized and displayed first. This change improves the user experience by making the "code" field more prominent and easily accessible.
This commit is contained in:
parent
bf11ee9a10
commit
fb58388504
1 changed files with 9 additions and 1 deletions
|
|
@ -417,7 +417,15 @@ export default function GenericNode({
|
|||
<>
|
||||
{Object.keys(data.node!.template)
|
||||
.filter((templateField) => templateField.charAt(0) !== "_")
|
||||
.sort()
|
||||
.sort((a, b) => {
|
||||
if (a.toLowerCase() === "code") {
|
||||
return -1;
|
||||
} else if (b.toLowerCase() === "code") {
|
||||
return 1;
|
||||
} else {
|
||||
return a.localeCompare(b);
|
||||
}
|
||||
})
|
||||
.map((templateField: string, idx) => (
|
||||
<div key={idx}>
|
||||
{data.node!.template[templateField].show &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue