Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ce8a937
extract CommunitySection into independent component
IanoNjuguna May 1, 2026
d204ec6
replace static placeholder with live GitHub repository overview
IanoNjuguna May 1, 2026
9fa3ade
refine MonthlyPulse component design
IanoNjuguna May 3, 2026
e8d5b50
Merge branch 'main' into devex-stats_ian and resolve yarn.lock
IanoNjuguna Aug 1, 2026
883f82f
delete bun.lock
IanoNjuguna Aug 1, 2026
b934b80
Pre-Build Data Fetch Script & Make a Static Snapshot:
IanoNjuguna Aug 1, 2026
2142a01
feat: implement localStorage caching for GitHub community metrics and…
IanoNjuguna Aug 1, 2026
540c479
feat: implement client-side caching for GitHub data and update Commun…
IanoNjuguna Aug 1, 2026
1847452
feat: implement localStorage caching for GitHub community metrics and…
IanoNjuguna Aug 1, 2026
76f0803
refactor: replace client-side GitHub API fetching with static JSON da…
IanoNjuguna Aug 1, 2026
aa59f3d
style: update CommunitySection layout, refine button designs, and opt…
IanoNjuguna Aug 1, 2026
6347224
refactor: replace dynamic GitHub API fetching with static JSON data a…
IanoNjuguna Aug 1, 2026
6062158
style: update CommunitySection UI, replace live GitHub fetching with …
IanoNjuguna Aug 1, 2026
b7dfd2f
refactor: add TypeScript typing to Root component and update Communit…
IanoNjuguna Aug 1, 2026
ee7ebc9
style: center align community section elements and update join button…
IanoNjuguna Aug 1, 2026
42aa821
feat: add fallback message for empty contributor list
IanoNjuguna Aug 1, 2026
e7c83df
feat: update MonthlyPulse fallback stats to include projected placeho…
IanoNjuguna Aug 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions scripts/fetch-github-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
const fs = require('fs');
const path = require('path');

const REPO = 'IntersectMBO/developer-experience';
const OUTPUT_FILE = path.join(__dirname, '../website/src/data/githubData.json');

async function fetchGitHubData() {
console.log('Fetching GitHub repository data at build time...');

const headers = {
'User-Agent': 'Developer-Experience-Build-Script'
};

if (process.env.GITHUB_TOKEN) {
headers['Authorization'] = `token ${process.env.GITHUB_TOKEN}`;
}

let contributors = [];
let stats = {
mergedPRs: '15+',
openIssues: '5+',
closedIssues: '20+'
};

// Preserve existing data if available
if (fs.existsSync(OUTPUT_FILE)) {
try {
const existing = JSON.parse(fs.readFileSync(OUTPUT_FILE, 'utf-8'));
if (existing.contributors && existing.contributors.length > 0) {
contributors = existing.contributors;
}
if (existing.stats) {
stats = existing.stats;
}
} catch (e) {
// Ignore read errors
}
}

try {
// 1. Fetch Contributors
const contribRes = await fetch(`https://api.github.com/repos/${REPO}/contributors`, { headers });
if (contribRes.ok) {
const data = await contribRes.json();
if (Array.isArray(data)) {
contributors = data
.filter(user => user.type !== 'Bot' && !user.login.toLowerCase().includes('dependabot'))
.slice(0, 15)
.map(user => ({
login: user.login,
avatar_url: user.avatar_url,
html_url: user.html_url
}));
}
} else {
console.warn(`Contributors API returned ${contribRes.status}`);
}

// 2. Fetch Search Stats (Merged PRs, Open Issues, Closed Issues)
const [prsRes, openIssuesRes, closedIssuesRes] = await Promise.all([
fetch(`https://api.github.com/search/issues?q=repo:${REPO}+type:pr+is:merged`, { headers }),
fetch(`https://api.github.com/search/issues?q=repo:${REPO}+type:issue+is:open`, { headers }),
fetch(`https://api.github.com/search/issues?q=repo:${REPO}+type:issue+is:closed`, { headers })
]);

if (prsRes.ok) {
const prs = await prsRes.json();
if (prs.total_count !== undefined) stats.mergedPRs = String(prs.total_count);
}
if (openIssuesRes.ok) {
const openIssues = await openIssuesRes.json();
if (openIssues.total_count !== undefined) stats.openIssues = String(openIssues.total_count);
}
if (closedIssuesRes.ok) {
const closedIssues = await closedIssuesRes.json();
if (closedIssues.total_count !== undefined) stats.closedIssues = String(closedIssues.total_count);
}
} catch (error) {
console.warn('Warning: Error fetching GitHub data at build time, using fallback values:', error.message);
}

const payload = {
contributors,
stats,
updatedAt: new Date().toISOString()
};

fs.mkdirSync(path.dirname(OUTPUT_FILE), { recursive: true });
fs.writeFileSync(OUTPUT_FILE, JSON.stringify(payload, null, 2), 'utf-8');
console.log(`GitHub data successfully saved to ${OUTPUT_FILE}`);
}

fetchGitHubData();
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"start": "npm run build && npm run serve",
"start:dev": "docusaurus start",
"start:with-search": "npm run build && npm run serve",
"prebuild": "node ../scripts/fetch-github-data.js",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
Expand Down
50 changes: 50 additions & 0 deletions website/src/components/CommunitySection/Contributors.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from 'react';
import styles from './styles.module.css';
import githubData from '@site/src/data/githubData.json';

