Skip to content

Commit

Permalink
fix: Revert sorting code (#2349)
Browse files Browse the repository at this point in the history
  • Loading branch information
anth-volk authored Feb 7, 2025
1 parent b43fb4a commit 4689c04
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions src/pages/PolicyPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,6 @@ function PolicyLeftSidebar(props) {
const POLICY_OUTPUT_TREE = getPolicyOutputTree(metadata.countryId);
const selected = searchParams.get("focus") || "";

function recursiveAlphaSort(tree) {
if (!tree) {
return [];
}

let sorted = tree.sort((a, b) => {
// JS sorts by ASCII value - Z comes before a
if (a.label.toLowerCase() < b.label.toLowerCase()) {
return -1;
}
if (a.label.toLowerCase() > b.label.toLowerCase()) {
return 1;
}
return 0;
});

for (let i = 0; i < sorted.length; i++) {
sorted[i].children = recursiveAlphaSort(sorted[i].children);
}

return sorted;
}

const firstTree = recursiveAlphaSort(metadata.parameterTree.children);

const onSelect = (name) => {
let newSearch = copySearchParams(searchParams);
newSearch.set("focus", name);
Expand All @@ -101,8 +76,7 @@ function PolicyLeftSidebar(props) {
</div>
)}
<StackedMenu
// firstTree={metadata.parameterTree.children}
firstTree={firstTree}
firstTree={metadata.parameterTree.children}
selected={selected}
onSelect={onSelect}
secondTree={POLICY_OUTPUT_TREE[0].children}
Expand Down

0 comments on commit 4689c04

Please sign in to comment.