--- 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: '365DevNet Ecosystem: Development Overview', 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); // Fetch Gitea user heatmap at build time (cached) async function getUserHeatmap(username) { const url = `https://git.365devnet.eu/api/v1/users/${username}/heatmap`; let heatmap = []; try { const headers = { accept: 'application/json' }; if (import.meta.env.GITEA_TOKEN) { headers['Authorization'] = `token ${import.meta.env.GITEA_TOKEN}`; } const response = await fetch(url, { headers }); if (response.ok) { heatmap = await response.json(); } } catch (error) { console.error('Error fetching user heatmap:', error); } // Aggregate by date const contributions = {}; for (const entry of heatmap) { const date = new Date(entry.timestamp * 1000).toISOString().slice(0, 10); contributions[date] = (contributions[date] || 0) + entry.contributions; } return contributions; } const contributionData = await getUserHeatmap('Richard'); // Fetch latest user commits from activities/feeds async function getUserCommits(username) { const url = `https://git.365devnet.eu/api/v1/users/${username}/activities/feeds`; let feeds = []; try { const headers = { accept: 'application/json' }; if (import.meta.env.GITEA_TOKEN) { headers['Authorization'] = `token ${import.meta.env.GITEA_TOKEN}`; } const response = await fetch(url, { headers }); if (response.ok) { feeds = await response.json(); } } catch (error) { console.error('Error fetching user feeds:', error); } // Only keep commit_repo events const commits = []; for (const feed of feeds) { if (feed.op_type === 'commit_repo' && feed.content) { let content; try { content = JSON.parse(feed.content); } catch (e) { continue; } // Each feed may have multiple commits if (content.Commits && Array.isArray(content.Commits)) { for (const commit of content.Commits) { commits.push({ sha: commit.Sha1, message: commit.Message, author: commit.AuthorName, date: commit.Timestamp, repo: feed.repo ? feed.repo.full_name : '', repo_url: feed.repo ? feed.repo.html_url : '', compare_url: content.CompareURL ? `https://git.365devnet.eu/${content.CompareURL}` : '', }); } } } if (commits.length >= 10) break; } return commits.slice(0, 10); } const userCommits = await getUserCommits('Richard'); export async function getStaticPaths() { return [ { params: { lang: 'en' } }, { params: { lang: 'nl' } }, { params: { lang: 'de' } }, { params: { lang: 'fr' } }, ]; } // Format date to a readable format const formatDate = (dateString) => { 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}`; }; ---

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

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

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

Showing contributions for user Richard (all repositories).

{Array.isArray(userCommits) && userCommits.length > 0 ? (
{userCommits.map((commit) => (

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

{/* Format commit description with bullet points on new lines */} {commit.message ? ( (() => { const lines = 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.message}

; } })() ) : null}
{/* Desktop commit info card */} {/* Mobile commit info area, visually separated and two rows with left/right alignment */}
{commit.date ? formatDate(commit.date) : ''} {commit.author && ( {commit.author === 'becarta' ? 'Richard Bergsma' : commit.author} )}
{commit.repo && ( {commit.repo} )} {commit.sha && ( Commit: {commit.sha.slice(0, 7)} )}
))}
) : (

Unable to fetch commit history at this time.

)}