interface Contributor {
login: string;
avatar_url: string;
html_url: string;
}

export default function Contributors() {
const contributors: Contributor[] = (githubData.contributors as Contributor[]) || [];

if (contributors.length === 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading states are handled, but network failures are not.
Consider adding a fallback error state so the UI doesn't silently break or hang if a fetch fails

return (
<div className={styles.contributorsContainer}>
<p className={styles.fallbackText}>
View our contributors on{' '}
<a
href="https://github.com/IntersectMBO/developer-experience/graphs/contributors"
target="_blank"
rel="noopener noreferrer"
>
GitHub
</a>
.
</p>
</div>
);
}

return (
<div className={styles.contributorsContainer}>
<div className={styles.contributorsList}>
{contributors.map((user: Contributor) => (
<a
key={user.login}
href={user.html_url}
target="_blank"
rel="noopener noreferrer"
className={styles.contributorAvatar}
title={user.login}
>
<img src={user.avatar_url} alt={user.login} />
</a>
))}
</div>
</div>
);
}
172 changes: 172 additions & 0 deletions website/src/components/CommunitySection/MonthlyPulse.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
.pulseCard {
background: linear-gradient(135deg, #2962ff 0%, #0039cb 100%);
border-radius: 20px;
padding: 2.5rem;
color: white;
box-shadow: none;
display: flex;
flex-direction: column;
justify-content: center;
height: 100%;
max-width: 480px;
margin: 0 auto;
position: relative;
overflow: hidden;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pulseCard:hover {
transform: translateY(-4px);
box-shadow: 0 20px 40px rgba(41, 98, 255, 0.4);
}

.pulseCard::after {
content: '';
position: absolute;
top: 0;
right: 0;
width: 150px;
height: 150px;
background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
border-radius: 50%;
transform: translate(30%, -30%);
}

.pulseHeader {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 0.5rem;
position: relative;
z-index: 2;
}

.pulseHeader h3 {
font-size: 1.5rem;
font-weight: 700;
margin: 0;
color: white;
}

.pulseBadge {
background: #00e676;
width: 12px;
height: 12px;
border-radius: 50%;
display: inline-block;
box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7);
animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
0% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7);
}

70% {
transform: scale(1);
box-shadow: 0 0 0 10px rgba(0, 230, 118, 0);
}

100% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(0, 230, 118, 0);
}
}

.pulseDescription {
color: rgba(255, 255, 255, 0.8);
font-size: 0.95rem;
margin-bottom: 2.5rem;
position: relative;
z-index: 2;
}

.pulseGrid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1.5rem;
margin-bottom: 2.5rem;
padding-bottom: 2rem;
position: relative;
z-index: 2;
}

.pulseStat {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}

.statValue {
font-size: 2.25rem;
font-weight: 800;
line-height: 1.2;
margin-bottom: 0.5rem;
text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.statLabel {
font-size: 0.75rem;
font-weight: 600;
color: rgba(255, 255, 255, 0.8);
text-transform: uppercase;
letter-spacing: 0.5px;
}

.pulseButton {
background: #ffffff;
border: 2px solid #ffffff;
color: #2962ff !important;
padding: 0.875rem 1.5rem;
border-radius: 50px;
text-decoration: none;
font-weight: 700 !important;
font-size: 0.95rem;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
position: relative;
z-index: 2;
width: 100%;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pulseButton:hover {
background: #f8f9fa;
border-color: #ffffff;
color: #0039cb !important;
text-decoration: none;
transform: translateY(-2px);
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

:global([data-theme='dark']) a.pulseButton {
background: #ffffff;
border-color: #ffffff;
color: #2962ff !important;
}

:global([data-theme='dark']) a.pulseButton:hover {
background: #f8f9fa;
border-color: #ffffff;
color: #0039cb !important;
}

@media (max-width: 480px) {
.pulseGrid {
gap: 1rem;
}
.statValue {
font-size: 1.75rem;
}
}

@media (min-width: 997px) {
.pulseCard {
max-width: 100%;
}
}
44 changes: 44 additions & 0 deletions website/src/components/CommunitySection/MonthlyPulse.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import styles from './MonthlyPulse.module.css';
import githubData from '@site/src/data/githubData.json';

export default function MonthlyPulse() {
const stats = {
mergedPRs: githubData.stats?.mergedPRs || '15+',
openIssues: githubData.stats?.openIssues || '5+',
closedIssues: githubData.stats?.closedIssues || '20+'
};

return (
<div className={styles.pulseCard}>
<div className={styles.pulseHeader}>
<h3>All-Time Overview</h3>
</div>
<p className={styles.pulseDescription}>Recent repository activity</p>

<div className={styles.pulseGrid}>
<div className={styles.pulseStat}>
<span className={styles.statValue}>{stats.mergedPRs}</span>
<span className={styles.statLabel}>Merged PRs</span>
</div>
<div className={styles.pulseStat}>
<span className={styles.statValue}>{stats.closedIssues}</span>
<span className={styles.statLabel}>Closed Issues</span>
</div>
<div className={styles.pulseStat}>
<span className={styles.statValue}>{stats.openIssues}</span>
<span className={styles.statLabel}>New Issues</span>
</div>
</div>

<a
href="https://github.com/IntersectMBO/developer-experience/issues"
target="_blank"
rel="noopener noreferrer"
className={styles.pulseButton}
>
Make a PR
</a>
</div>
);
}
Loading