Skip to content

Commit

Permalink
sort theorems alphabetically #110
Browse files Browse the repository at this point in the history
  • Loading branch information
joneugster committed Jun 12, 2024
1 parent 8b4215e commit b815b86
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client/src/components/inventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ function InventoryList({ items, tab=null, setTab=()=>{} } :
</div>}
<div className="inventory-list">
{[...modifiedItems].sort(
// For lemas, sort entries `available > disabled > locked`
// otherwise alphabetically
(x, y) => +(categoryTab == "theorem") * (+x.locked - +y.locked || +x.disabled - +y.disabled) || x.displayName.localeCompare(y.displayName)
// alternative approach:
// // For theorems, sort entries `available > disabled > locked`
// // otherwise alphabetically
// (x, y) => +(categoryTab == "theorem") * (+x.locked - +y.locked || +x.disabled - +y.disabled) || x.displayName.localeCompare(y.displayName)

// sort alphabetically
(x, y) => x.displayName.localeCompare(y.displayName)
).filter(item => !item.hidden && ((tab ?? categories[0]) == item.category)).map((item, i) => {
return <InventoryItem key={`${item.category}-${item.name}`}
item={item}
Expand Down

0 comments on commit b815b86

Please sign in to comment.