diff --git a/frontend/src/app/api/versions/route.ts b/frontend/src/app/api/versions/route.ts index db89160..6dabe96 100644 --- a/frontend/src/app/api/versions/route.ts +++ b/frontend/src/app/api/versions/route.ts @@ -15,11 +15,12 @@ const getVersions = async () => { const filePath = path.resolve(jsonDir, versionsFileName); const fileContent = await fs.readFile(filePath, encoding); const versions: AppVersion[] = JSON.parse(fileContent); - + console.log("Versions: ", versions); const modifiedVersions = versions.map(version => { let newName = version.name; + // Ensure date is included in the returned object newName = newName.toLowerCase().replace(/[^a-z0-9/]/g, ''); - return { ...version, name: newName }; + return { ...version, name: newName}; }); return modifiedVersions; diff --git a/frontend/src/app/scripts/_components/ScriptItem.tsx b/frontend/src/app/scripts/_components/ScriptItem.tsx index 5ab26cd..deacd17 100644 --- a/frontend/src/app/scripts/_components/ScriptItem.tsx +++ b/frontend/src/app/scripts/_components/ScriptItem.tsx @@ -97,19 +97,31 @@ function ScriptItem({
Loading versions...
- ) : ( -Version: { versions.find((v) => +
Loading versions...
) : + (<> +Version:
+{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" + }
+Latest changes:
++ {(() => { + 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, '') - - )?.version || "Not found" - }
- )} - + ); + return matchedVersion?.date ? + extractDate(matchedVersion.date as unknown as string) : + "No date information found" + })()} + + >) + }