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,13 +27,15 @@ export default function ForgeUI({ project }: { project: ForgeProject }) {
|
|||
<Cpu size={12} /> {project.engine}
|
||||
</span>
|
||||
|
||||
<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="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"></span>
|
||||
<span className="relative inline-flex rounded-full h-1.5 w-1.5 bg-green-500"></span>
|
||||
</span>
|
||||
ACTIVE STREAM
|
||||
</div>
|
||||
{project.isRecent && (
|
||||
<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="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"></span>
|
||||
<span className="relative inline-flex rounded-full h-1.5 w-1.5 bg-green-500"></span>
|
||||
</span>
|
||||
ACTIVE STREAM
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ export const FORGE_PROJECTS: ForgeProjectMetadata[] = [
|
|||
"Real-time Firebase Sync",
|
||||
"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";
|
||||
|
||||
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(
|
||||
FORGE_PROJECTS.map(async (metadata) => {
|
||||
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 {
|
||||
...metadata,
|
||||
currentVersion: `${latestVersion}_${metadata.status}`,
|
||||
changelog: changelog,
|
||||
currentVersion:
|
||||
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[];
|
||||
externalLink?: string;
|
||||
projectName: string;
|
||||
currentVersion: string; // Dynamically parsed
|
||||
changelog: ChangelogEntry[]; // Dynamically fetched
|
||||
isRecent: boolean;
|
||||
currentVersion: string;
|
||||
changelog: ChangelogEntry[];
|
||||
}
|
||||
|
||||
export interface ForgeProjectMetadata {
|
||||
|
|
|
|||
Loading…
Reference in a new issue