Skip to content

Commit 4243735

Browse files
authored
Merge pull request #132 from Ri1tik/minor-fix
fix: resolve the issue of network page regarding repo data
2 parents c1ec6dc + 637afb5 commit 4243735

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

src/pages/NetworkPage.jsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import AnalysisBanner from '../components/AnalysisBanner'
99
import { NetworkSkeleton } from '../components/Orgexplorerskeletons'
1010

1111
export default function NetworkPage() {
12-
const { model, isComplete, loading, runFullExplore } = useApp()
12+
const { model, isComplete, loading, runFullExplore, allRepos } = useApp()
1313
const svgRef = useRef(null)
1414
const simRef = useRef(null)
1515
const [tooltip, setTooltip] = useState(null)
@@ -29,7 +29,20 @@ export default function NetworkPage() {
2929
svg.attr('viewBox', `0 0 ${W} ${H}`)
3030

3131
// Top repos and contributors for performance
32-
const topRepos = model.allRepos.slice(0, 30)
32+
// Top repos and contributors for performance
33+
// allRepos entries don't carry healthScore/activityClassification —
34+
// only totalRepos does (see buildAnalyticalModel) — so enrich them here
35+
const repoMetaByKey = new Map(
36+
model.totalRepos.map(r => [`${r.orgLogin}/${r.name}`, r])
37+
)
38+
const topRepos = model.allRepos.slice(0, 30).map(r => {
39+
const meta = repoMetaByKey.get(`${r.orgLogin}/${r.name}`)
40+
return {
41+
...r,
42+
healthScore: meta?.healthScore ?? 0,
43+
activityClassification: meta?.activityClassification ?? 'Unknown',
44+
}
45+
})
3346
const topContribs = model.contributors
3447

3548
const nodes = []
@@ -150,6 +163,7 @@ export default function NetworkPage() {
150163
.attr('x2', d => d.target.x).attr('y2', d => d.target.y)
151164
node.attr('transform', d => `translate(${d.x},${d.y})`)
152165
})
166+
console.log(tooltip)
153167

154168
return () => sim.stop()
155169
}, [model, showRepos, showContribs])
@@ -214,7 +228,7 @@ export default function NetworkPage() {
214228
</strong>
215229
</div>
216230
<div style={{ color: 'var(--text2)', marginBottom: 2 }}>Stars: {tooltip.node.data.stargazers_count?.toLocaleString()}</div>
217-
<div style={{ color: 'var(--text2)' }}>Lifecycle: {tooltip.node.data.lifecycle}</div>
231+
<div style={{ color: 'var(--text2)' }}>Activity: {tooltip.node.data.activityClassification}</div>
218232
</>
219233
) : (
220234
<>

0 commit comments

Comments
 (0)