Frontend
This commit is contained in:
parent
40227c2ad4
commit
18bf77afb3
@ -15,11 +15,12 @@ const getVersions = async () => {
|
|||||||
const filePath = path.resolve(jsonDir, versionsFileName);
|
const filePath = path.resolve(jsonDir, versionsFileName);
|
||||||
const fileContent = await fs.readFile(filePath, encoding);
|
const fileContent = await fs.readFile(filePath, encoding);
|
||||||
const versions: AppVersion[] = JSON.parse(fileContent);
|
const versions: AppVersion[] = JSON.parse(fileContent);
|
||||||
|
console.log("Versions: ", versions);
|
||||||
const modifiedVersions = versions.map(version => {
|
const modifiedVersions = versions.map(version => {
|
||||||
let newName = version.name;
|
let newName = version.name;
|
||||||
|
// Ensure date is included in the returned object
|
||||||
newName = newName.toLowerCase().replace(/[^a-z0-9/]/g, '');
|
newName = newName.toLowerCase().replace(/[^a-z0-9/]/g, '');
|
||||||
return { ...version, name: newName };
|
return { ...version, name: newName};
|
||||||
});
|
});
|
||||||
|
|
||||||
return modifiedVersions;
|
return modifiedVersions;
|
||||||
|
@ -97,19 +97,31 @@ function ScriptItem({
|
|||||||
<div className="flex gap-5">
|
<div className="flex gap-5">
|
||||||
<DefaultSettings item={item} />
|
<DefaultSettings item={item} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>{versions.length === 0 ? (<p>Loading versions...</p>) :
|
||||||
{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) =>
|
||||||
<p>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"
|
||||||
|
}</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 === item.slug.replace(/[^a-z0-9]/g, '') ||
|
||||||
v.name.includes(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, '')
|
v.name.replace(/[^a-z0-9]/g, '') === item.slug.replace(/[^a-z0-9]/g, '')
|
||||||
|
);
|
||||||
)?.version || "Not found"
|
return matchedVersion?.date ?
|
||||||
}</p>
|
extractDate(matchedVersion.date as unknown as string) :
|
||||||
)}
|
"No date information found"
|
||||||
|
})()}
|
||||||
|
</p>
|
||||||
|
</>)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -51,6 +51,7 @@ export type Metadata = {
|
|||||||
export interface AppVersion {
|
export interface AppVersion {
|
||||||
name: string;
|
name: string;
|
||||||
version: string;
|
version: string;
|
||||||
|
date: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Version {
|
export interface Version {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user