Skip to content

Application Analytics follow-up#3848

Merged
steven-tey merged 1 commit intomainfrom
applications-followup
May 3, 2026
Merged

Application Analytics follow-up#3848
steven-tey merged 1 commit intomainfrom
applications-followup

Conversation

@steven-tey
Copy link
Copy Markdown
Collaborator

@steven-tey steven-tey commented May 3, 2026

Summary by CodeRabbit

  • New Features

    • Referral source icons for applications (marketplace, direct, other).
    • Applications view added to analytics overview with dedicated tracking.
    • "View analytics" action added to commissions and applications menus.
  • Refactoring

    • Commission details page reworked to a client-side implementation.
    • Application analytics filtering consolidated under a unified hook.
    • Menu components renamed and replaced with popover-based variants.
    • Table header text changed from "Applicant" to "Partner".

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dub Ready Ready Preview May 3, 2026 6:11am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This 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.

Changes

Applications Analytics & Partner-scoped Endpoints

Layer / File(s) Summary
API Route docs
apps/web/app/(ee)/api/partners/applications/...
Route comment headers updated to partner-scoped paths (/api/partners/applications/*).
Data / Fetch wiring
.../use-application-events.ts, .../use-applications-analytics.ts
Hooks now call /api/partners/applications/events and /api/partners/applications/analytics; useApplicationsAnalytics adds enabled?: boolean gating.
Filter & UI primitives
.../use-applications-analytics-filters.tsx, application-referral-source-icon.tsx
Hook renamed to useApplicationAnalyticsFilters, referral-source labels use getReferralSourceDisplayValue(), icon rendering delegated to new ApplicationReferralSourceIcon.
Component integration
applications-analytics-cards.tsx, program-analytics-shell.tsx
Cards and analytics shell use the new icon component and filters hook.

Commission & Partner Dashboard Refactoring

Layer / File(s) Summary
Commission page migration
.../commissions/[commissionId]/page-client.tsx (removed), .../commissions/[commissionId]/page.tsx
Commission details implementation moved into page.tsx as a client component; in-file loading/404 redirect, table, activity, and details card implemented.
Commission menu
.../commission-menu-popover.tsx, .../commissions/page.tsx
Exported component renamed to CommmissionsMenuPopover; adds "View analytics" link and updated icon sizing; page imports updated.
Applications menu refactor
.../partners/applications/applications-menu.tsx (removed), .../applications/applications-menu-popover.tsx (new)
Old ApplicationsMenu removed; new ApplicationsMenuPopover implements settings/export modals and popover navigation.
Overview chart
program/overview-chart.tsx
Adds applications view type, separate timeseries fetch for applications, and view-aware formatting (raw vs cent-scaled values).
Menu renames & table copy
partners/partners-menu-popover.tsx, partners/page.tsx, partners/applications/page.tsx, .../page-client.tsx, .../rejected/page-client.tsx
ImportExportButtonsPartnersMenuPopover; applications page uses new popover; table header text "Applicant" → "Partner".

Sequence Diagram

sequenceDiagram
    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>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • devkiran
  • pepeladeira

"🐰
I hopped through routes and icons bright,
Scoped analytics to partners, set views to right,
Moved commission details to dance on the page,
Popovers trimmed and charts gained a stage,
Tiny rabbit clap—code blooms on the dashboard tonight!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Application Analytics follow-up' is related to the main changes in the changeset, which include refactoring application analytics components, hooks, and UI elements (filters, icons, menus), as well as integrating applications support into the overview chart and partner pages.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch applications-followup

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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

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.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

@steven-tey
Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2d239f0 and 75de5d8.

📒 Files selected for processing (20)
  • apps/web/app/(ee)/api/partners/applications/analytics/route.ts
  • apps/web/app/(ee)/api/partners/applications/events/route.ts
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/application-referral-source-icon.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/applications-analytics-cards.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/use-application-events.ts
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/use-applications-analytics-filters.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/use-applications-analytics.ts
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/program-analytics-shell.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/[commissionId]/page-client.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/[commissionId]/page.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/commission-menu-popover.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/page.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-chart.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/applications-menu-popover.tsx
  • 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/partners/applications/page-client.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/page.tsx
  • apps/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

@steven-tey steven-tey merged commit 479acae into main May 3, 2026
11 of 12 checks passed
@steven-tey steven-tey deleted the applications-followup branch May 3, 2026 06:14
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