Skip to content

feat: add GitHub search for users and repositories#2

Merged
ziguifrido merged 11 commits into
mainfrom
feat/search
Jun 11, 2026
Merged

feat: add GitHub search for users and repositories#2
ziguifrido merged 11 commits into
mainfrom
feat/search

Conversation

@ziguifrido

@ziguifrido ziguifrido commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

Adds GitHub search functionality — users and repositories can now be searched via a single query, with paginated results displayed in a dedicated ViewSearchResults component.

Changes

API & Data Layer

  • src/app/api/github/[...path]/route.ts — Added /search/users and /search/repositories to the allowed paths whitelist
  • src/lib/github.ts — Added GitHubSearchUser, GitHubSearchUsersResponse, GitHubSearchReposResponse types; implemented a generic searchAllPages() helper that fetches all pages (up to 1000 results, 100 per page); exposed githubApi.searchUsers() and githubApi.searchRepositories()

State

  • src/store/useAppStore.ts — Added results view, searchUsersResults, searchReposResults, searchQuery state fields; added search type to HistoryItem; updated fetchContent to dispatch a combined search when the input is not a repo path; deduplication logic updated accordingly

UI

  • src/components/ViewSearchResults.tsx (new) — Displays user cards (grid, 10/page) and repository cards (2-column, 10/page) with language badges, star/fork counts, topics, and pagination controls
  • public/avatar-placeholder.svg (new) — Fallback image for user avatars on load error
  • src/components/ViewSearch.tsx — Updated placeholder text; changed suggestions to include generic search examples; added search icon type for history items
  • src/components/LayoutHeader.tsx — Resets search results state when navigating home
  • src/app/page.tsx — Added case "results" to render ViewSearchResults

Chores

  • package-lock.json — Bumped version to 0.2.3, added engines field (node >=22.0.0, npm >=10.0.0)

Summary by CodeRabbit

  • New Features

    • Combined search for GitHub users and repositories with a dedicated results view and independent pagination.
    • Search history now records queries separately and includes a “Machine Learning” suggested query; shorter placeholder text.
  • Bug Fixes / Improvements

    • Header logo/title now returns to the search view.
    • GitHub search endpoints are now accepted so search queries proxy correctly instead of being rejected.
  • Documentation

    • README and docs updated to reflect the new combined search and results view; project version bumped.

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
github-explorer-dashboard Ready Ready Preview, Comment Jun 11, 2026 4:36am

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fefe7e0a-eb1a-4bfd-9dce-2f50a14a7091

📥 Commits

Reviewing files that changed from the base of the PR and between 58b414e and a4ae38e.

📒 Files selected for processing (7)
  • AGENTS.md
  • README.md
  • package.json
  • src/app/page.tsx
  • src/components/LayoutHeader.tsx
  • src/lib/github.ts
  • src/store/useAppStore.ts
✅ Files skipped from review due to trivial changes (2)
  • package.json
  • README.md

📝 Walkthrough

Walkthrough

Adds a combined GitHub search results flow: new githubApi search methods and types, extended Zustand store and navigation for a 'results' view, a client-side ViewSearchResults UI with pagination, routing/header/search UI updates, and documentation/version bumps.

Changes

Search Results Feature

Layer / File(s) Summary
GitHub API search methods and types
src/lib/github.ts
Adds GitHubSearchResponse<T>, GitHubSearchUser, pagination constants, helpers to build/fetch normalized search pages, and githubApi.searchUsers / githubApi.searchRepositories plus exposed fetchSearchPage.
Store state shape and search action
src/store/useAppStore.ts
Extends HistoryItem and NavigationStep to support search/results and optional searchQuery; adds searchUsersResults, searchReposResults, searchQuery, resetToSearch; replaces non-repo search flow with combined user+repo searches, populates results, records history, and navigates to 'results'.
Search results component with pagination
src/components/ViewSearchResults.tsx
Adds ViewSearchResults plus SearchUserCard, PaginationControls, and SearchResultsContent that render paginated user and repository cards with avatars (fallback), badges, language color dots, counts, and keyboard accessibility.
Routing, header, and search UI tweaks
src/app/page.tsx, src/components/LayoutHeader.tsx, src/components/ViewSearch.tsx, src/app/api/github/[...path]/route.ts
Adds case "results" to main page routing, replaces animated content wrapper with direct render, changes header logo to call resetToSearch, updates suggested queries and placeholder text, shows History icon for search history items, and allows proxying /search/users and /search/repositories.
Docs and package version
AGENTS.md, README.md, package.json
Adds "Search API" docs describing pagination and fetchSearchPage usage, updates README feature/version text and structure listing for the new view, and bumps package version to 0.3.0.

Sequence Diagram

sequenceDiagram
  participant User
  participant ViewSearch
  participant useAppStore
  participant githubApi
  participant ViewSearchResults
  User->>ViewSearch: enters query
  ViewSearch->>useAppStore: search(query)
  useAppStore->>githubApi: searchUsers(query)
  useAppStore->>githubApi: searchRepositories(query)
  githubApi-->>useAppStore: returns first-page results
  useAppStore->>useAppStore: set searchUsersResults, searchReposResults, searchQuery
  useAppStore->>ViewSearchResults: navigate to 'results' (state)
  ViewSearchResults->>User: render paginated results
Loading

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main feature addition: GitHub search for users and repositories. It directly matches the primary changes across multiple files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/search

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/github.ts`:
- Around line 159-165: The current code eager-fetches all remaining pages via
Promise.all (remainingPages) which causes bursty GitHub requests; modify the
search to fetch only the first page (keep the initial githubFetch for page=1),
remove the Array.from/Promise.all fan-out, and return the first-page results
along with totalPages/nextPage metadata so callers can request subsequent pages
explicitly; keep references to githubFetch and GitHubSearchResponse<T> so you
can implement an on-demand pager (e.g., a fetchPage(page) helper) that callers
invoke for further pages instead of fetching them all at once.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 42ce9a7f-2b89-4543-8a3e-72a7dc6bd6bb

📥 Commits

Reviewing files that changed from the base of the PR and between bc465ad and 58b414e.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • public/avatar-placeholder.svg is excluded by !**/*.svg
📒 Files selected for processing (7)
  • src/app/api/github/[...path]/route.ts
  • src/app/page.tsx
  • src/components/LayoutHeader.tsx
  • src/components/ViewSearch.tsx
  • src/components/ViewSearchResults.tsx
  • src/lib/github.ts
  • src/store/useAppStore.ts

Comment thread src/lib/github.ts Outdated
@ziguifrido ziguifrido merged commit c4eccbd into main Jun 11, 2026
4 checks passed
@ziguifrido ziguifrido deleted the feat/search branch June 11, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant