Skip to content

Commit

Permalink
New Sorting Type: Has Update (#793)
Browse files Browse the repository at this point in the history
* feat: update sort

* chore: add back whitespace to reduce diff

- Add sort option to sort by update
  • Loading branch information
andantet authored Dec 3, 2024
1 parent 67a3f8a commit 63c4a74
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ public static SimpleOption<?>[] asOptions() {
}

public enum Sorting {
ASCENDING(Comparator.comparing(mod -> mod.getTranslatedName()
.toLowerCase(Locale.ROOT))), DESCENDING(ASCENDING.getComparator().reversed());
ASCENDING(Comparator.comparing(mod -> mod.getTranslatedName().toLowerCase(Locale.ROOT))),
DESCENDING(ASCENDING.getComparator().reversed()),
HAS_UPDATE(Comparator.comparing(Mod::hasUpdate).reversed());

private final Comparator<Mod> comparator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected void init() {
Text sortingText = ModMenuConfig.SORTING.getButtonText();
Text librariesText = ModMenuConfig.SHOW_LIBRARIES.getButtonText();

int sortingWidth = textRenderer.getWidth(sortingText) + 20;
int sortingWidth = textRenderer.getWidth(sortingText) + 28;
int librariesWidth = textRenderer.getWidth(librariesText) + 20;

this.filtersWidth = librariesWidth + sortingWidth + 2;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/modmenu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"option.modmenu.sorting": "Sort",
"option.modmenu.sorting.ascending": "A-Z",
"option.modmenu.sorting.descending": "Z-A",
"option.modmenu.sorting.has_update": "Has Update",
"option.modmenu.show_libraries": "Libraries",
"option.modmenu.show_libraries.true": "Shown",
"option.modmenu.show_libraries.false": "Hidden",
Expand Down

0 comments on commit 63c4a74

Please sign in to comment.