Fix mod description rendering

This commit is contained in:
Danielv123 committed 2025-04-08 20:52:56 +02:00
1 parent 2ae3f9a600
commit 3fae97ac8b
1 file changed
+23 -9
+23 -9
View File
@@ -247,15 +247,27 @@ function SearchModsButton() {
expandable={{ expandable={{
expandedRowRender: record => ( expandedRowRender: record => (
<div> <div>
<p><strong>Summary:</strong> {record.summary}</p> <p><strong>Summary:</strong> {record.summary ?? "N/A"}</p>
<p><strong>Downloads:</strong> {record.downloads_count}</p> <p><strong>Downloads:</strong> {record.downloads_count ?? "N/A"}</p>
<p><strong>Latest Release:</strong></p> <p><strong>Latest Release:</strong></p>
<ul> {record.latest_release ? (
<li>Version: {record.latest_release.version}</li> <ul>
<li>Factorio Version: {record.latest_release.info_json.factorio_version}</li> <li>Version: {record.latest_release.version ?? "N/A"}</li>
<li>Released: {new Date(record.latest_release.released_at).toLocaleString()}</li> <li>
</ul> Factorio Version: {
{account.hasPermission("core.mod.download") && ( record.latest_release.factorio_version ?? "N/A"
}
</li>
<li>
Released: {
record.latest_release.released_at
? new Date(record.latest_release.released_at).toLocaleString()
: "N/A"
}
</li>
</ul>
) : <p>No release information available.</p>}
{account.hasPermission("core.mod.download") && record.latest_release && (
<Button <Button
onClick={() => { onClick={() => {
control.send( control.send(
@@ -268,6 +280,8 @@ function SearchModsButton() {
notifyErrorHandler("Error downloading mod") notifyErrorHandler("Error downloading mod")
); );
}} }}
// Disable button if version is missing
disabled={!record.latest_release.version}
> >
Download Latest Version Download Latest Version
</Button> </Button>
@@ -300,7 +314,7 @@ function SearchModsButton() {
{ {
title: "Latest Version", title: "Latest Version",
key: "version", key: "version",
render: (_, record) => record.latest_release.version, render: (_, record) => record.latest_release?.version ?? "N/A",
}, },
]} ]}
/> />