Skip to content

refactor: split bounty-detail-submissions-card into smaller components - #309

Merged
Benjtalkshow merged 2 commits into
boundlessfi:mainfrom
od-hunter:refactor/split-submissions-card
Jun 27, 2026
Merged

refactor: split bounty-detail-submissions-card into smaller components#309
Benjtalkshow merged 2 commits into
boundlessfi:mainfrom
od-hunter:refactor/split-submissions-card

Conversation

@od-hunter

@od-hunter od-hunter commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Closes #295

Summary by CodeRabbit

  • New Features
    • Added a dedicated bounty submissions experience with dialogs to submit a PR, review a submission, and mark it paid.
    • Submission rows now display a color-coded status badge, “Paid on” details, and transaction info, and only make PR links clickable when safely validated.
  • Bug Fixes
    • PR links are validated before being clickable to reduce unsafe link risk.
    • Draft submission inputs support restoration and auto-save for smoother continuity.
  • Tests
    • Added test coverage for status badge color mapping and safe HTTP/HTTPS URL validation.

Extract row, dialog, and helper modules under components/bounty-detail/submissions/ while preserving the existing import path via a barrel re-export.
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

@od-hunter is attempting to deploy a commit to the Threadflow Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@od-hunter Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@coderabbitai

coderabbitai Bot commented Jun 27, 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

Run ID: 90253ace-5786-4f26-8be5-d7d7ea116ee0

📥 Commits

Reviewing files that changed from the base of the PR and between e4989a6 and 6324232.

📒 Files selected for processing (2)
  • components/bounty-detail/submissions/submissions-card.tsx
  • components/reputation/__tests__/my-claims.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/reputation/tests/my-claims.test.ts
  • components/bounty-detail/submissions/submissions-card.tsx

📝 Walkthrough

Walkthrough

Splits the bounty submissions card into helper, dialog, row, and orchestration modules, then re-exports the card entrypoint. Adds helper tests and updates one reputation test import.

Changes

Submissions Card Refactor

Layer / File(s) Summary
Helpers and tests
components/bounty-detail/submissions/submission-helpers.ts, components/bounty-detail/submissions/__tests__/submission-helpers.test.ts
Adds getStatusBadgeColor and isSafeHttpUrl with coverage for known statuses and URL schemes.
Submission dialogs
components/bounty-detail/submissions/submission-review-dialogs.tsx
Adds dialogs for submit, review, and mark-paid submission flows.
Submission row
components/bounty-detail/submissions/submission-row.tsx
Adds per-submission rendering with safe PR links, status badges, org-member actions, paid date, and transaction link output.
Submissions card orchestration
components/bounty-detail/submissions/submissions-card.tsx
Adds the card state, draft restore/autosave, session org check, mutation handlers, and wiring to rows and dialogs.
Barrel re-export and test import cleanup
components/bounty-detail/bounty-detail-submissions-card.tsx, components/reputation/__tests__/my-claims.test.ts
Turns the original submissions card file into a re-export and updates the reputation test import style.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Benjtalkshow

Poem

🐇 I hopped through the code, then split it with care,
Helpers and dialogs now live in the air.
A row for each bounty, a card at the helm,
The barrel stays tidy, at the edge of the realm.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also changes an unrelated reputation test file, which is outside the bounty submissions split requested by #295. Remove the reputation test cleanup from this PR or move it into a separate change focused on reputation tests.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main refactor: splitting the bounty submissions card into smaller components.
Linked Issues check ✅ Passed The PR matches #295 by splitting the card into submissions-card, row, dialogs, and helpers, while keeping a barrel re-export.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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: 3

🤖 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 `@components/bounty-detail/submissions/submissions-card.tsx`:
- Around line 72-79: The autosave effect in useEffect currently runs after
hydration even when both githubPullRequestUrl and submitComments are empty,
which creates an unwanted blank draft. Update the submissions-card.tsx effect to
skip calling autoSave until at least one of those fields has a value, keeping
the existing isHydrated guard and useSubmissionDraft.autoSave behavior intact.
Refer to the useEffect block and the autoSave call that receives
githubPullRequestUrl and comments.
- Around line 86-101: In handleSubmitPR, move the dialog reset and input
clearing out of the finally block so they only run after
submitToBounty.mutateAsync succeeds; on failure, preserve prUrl, submitComments,
and the open state so the user can retry. Apply the same pattern to the other
affected handlers in submissions-card.tsx so only successful mutations clear
draft/dialog state, and keep clearDraft tied to success rather than
unconditional cleanup.
- Line 55: The review flow is hardwired to APPROVED in SubmissionsCard, which
removes the reviewer’s ability to choose other outcomes. Update the review
status handling in submissions-card.tsx so reviewStatus is derived from the
dialog state or existing review action flow instead of being a constant, and
restore the reject/request-revisions choices in the dialog wiring used by the
review submission handlers. Check the logic around SubmissionsCard, the review
dialog callbacks, and the affected review-action blocks so the original reviewer
behavior is preserved.
🪄 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

Run ID: d0a2cb7c-5e88-43c3-9f26-0d338cab18e3

📥 Commits

Reviewing files that changed from the base of the PR and between b3ce821 and e4989a6.

📒 Files selected for processing (7)
  • components/bounty-detail/bounty-detail-submissions-card.tsx
  • components/bounty-detail/submissions/__tests__/submission-helpers.test.ts
  • components/bounty-detail/submissions/submission-helpers.ts
  • components/bounty-detail/submissions/submission-review-dialogs.tsx
  • components/bounty-detail/submissions/submission-row.tsx
  • components/bounty-detail/submissions/submissions-card.tsx
  • components/reputation/__tests__/my-claims.test.ts

Comment thread components/bounty-detail/submissions/submissions-card.tsx
Comment thread components/bounty-detail/submissions/submissions-card.tsx
Comment thread components/bounty-detail/submissions/submissions-card.tsx

@Benjtalkshow Benjtalkshow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice split. The structure matches issue #295 and local CI is green. Two small things to fix before I merge:

  1. The change to components/reputation/__tests__/my-claims.test.ts is not part of this issue. The only useful part is removing the @jest/globals import. Please undo the rest of the changes in that file.
  2. The original submissions-card.tsx had three // Replace with toast or error UI as needed comments next to the console.error calls. Please add them back so we don't forget to fix the error handling later.
    Once those are done, ready to merge.

Restore original formatting in my-claims.test.ts while keeping the @jest/globals import removal, and add back error-handling TODO comments in submissions-card.tsx.
@od-hunter

Copy link
Copy Markdown
Contributor Author

Nice split. The structure matches issue #295 and local CI is green. Two small things to fix before I merge:

  1. The change to components/reputation/__tests__/my-claims.test.ts is not part of this issue. The only useful part is removing the @jest/globals import. Please undo the rest of the changes in that file.
  2. The original submissions-card.tsx had three // Replace with toast or error UI as needed comments next to the console.error calls. Please add them back so we don't forget to fix the error handling later.
    Once those are done, ready to merge.

Fixed

@Benjtalkshow
Benjtalkshow merged commit 2a6be99 into boundlessfi:main Jun 27, 2026
4 of 5 checks passed
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.

Split components/bounty-detail/bounty-detail-submissions-card.tsx (411 lines) into smaller components

2 participants