Made active link and active stream conditional
All checks were successful
ci/woodpecker/release/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/release/woodpecker Pipeline was successful
This commit is contained in:
parent
af8c720ba0
commit
14a1ffb7b6
|
|
@ -27,6 +27,7 @@ export default function ForgeUI({ project }: { project: ForgeProject }) {
|
||||||
<Cpu size={12} /> {project.engine}
|
<Cpu size={12} /> {project.engine}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
{project.isRecent && (
|
||||||
<div className="flex items-center gap-2 text-[9px] font-mono text-green-500/60 ml-1">
|
<div className="flex items-center gap-2 text-[9px] font-mono text-green-500/60 ml-1">
|
||||||
<span className="relative flex h-1.5 w-1.5">
|
<span className="relative flex h-1.5 w-1.5">
|
||||||
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"></span>
|
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"></span>
|
||||||
|
|
@ -34,6 +35,7 @@ export default function ForgeUI({ project }: { project: ForgeProject }) {
|
||||||
</span>
|
</span>
|
||||||
ACTIVE STREAM
|
ACTIVE STREAM
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const FORGE_PROJECTS: ForgeProjectMetadata[] = [
|
||||||
"Real-time Firebase Sync",
|
"Real-time Firebase Sync",
|
||||||
"Turn-based Battle Engine",
|
"Turn-based Battle Engine",
|
||||||
],
|
],
|
||||||
externalLink: "https://pixelpals.app",
|
// externalLink: "https://pixelpals.app",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
19
lib/git.ts
19
lib/git.ts
|
|
@ -3,17 +3,26 @@ import { ChangelogEntry, ForgeProject } from "@/types";
|
||||||
import "server-only";
|
import "server-only";
|
||||||
|
|
||||||
export async function getAllForgeProjects(): Promise<ForgeProject[]> {
|
export async function getAllForgeProjects(): Promise<ForgeProject[]> {
|
||||||
// We use Promise.all to fetch all changelogs in parallel for speed
|
const thirtyDaysAgo = new Date();
|
||||||
|
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
|
||||||
|
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
FORGE_PROJECTS.map(async (metadata) => {
|
FORGE_PROJECTS.map(async (metadata) => {
|
||||||
const changelog = await getPrivateChangelog(metadata.repoName);
|
const changelog = await getPrivateChangelog(metadata.repoName);
|
||||||
const latestVersion =
|
|
||||||
changelog.length > 0 ? changelog[0].version : "0.0.0";
|
// Determine if the latest entry happened in the last 30 days
|
||||||
|
const latestDate =
|
||||||
|
changelog.length > 0 ? new Date(changelog[0].date) : null;
|
||||||
|
const isRecent = latestDate ? latestDate >= thirtyDaysAgo : false;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...metadata,
|
...metadata,
|
||||||
currentVersion: `${latestVersion}_${metadata.status}`,
|
currentVersion:
|
||||||
changelog: changelog,
|
changelog.length > 0
|
||||||
|
? `${changelog[0].version}_${metadata.status}`
|
||||||
|
: `v0.0.0_${metadata.status}`,
|
||||||
|
isRecent, // This is the new conditional flag
|
||||||
|
changelog: changelog.slice(0, 3),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,9 @@ export interface ForgeProject {
|
||||||
highlights: string[];
|
highlights: string[];
|
||||||
externalLink?: string;
|
externalLink?: string;
|
||||||
projectName: string;
|
projectName: string;
|
||||||
currentVersion: string; // Dynamically parsed
|
isRecent: boolean;
|
||||||
changelog: ChangelogEntry[]; // Dynamically fetched
|
currentVersion: string;
|
||||||
|
changelog: ChangelogEntry[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ForgeProjectMetadata {
|
export interface ForgeProjectMetadata {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue