Skip to content

Commit fe8292c

Browse files
amide-initclaude
andcommitted
feat: add GitHub stats, language chart and activity chart to preview modal
- StatsOverview: 6-cell grid showing total stars, forks, public repos, followers, following, and language count computed from all fetched repos - LanguageChart: GitHub-style colour strip + dual-column horizontal bar chart for top 10 languages with percentage labels - ActivityChart: per-year bar chart of repositories created (uses created_at from the repos API response) - RepoCard: now also shows fork count alongside stars - NavSearch: stores allRepos (all own repos, not just top 6) separately and passes it to the modal for stats computation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f048b3f commit fe8292c

File tree

2 files changed

+223
-119
lines changed

2 files changed

+223
-119
lines changed

src/components/NavSearch.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type SearchState =
1313
| { status: 'idle' }
1414
| { status: 'loading' }
1515
| { status: 'error'; message: string }
16-
| { status: 'done'; user: GHUser; repos: GHRepo[] }
16+
| { status: 'done'; user: GHUser; repos: GHRepo[]; allRepos: GHRepo[] }
1717

1818
// ── Language colour dots ──────────────────────────────────────────────────────
1919

@@ -94,11 +94,9 @@ export function NavSearch({ variant = 'default' }: NavSearchProps) {
9494
if (!userRes.ok) throw new Error('GitHub API error — try again later')
9595
const user = (await userRes.json()) as GHUser
9696
const allRepos = (await reposRes.json()) as GHRepo[]
97-
const repos = allRepos
98-
.filter((r) => !r.fork)
99-
.sort((a, b) => b.stargazers_count - a.stargazers_count)
100-
.slice(0, 6)
101-
setState({ status: 'done', user, repos })
97+
const ownRepos = allRepos.filter((r) => !r.fork)
98+
const repos = [...ownRepos].sort((a, b) => b.stargazers_count - a.stargazers_count).slice(0, 6)
99+
setState({ status: 'done', user, repos, allRepos: ownRepos })
102100
} catch (err) {
103101
setState({ status: 'error', message: err instanceof Error ? err.message : 'Search failed' })
104102
}
@@ -305,6 +303,7 @@ export function NavSearch({ variant = 'default' }: NavSearchProps) {
305303
<PortfolioPreviewModal
306304
user={state.user}
307305
repos={state.repos}
306+
allRepos={state.allRepos}
308307
onClose={() => setPreviewOpen(false)}
309308
/>
310309
)}

0 commit comments

Comments
 (0)