Application Analytics follow-up#3848
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR scopes application analytics/events to partner endpoints, adds a referral-source icon component, renames/refactors several menu/popover components, migrates the commission details into a client-side page, and extends the overview chart with an applications view. ChangesApplications Analytics & Partner-scoped Endpoints
Commission & Partner Dashboard Refactoring
Sequence DiagramsequenceDiagram
participant Client as Page / Component
participant Hook as useApplicationsAnalytics
participant Filter as useApplicationAnalyticsFilters
participant API as /api/partners/applications
participant Icon as ApplicationReferralSourceIcon
Client->>Hook: request (enabled=true, workspaceId)
Hook->>API: GET /api/partners/applications/analytics?...
API-->>Hook: timeseries + referralSource rows
Hook-->>Client: data
Client->>Filter: useApplicationAnalyticsFilters()
Filter-->>Client: filters (referralSource options)
Client->>Icon: referralSource="marketplace"
Icon-->>Client: <Shop icon>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value). 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/applications-menu-popover.tsx (1)
51-72: 💤 Low value
<Link>wrapping<button>produces invalid HTML (<a><button>)Both navigation items nest a
<button>inside<Link>(which renders as<a>). Nesting interactive elements is invalid per the HTML spec and can confuse assistive technologies. The inner<button>can be removed and the styles applied directly to the<Link>.♻️ Proposed refactor (apply to both navigation items)
-<Link - href={`/${workspaceSlug}/program/partners/applications/rejected`} - onClick={() => setOpenPopover(false)} -> - <button className="w-full rounded-md p-2 hover:bg-neutral-100 active:bg-neutral-200"> - <IconMenu - text="View rejected applications" - icon={<UserXmark className="size-4" />} - /> - </button> -</Link> +<Link + href={`/${workspaceSlug}/program/partners/applications/rejected`} + onClick={() => setOpenPopover(false)} + className="block w-full rounded-md p-2 hover:bg-neutral-100 active:bg-neutral-200" +> + <IconMenu + text="View rejected applications" + icon={<UserXmark className="size-4" />} + /> +</Link>Apply the same pattern to the "View analytics" item on lines 62–72.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/app/app.dub.co/`(dashboard)/[slug]/(ee)/program/partners/applications/applications-menu-popover.tsx around lines 51 - 72, Remove the nested <button> elements inside the <Link> components for the two navigation items and move the button classes and onClick handler directly onto the <Link>; specifically update the Link blocks that use workspaceSlug and getQueryString(...) (the "View rejected applications" and "View analytics" items) to call setOpenPopover(false) on click and carry the className="w-full rounded-md p-2 hover:bg-neutral-100 active:bg-neutral-200" and IconMenu child directly on the Link (keep IconMenu usage and its text/icon props unchanged) so no <button> is rendered inside the anchor.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@apps/web/app/app.dub.co/`(dashboard)/[slug]/(ee)/program/commissions/[commissionId]/page.tsx:
- Around line 65-73: The span accesses commission?.partner.name without guarding
partner and can throw if partner is null; update the render to safely reference
the partner name (e.g., use commission?.partner?.name or render only when
commission?.partner exists) so the code that uses PartnerAvatar and the span are
consistent—ensure the same null-check used for PartnerAvatar
(commission?.partner) is applied before reading partner.name in the span.
- Around line 43-45: The conditional call to redirect() during render (checking
error?.status === 404) can throw and interrupt rendering; update the component
to perform navigation inside a client-side effect instead: detect the 404 result
(the same error or status check you currently use) and call router.replace(...)
or call redirect() from within a useEffect callback in the component that has
access to the client router; specifically modify the code referencing
error?.status and redirect() in the page component so navigation is triggered
from a useEffect (or by returning a not-found UI) rather than directly during
render.
In
`@apps/web/app/app.dub.co/`(dashboard)/[slug]/(ee)/program/commissions/commission-menu-popover.tsx:
- Around line 50-71: The Link currently wraps a <button>, creating nested
interactive elements; remove the <button> and apply its className and behavior
directly to the Link (or the anchor it renders) so the link is the single
interactive element — update the JSX in commission-menu-popover to move "w-full
rounded-md p-2 hover:bg-neutral-100 active:bg-neutral-200" onto the Link, keep
IconMenu/ChartLine and the href produced with getQueryString(slug,...), and
ensure any keyboard/ARIA behavior expected from the button is preserved on the
Link (e.g., role or aria attributes if needed).
- Line 19: Rename the React component function CommmissionsMenuPopover to the
correct CommissionsMenuPopover (remove the extra "m") and update any
references/imports accordingly (e.g., the import in page.tsx) so they match the
new name; ensure the exported identifier and default/named export usage remains
consistent to avoid broken imports.
In
`@apps/web/app/app.dub.co/`(dashboard)/[slug]/(ee)/program/partners/applications/applications-menu-popover.tsx:
- Around line 40-44: The Settings Button (rendered with Button text based on
isMobile and onClick calling setShowApplicationSettingsModal) must be disabled
when program is not available; update the Button to include disabled={!program}
and also guard the onClick (or wrap setShowApplicationSettingsModal call) so it
won't open ApplicationSettingsModal when program is falsy, ensuring
ApplicationSettingsModal always receives valid program data.
---
Nitpick comments:
In
`@apps/web/app/app.dub.co/`(dashboard)/[slug]/(ee)/program/partners/applications/applications-menu-popover.tsx:
- Around line 51-72: Remove the nested <button> elements inside the <Link>
components for the two navigation items and move the button classes and onClick
handler directly onto the <Link>; specifically update the Link blocks that use
workspaceSlug and getQueryString(...) (the "View rejected applications" and
"View analytics" items) to call setOpenPopover(false) on click and carry the
className="w-full rounded-md p-2 hover:bg-neutral-100 active:bg-neutral-200" and
IconMenu child directly on the Link (keep IconMenu usage and its text/icon props
unchanged) so no <button> is rendered inside the anchor.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1a6ea571-96b4-4ce2-bdc1-92ff80bffc53
📒 Files selected for processing (20)
apps/web/app/(ee)/api/partners/applications/analytics/route.tsapps/web/app/(ee)/api/partners/applications/events/route.tsapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/application-referral-source-icon.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/applications-analytics-cards.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/use-application-events.tsapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/use-applications-analytics-filters.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/use-applications-analytics.tsapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/program-analytics-shell.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/[commissionId]/page-client.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/[commissionId]/page.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/commission-menu-popover.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/page.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-chart.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/applications-menu-popover.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/applications-menu.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/page.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/partners-menu-popover.tsx
💤 Files with no reviewable changes (2)
- apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/applications-menu.tsx
- apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/[commissionId]/page-client.tsx
Summary by CodeRabbit
New Features
Refactoring