Skip to content

feat(github): per-repo "Bind to project" button on settings page - #11

Merged
ralyodio merged 1 commit into
masterfrom
feat/github-settings-bind-action
May 22, 2026
Merged

ralyodio merged 1 commit into
masterfrom
feat/github-settings-bind-action

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Summary

The repo list at `/settings/integrations/github` was read-only — users could see all 200+ repos but the only clickable thing was an external link to github.com. After a fresh install, that page was a dead end.

Now each row has a Bind to project ▾ dropdown. Pick a project → row updates to Bound to (or "Bound to N projects" if you bind to several). Same data as the per-project Repos tab, just exposed from the GitHub-side surface so users who arrive via the install flow can take the next step without hunting.

Pieces

  • `bind-button.tsx` — client component. Dropdown of the user's projects with ✓ marks for already-bound ones. Toggling fires POST or DELETE on the existing `/api/projects/[id]/repos` endpoints. Optimistic local state + `router.refresh()` after each change.
  • `repos-filter.tsx` — now accepts `projects` and `bindings` and renders `BindButton` per row. Slices bindings to the right repo via an `owner/name` map (O(1) lookup).
  • Page pre-loads the user's projects and all of their `project_repos` rows once (RLS-scoped), then partitions per installation when rendering.

Test plan

After deploy:

  • Visit `/settings/integrations/github` → confirm each repo row has a button on the right ("Bind to project ▾" when none, "Bound to " when one).
  • Click the button → dropdown shows all your projects. Each row has ✓ bound or + bind.
  • Bind: status flips to ✓ bound, button label updates to "Bound to ".
  • Visit the project's Repos tab → confirm the repo appears in the bound list.
  • Unbind from the dropdown → repo disappears from the project's bound list.
  • On a user with zero projects: button shows "Create a project first" instead of the dropdown.

🤖 Generated with Claude Code

The settings repo list was read-only — users could see all 200+ repos
but the only click action was an external link to github.com. Now each
row has a project picker dropdown so users can bind/unbind repos to
their Crawlproof projects without leaving the page.

Pieces:

- New BindButton client component: dropdown of the user's projects with
  checkmarks for currently-bound ones; click toggles via POST/DELETE on
  /api/projects/[id]/repos.

- ReposFilter now receives projects + bindings and renders BindButton
  per row. Label shows the bound project name (1 project), the count
  (2+ projects), or "Bind to project" when none.

- The settings page pre-loads the user's projects and all project_repos
  rows once, then slices per-installation when rendering. RLS keeps the
  data scoped to the owner.

Same data primitives the /projects/[id]/repos tab uses — this just
makes the binding action available from the GitHub-side surface too,
so a user who arrives via "Install on GitHub" never gets stuck.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ralyodio
ralyodio merged commit b7363af into master May 22, 2026
@ralyodio
ralyodio deleted the feat/github-settings-bind-action branch May 22, 2026 13:47
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