-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Allow partners to withdraw application #2702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis update introduces the ability for partners to withdraw their pending program applications. It adds a server-side action for withdrawal, integrates a confirmation modal and withdrawal button in the UI, manages loading and error states, and simplifies the sidebar by removing loading state checks for program enrollment rewards. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UnapprovedProgramPage
participant ConfirmModal
participant withdrawPartnerApplicationAction
participant Router
participant Toast
User->>UnapprovedProgramPage: Clicks "Withdraw Application"
UnapprovedProgramPage->>ConfirmModal: Opens confirmation modal
User->>ConfirmModal: Confirms withdrawal
ConfirmModal->>UnapprovedProgramPage: Triggers withdrawal
UnapprovedProgramPage->>withdrawPartnerApplicationAction: Calls action with programId
withdrawPartnerApplicationAction-->>UnapprovedProgramPage: Returns success or error
UnapprovedProgramPage->>Router: Navigates to programs list (on success)
UnapprovedProgramPage->>Toast: Shows success or error notification
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Possibly related PRs
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
apps/web/lib/actions/partners/withdraw-partner-application.ts (2)
46-46: Remove console.log or replace with proper logging.Console.log statements should not be present in production code. Consider using a proper logging library or remove this debug statement.
- console.log("Deleted program enrollment", res);
27-30: Consider more user-friendly error message.The error message could be more user-friendly by avoiding technical jargon like "pending".
- throw new Error( - "You can only withdraw your application if it's still pending.", - ); + throw new Error( + "You can only withdraw applications that are still under review.", + );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/unapproved-program-page.tsx(4 hunks)apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/apply/program-sidebar.tsx(2 hunks)apps/web/lib/actions/partners/withdraw-partner-application.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: in apps/web/ui/partners/rewards/rewards-logic.tsx, when setting the entity field in a reward conditi...
Learnt from: TWilson023
PR: dubinc/dub#2673
File: apps/web/ui/partners/rewards/rewards-logic.tsx:268-275
Timestamp: 2025-07-30T15:29:54.131Z
Learning: In apps/web/ui/partners/rewards/rewards-logic.tsx, when setting the entity field in a reward condition, dependent fields (attribute, operator, value) should be reset rather than preserved because different entities (customer vs sale) have different available attributes. Maintaining existing fields when the entity changes would create invalid state combinations and confusing UX.
Applied to files:
apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/apply/program-sidebar.tsxapps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/unapproved-program-page.tsx
📚 Learning: in apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx, the form schema uses partial condition ob...
Learnt from: TWilson023
PR: dubinc/dub#2673
File: apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx:56-66
Timestamp: 2025-07-30T15:25:13.936Z
Learning: In apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx, the form schema uses partial condition objects to allow users to add empty/unconfigured condition fields without type errors, while submission validation uses strict schemas to ensure data integrity. This two-stage validation pattern improves UX by allowing progressive completion of complex forms.
Applied to files:
apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/apply/program-sidebar.tsx
📚 Learning: in the partnerprogramsummary email template (packages/email/src/templates/partner-program-summary.ts...
Learnt from: devkiran
PR: dubinc/dub#2448
File: packages/email/src/templates/partner-program-summary.tsx:0-0
Timestamp: 2025-05-29T04:45:18.504Z
Learning: In the PartnerProgramSummary email template (packages/email/src/templates/partner-program-summary.tsx), the stat titles are hardcoded constants ("Clicks", "Leads", "Sales", "Earnings") that will always match the ICONS object keys after toLowerCase() conversion, so icon lookup failures are not possible.
Applied to files:
apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/apply/program-sidebar.tsxapps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/unapproved-program-page.tsx
📚 Learning: in apps/web/ui/partners/design/previews/lander-preview.tsx, the ellipsis wave animation delay calcul...
Learnt from: TWilson023
PR: dubinc/dub#2614
File: apps/web/ui/partners/design/previews/lander-preview.tsx:181-181
Timestamp: 2025-07-09T20:52:56.592Z
Learning: In apps/web/ui/partners/design/previews/lander-preview.tsx, the ellipsis wave animation delay calculation `3 - i * -0.15` is intentionally designed to create negative delays that offset each dot's animation cycle. This pattern works correctly for the intended ellipsis effect and should not be changed to positive incremental delays.
Applied to files:
apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/apply/program-sidebar.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (3)
apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/apply/program-sidebar.tsx (1)
28-34: Loading state handling is safe to removeThe sidebar renders server-provided
programdata immediately and falls back to application- or program-level rewards/discounts while the client fetchesprogramEnrollment. Since we only useprogramEnrollmentto adjust badge, rewards, and button text after loading, showing the UI immediately avoids unnecessary blocking or skeletons—and any brief “Apply” → “Accept invite” button text update is minimal and acceptable.apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/unapproved-program-page.tsx (2)
105-116: LGTM! Well-implemented withdrawal UI.The withdrawal button implementation is excellent:
- Properly conditional (only shows for pending applications)
- Clear labeling and styling
- Proper loading state management
- Good accessibility with the confirmation modal
53-72: Well-structured confirmation modal with comprehensive error handling.The confirmation modal setup is well-implemented with:
- Clear, descriptive messaging that explains consequences
- Proper async error handling with try/catch/finally
- Appropriate toast notifications for user feedback
- Consistent loading state management
Summary by CodeRabbit
New Features
Improvements