--- export const prerender = true; import Layout from '../../layouts/PageLayout.astro'; import { getPermalink } from '../../utils/permalinks'; import { getTranslation } from '../../i18n/translations'; import React, { useMemo } from 'react'; import dynamic from 'astro/dynamic'; import ContributionCalendar from '../../components/ContributionCalendar.jsx'; import CollapsibleIntro from '../../components/CollapsibleIntro.jsx'; const metadata = { title: 'Development Progress | 365DevNet', description: 'See the latest development activity, code contributions, and commit history for the 365DevNet project.', }; const lang = Astro.params.lang || 'en'; const t = getTranslation(lang); // Cache Gitea commits across all language builds let cachedCommits = null; async function getCachedCommits() { if (cachedCommits) return cachedCommits; const GITEA_COMMITS_URL = 'https://git.365devnet.eu/api/v1/repos/365DevNet/365devnet/commits?sha=main&stat=true&verification=true&files=true'; let commits = []; try { const headers = { accept: 'application/json' }; if (import.meta.env.GITEA_TOKEN) { headers['Authorization'] = `token ${import.meta.env.GITEA_TOKEN}`; } const commitsResponse = await fetch(GITEA_COMMITS_URL, { headers }); if (commitsResponse.ok) { commits = await commitsResponse.json(); } } catch (error) { console.error('Error fetching commits:', error); } cachedCommits = commits; return commits; } // Fetch Git repository data at build time (cached) const commits = await getCachedCommits(); // Format date to a readable format const formatDate = (dateString: string) => { const date = new Date(dateString); const day = date.toLocaleString(lang, { day: '2-digit' }); const month = date.toLocaleString(lang, { month: 'short' }).toLowerCase().replace('.', ''); const year = date.getFullYear(); return `${day}-${month}-${year}`; }; // Helper: Group commits by date (YYYY-MM-DD) function getContributionData(commits) { const contributions = {}; for (const commit of commits) { const date = commit.commit?.author?.date?.slice(0, 10); if (date) { contributions[date] = (contributions[date] || 0) + 1; } } return contributions; } const contributionData = getContributionData(commits); export async function getStaticPaths() { return [ { params: { lang: 'en' } }, { params: { lang: 'nl' } }, { params: { lang: 'de' } }, { params: { lang: 'fr' } }, ]; } ---

{t.development.title || 'Development Progress'}

{/* Collapsible Intro */} {/* Contribution Calendar */}

{t.development.latestCommits || 'Latest Commits'}

{Array.isArray(commits) && commits.length > 0 ? (
{commits.slice(0, 10).map((commit) => (

{commit.commit?.message?.split('\n')[0] || 'No message'}

{/* Format commit description with bullet points on new lines */} {commit.commit?.message ? ( (() => { const lines = commit.commit.message.split('\n'); const bullets = lines.filter(line => line.trim().startsWith('- ')); if (bullets.length > 0) { // Render as a list if there are bullet points return (
    {lines.map((line, idx) => line.trim().startsWith('- ') ?
  • {line.trim().slice(2)}
  • : line.trim() !== '' &&
  • {line}
  • )}
); } else { // Render as a paragraph if no bullet points return

{commit.commit.message}

; } })() ) : null}
{commit.commit?.author?.date ? formatDate(commit.commit.author.date) : ''} {commit.commit?.author?.name && ( {commit.commit.author.name} )} {commit.sha && ( Commit: {commit.sha.slice(0, 7)} )}
))}
) : (

Unable to fetch commit history at this time.

)}