Skip to content

Commit a14fd97

Browse files
committed
feat: Enhance detail screen and improve download handling
- Center-align detail screen header and description for better layout - Add tags display section in detail screen for addons with custom.tags - Remove version display from detail header (redundant with stats) - Prioritize latest_release URL over version-specific downloads in AddonMetadata - Filter out meteor-addon-template repository from addon listings - Add code-search-usage documentation for AI reference These changes improve the user experience by making the detail screen more visually balanced, providing better download URL selection, and preventing the template repository from appearing in search results.
1 parent 41a4c51 commit a14fd97

4 files changed

Lines changed: 47 additions & 18 deletions

File tree

.agent/rules/code-search-usage.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
trigger: model_decision
3+
description: Use this rule whenever you invoke any tool from code-search-mcp
4+
---
5+
6+
Do not try and create a new workspace, we already have one set it.
7+
Always supply `meteor-addons-addon` as the workspace ID when needed (this is our pre-existing workspace)

src/main/java/com/cope/meteoraddons/gui/screens/AddonDetailScreen.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public AddonDetailScreen(GuiTheme theme, Addon addon, Screen parent) {
4040
@Override
4141
public void initWidgets() {
4242
// Header Section (Icon + Details)
43-
WHorizontalList header = add(theme.horizontalList()).expandX().widget();
43+
WHorizontalList header = add(theme.horizontalList()).centerX().widget();
4444

4545
// Icon
4646
Texture iconTexture = IconCache.get(addon);
@@ -61,17 +61,7 @@ public void initWidgets() {
6161
titleRow.add(theme.label("(Installed)", true).color(theme.textSecondaryColor())).padLeft(4);
6262
}
6363

64-
if (addon instanceof OnlineAddon) {
65-
AddonMetadata metadata = ((OnlineAddon) addon).getMetadata();
66-
if (metadata.verified) {
67-
details.add(theme.label("Verified").color(theme.textSecondaryColor()));
68-
}
69-
}
70-
71-
String version = addon.getVersion();
72-
if (version != null && !version.isEmpty()) {
73-
details.add(theme.label("Version: " + version).color(theme.textSecondaryColor()));
74-
}
64+
7565

7666
List<String> authors = addon.getAuthors();
7767
if (!authors.isEmpty()) {
@@ -82,8 +72,21 @@ public void initWidgets() {
8272

8373
// Description
8474
addon.getDescription().ifPresent(desc -> {
85-
add(theme.label(desc, getWindowWidth() / 2.0));
75+
add(theme.label(desc, getWindowWidth() / 2.0)).centerX();
8676
});
77+
78+
// Tags
79+
if (addon instanceof OnlineAddon) {
80+
AddonMetadata metadata = ((OnlineAddon) addon).getMetadata();
81+
if (metadata.custom != null && metadata.custom.tags != null && !metadata.custom.tags.isEmpty()) {
82+
WHorizontalList tagsList = add(theme.horizontalList()).centerX().padTop(3).widget();
83+
tagsList.add(theme.label("Tags: ").color(theme.textSecondaryColor()));
84+
85+
for (String tag : metadata.custom.tags) {
86+
tagsList.add(theme.label(tag)).padRight(6);
87+
}
88+
}
89+
}
8790

8891
// Stats (Online Addons only)
8992
if (addon instanceof OnlineAddon) {

src/main/java/com/cope/meteoraddons/models/AddonMetadata.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.cope.meteoraddons.util.VersionUtil;
44

55
import java.util.List;
6+
import java.util.ArrayList;
67

78
/**
89
* Meteor addon metadata from scanner JSON.
@@ -72,15 +73,27 @@ public String getHomepageUrl() {
7273
}
7374

7475
public String[] getDownloadUrls() {
75-
if (links == null || links.downloads == null || links.downloads.isEmpty()) {
76+
if (links == null) {
7677
return new String[0];
7778
}
7879

79-
String currentVersion = VersionUtil.getCurrentMinecraftVersion();
80+
List<String> urls = new ArrayList<>();
81+
82+
// Priority 1: Latest Release
83+
if (links.latest_release != null && !links.latest_release.isEmpty()) {
84+
urls.add(links.latest_release);
85+
}
86+
87+
// Priority 2: Compatible downloads from the list
88+
if (links.downloads != null && !links.downloads.isEmpty()) {
89+
String currentVersion = VersionUtil.getCurrentMinecraftVersion();
90+
91+
links.downloads.stream()
92+
.filter(url -> url != null && url.contains(currentVersion))
93+
.forEach(urls::add);
94+
}
8095

81-
return links.downloads.stream()
82-
.filter(url -> url != null && url.contains(currentVersion))
83-
.toArray(String[]::new);
96+
return urls.toArray(String[]::new);
8497
}
8598

8699
public static class Features {
@@ -106,6 +119,7 @@ public static class Repository {
106119
public static class Links {
107120
public String github;
108121
public List<String> downloads;
122+
public String latest_release;
109123
public String discord;
110124
public String homepage;
111125
public String icon;

src/main/java/com/cope/meteoraddons/systems/AddonManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ public void fetchAddonMetadata() {
122122
List<AddonMetadata> filteredMetadata = availableAddons.stream()
123123
.filter(AddonMetadata::supportsCurrentVersion)
124124
.filter(addon -> addon.verified)
125+
.filter(addon -> {
126+
// Hardcoded ignore for template repo
127+
if (addon.repo == null || addon.repo.id == null) return true;
128+
return !addon.repo.id.equalsIgnoreCase("meteordevelopment/meteor-addon-template");
129+
})
125130
.collect(Collectors.toMap(
126131
addon -> addon.name,
127132
addon -> addon,

0 commit comments

Comments
 (0)