Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/api/developer/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function GET(request) {
const container = client.database(DATABASE).container(CONTAINER);

const { resources } = await container.items.query({
query: "SELECT c.id, c.login, c.name, c.avatarUrl, c.bio, c.githubUrl, c.location, c.lat, c.lng, c.followers, c.totalStars, c.totalForks, c.totalCommits, c.topLanguage, c.languages, c.publicRepos, c.topRepos, c.soReputation, c.soAnswers, c.soAcceptRate, c.soBadges, c.soUserId, c.specialTags, c.claimed, c.claimedAt, c.metricsUpdatedAt, c.aiProfile FROM c WHERE (c.id = @id OR c.login = @id) AND (NOT IS_DEFINED(c.nomination) OR c.nomination.status = 'approved')",
query: "SELECT c.id, c.login, c.name, c.avatarUrl, c.bio, c.githubUrl, c.location, c.lat, c.lng, c.followers, c.totalStars, c.totalForks, c.totalWatchers, c.totalCommits, c.topLanguage, c.languages, c.publicRepos, c.topRepos, c.soReputation, c.soAnswers, c.soAcceptRate, c.soBadges, c.soUserId, c.specialTags, c.claimed, c.claimedAt, c.metricsUpdatedAt, c.aiProfile FROM c WHERE (c.id = @id OR c.login = @id) AND (NOT IS_DEFINED(c.nomination) OR c.nomination.status = 'approved')",
parameters: [{ name: '@id', value: id }]
}).fetchAll();

Expand Down
2 changes: 1 addition & 1 deletion app/api/developers/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function GET() {
const container = client.database(DATABASE).container(CONTAINER);

const { resources } = await container.items
.query("SELECT c.id, c.login, c.name, c.avatarUrl, c.githubUrl, c.location, c.lat, c.lng, c.followers, c.totalStars, c.totalForks, c.totalCommits, c.topLanguage, c.soReputation, c.soAnswers, c.soAcceptRate, c.soBadges, c.specialTags, c.claimed, c.metricsUpdatedAt, c.collaborators, c.aiProfile FROM c WHERE NOT IS_DEFINED(c.nomination) OR c.nomination.status = 'approved'")
.query("SELECT c.id, c.login, c.name, c.avatarUrl, c.githubUrl, c.location, c.lat, c.lng, c.followers, c.publicRepos, c.totalStars, c.totalForks, c.totalWatchers, c.totalCommits, c.topLanguage, c.soUserId, c.soReputation, c.soAnswers, c.soAcceptRate, c.soBadges, c.specialTags, c.claimed, c.metricsUpdatedAt, c.collaborators, c.aiProfile FROM c WHERE NOT IS_DEFINED(c.nomination) OR c.nomination.status = 'approved'")
.fetchAll();

return NextResponse.json(projectAgentReadinessList(resources), {
Expand Down
5 changes: 3 additions & 2 deletions app/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import PlatformActivityBanner from '../components/PlatformActivityBanner.jsx';
import { scoreAll } from '../lib/scoring.js';
import { addDeveloperRanks } from '../lib/ranking.js';
import { enrichWithCollaborators } from '../lib/collaboration.js';
import { withOssWorth } from '../lib/oss-worth.js';
import dynamic from 'next/dynamic';

const Globe = dynamic(() => import('../components/Globe.jsx'), { ssr: false });
Expand Down Expand Up @@ -131,7 +132,7 @@ export default function Home() {
const devRes = await fetch('/api/developers', { cache: 'no-store' });
if (devRes.ok) {
const raw = await devRes.json();
const scored = enrichWithCollaborators(addDeveloperRanks(scoreAll(raw)));
const scored = enrichWithCollaborators(addDeveloperRanks(scoreAll(raw))).map(withOssWorth);
setDevelopers(scored);
setFiltered(scored);
const claimed = new Set(raw.filter(d => d.claimed).map(d => d.login));
Expand Down Expand Up @@ -220,7 +221,7 @@ export default function Home() {
const res = await fetch('/api/developers', { signal: AbortSignal.timeout(30000) });
if (!res.ok) throw new Error(`Failed to load data: ${res.status}`);
const raw = await res.json();
const scored = enrichWithCollaborators(addDeveloperRanks(scoreAll(raw)));
const scored = enrichWithCollaborators(addDeveloperRanks(scoreAll(raw))).map(withOssWorth);
setDevelopers(scored);
setFiltered(scored);
// Build set of all claimed logins from data
Expand Down
59 changes: 59 additions & 0 deletions components/DetailPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ export default function DetailPanel({ dev, onClose, onCardGenerated, claimedLogi
</div>
</div>

{dev.ossWorth && <OssWorthSection worth={dev.ossWorth} />}

{/* Charts */}
<div className="detail-panel__charts">
<div className="chart-section">
Expand Down Expand Up @@ -407,6 +409,63 @@ function StatCard({ label, value, className = '' }) {
);
}

function OssWorthSection({ worth }) {
return (
<section className="oss-worth" aria-labelledby="oss-worth-title">
<div className="oss-worth__heading">
<div>
<span>Public contribution footprint</span>
<h3 id="oss-worth-title">OSS Worth</h3>
</div>
<strong title={`${worth.totalCredits.toLocaleString()} OSS Credits`}>
{formatNum(worth.totalCredits)} <small>OSC</small>
</strong>
</div>
<p className="oss-worth__disclaimer">
Fictional OSS Credits celebrate public contributions. They are not compensation, skill, employability, or financial value.
</p>
<div className="oss-worth__cards">
<WorthCard platform="GitHub" allocation="60% allocation" worth={worth.github} />
<WorthCard platform="Stack Overflow" allocation="40% allocation" worth={worth.stackoverflow} />
</div>
<details className="oss-worth__methodology">
<summary>How this is calculated</summary>
<p>Inputs are log-normalized against fixed reference caps. Formula {worth.formulaVersion}.</p>
</details>
</section>
);
}

function WorthCard({ platform, allocation, worth }) {
const platformClass = platform === 'GitHub' ? 'github' : 'stackoverflow';
return (
<article className={`worth-card worth-card--${platformClass}${worth.available ? '' : ' worth-card--unavailable'}`}>
<div className="worth-card__header">
<span>{platform}</span>
<small>{allocation}</small>
</div>
<strong title={`${worth.credits.toLocaleString()} of ${worth.maxCredits.toLocaleString()} OSS Credits`}>
{formatNum(worth.credits)} <small>/ {formatNum(worth.maxCredits)} OSC</small>
</strong>
{!worth.available ? (
<p>No linked Stack Overflow profile</p>
) : (
<ul>
{worth.breakdown.map(dimension => (
<li key={dimension.key}>
<span>
{dimension.label}
<small>{Math.round(dimension.weight * 100)}% · cap {formatNum(dimension.cap)}</small>
</span>
<b>{formatNum(dimension.sourceValue)}</b>
</li>
))}
</ul>
)}
</article>
);
}

function SOBars({ rep, answers, acceptRate, badges, userId }) {
const metrics = [
{ label: 'Reputation', value: rep, max: 1000000, color: '#f48024' },
Expand Down
10 changes: 10 additions & 0 deletions components/Leaderboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, { useMemo, useRef, useState, useEffect, useCallback } from 'react'
import { formatNum } from '../lib/format.js';
import { extractCountry, normalizeCountry, countryKey } from '../lib/country.js';
import { SCORE_METHODOLOGY } from '../lib/scoring.js';
import { compareOssWorth } from '../lib/oss-worth.js';
import SpecialTags from './SpecialTags.jsx';
import GlobalActivityFeed from './GlobalActivityFeed.jsx';
import AgentNetworkPanel from './AgentNetworkPanel.jsx';
Expand Down Expand Up @@ -78,6 +79,7 @@ export default function Leaderboard({
case 'stars': return (b.totalStars || 0) - (a.totalStars || 0);
case 'commits': return (b.totalCommits || 0) - (a.totalCommits || 0);
case 'soRep': return (b.soReputation || 0) - (a.soReputation || 0);
case 'worth': return compareOssWorth(a, b);
default: return b.score - a.score;
}
});
Expand Down Expand Up @@ -213,6 +215,7 @@ export default function Leaderboard({
<option value="stars">Stars</option>
<option value="commits">Commits</option>
<option value="soRep">SO Rep</option>
<option value="worth">OSS Worth</option>
</select>
</div>
{sortBy === 'score' && (
Expand Down Expand Up @@ -257,6 +260,13 @@ export default function Leaderboard({
<div className="lb-item__badges">
<span className="lb-badge lb-badge--gh" title="GitHub Stars">★ {formatNum(dev.totalStars)}</span>
{dev.soReputation ? <span className="lb-badge lb-badge--so" title="SO Reputation">● {formatNum(dev.soReputation)}</span> : null}
<span
className="lb-badge lb-badge--worth"
title={`${dev.ossWorth?.totalCredits?.toLocaleString() || 0} OSS Credits`}
aria-label={`${dev.ossWorth?.totalCredits?.toLocaleString() || 0} OSS Credits`}
>
OSC {formatNum(dev.ossWorth?.totalCredits || 0)}
</span>
</div>
</div>
<div className="lb-item__actions">
Expand Down
Loading