Jiseoup/showmycodePublic
EN|KO
  • Code
  • Commits
  • Pull Requests
← Back to list
Merged

feat: add branch switcher for code and commits views

#7
JiseoupJiseoup · Apr 10, 2026feat/branch-switcher → main
feat
OverviewCommitsFiles changed

Related Issue

N/A

Changes

  • Add getBranches() to lib/github.ts; add ref param to getTree() and getContents(), sha param to getCommits() for branch-aware fetching
  • Add BranchSelector client component (components/BranchSelector.tsx) using shadcn/ui Select — always opens downward, styled to match project theme
  • Code tab: branch selector rendered in Sidebar header; file tree and code viewer reflect the selected branch
  • Commits tab: branch selector rendered next to page heading; commit list filtered to selected branch; pagination URLs preserve ?branch=
  • Pulls tab: no branch selector — PR list is repo-wide and branch-agnostic
  • Branch state carried via ?branch=<name> query param; invalid or missing value falls back to default_branch
  • Switching branch clears ?path to prevent 404 on files absent from the new branch
  • Add --popover, --popover-foreground, --input, --ring CSS variables to app/globals.css required by shadcn/ui components

How to Verify

  1. Open a repository page — branch selector visible in the sidebar header
  2. Switch to a feature branch → file tree updates, ?path clears, URL shows ?branch=<name>
  3. Select a file on the new branch → code viewer shows the correct content for that branch
  4. Navigate to Commits tab → branch selector visible next to heading; commits are filtered to the selected branch
  5. Navigate to Pulls tab → no branch selector shown; all PRs listed regardless of branch
  6. Access ?branch=nonexistent → silently falls back to the default branch
  7. Verify branch dropdown always opens downward and background is opaque in both light and dark mode

Checklist

  • npm run build passes
  • npm run lint passes
  • New/updated strings added to both dictionaries/ko.json and dictionaries/en.json (if applicable)