Add Latest Change Date to Frontend (#3231)

* Updated Logic for Versions

* Update logic, add date
This commit is contained in:
Michel Roegl-Brunner 2025-03-18 15:19:11 +01:00 committed by GitHub
parent 84314249b2
commit 4e36061ced
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 6 deletions

View file

@ -95,7 +95,26 @@ function ScriptItem({
<div>{versions.length === 0 ? (<p>Loading versions...</p>) :
(<>
<p className="text-l text-foreground">Version:</p>
<p className="text-l text-muted-foreground">{versions.find((v) => v.name === item.slug.replace(/[^a-z0-9]/g, ''))?.version || "No Version Information found"}</p>
<p className="text-l text-muted-foreground">{versions.find((v) =>
v.name === item.slug.replace(/[^a-z0-9]/g, '') ||
v.name.includes(item.slug.replace(/[^a-z0-9]/g, '')) ||
v.name.replace(/[^a-z0-9]/g, '') === item.slug.replace(/[^a-z0-9]/g, '')
)?.version || "No Version information found"
}</p>
<p className="text-l text-foreground">Latest changes:</p>
<p className="text-l text-muted-foreground">
{(() => {
const matchedVersion = versions.find((v) =>
v.name === item.slug.replace(/[^a-z0-9]/g, '') ||
v.name.includes(item.slug.replace(/[^a-z0-9]/g, '')) ||
v.name.replace(/[^a-z0-9]/g, '') === item.slug.replace(/[^a-z0-9]/g, '')
);
return matchedVersion?.date ?
extractDate(matchedVersion.date as unknown as string) :
"No date information found"
})()}
</p>
</>)
}
</div>