-
Notifications
You must be signed in to change notification settings - Fork 20
streamline layout and enhance community social proof #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
IanoNjuguna
wants to merge
17
commits into
IntersectMBO:main
Choose a base branch
from
IanoNjuguna:devex-stats_ian
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 d204ec6
replace static placeholder with live GitHub repository overview
IanoNjuguna 9fa3ade
refine MonthlyPulse component design
IanoNjuguna e8d5b50
Merge branch 'main' into devex-stats_ian and resolve yarn.lock
IanoNjuguna 883f82f
delete bun.lock
IanoNjuguna b934b80
Pre-Build Data Fetch Script & Make a Static Snapshot:
IanoNjuguna 2142a01
feat: implement localStorage caching for GitHub community metrics and…
IanoNjuguna 540c479
feat: implement client-side caching for GitHub data and update Commun…
IanoNjuguna 1847452
feat: implement localStorage caching for GitHub community metrics and…
IanoNjuguna 76f0803
refactor: replace client-side GitHub API fetching with static JSON da…
IanoNjuguna aa59f3d
style: update CommunitySection layout, refine button designs, and opt…
IanoNjuguna 6347224
refactor: replace dynamic GitHub API fetching with static JSON data a…
IanoNjuguna 6062158
style: update CommunitySection UI, replace live GitHub fetching with …
IanoNjuguna b7dfd2f
refactor: add TypeScript typing to Root component and update Communit…
IanoNjuguna ee7ebc9
style: center align community section elements and update join button…
IanoNjuguna 42aa821
feat: add fallback message for empty contributor list
IanoNjuguna e7c83df
feat: update MonthlyPulse fallback stats to include projected placeho…
IanoNjuguna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { | ||
| 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
172
website/src/components/CommunitySection/MonthlyPulse.module.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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%; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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