Skip to content

Explore page: 'Recommended by [OrgName]' badge for org-curated plans #664

@teetangh

Description

@teetangh

Context

PR #655 added a curated plan catalog where org admins link real consultant plans to their org via the existing `organizationProfileId` FK on all 4 plan tables. The org dashboard Plans page shows the curated list and supports browse + add.

This issue covers the learner-facing side: when an org learner browses the public explore page, plans in their org's catalog should show a "Recommended by [OrgName]" badge.

Implementation

Data flow

  1. The explore page needs to know which org(s) the current user belongs to (from `session.user.organizationMemberships`)
  2. For each plan card rendered, check if `plan.organizationProfileId` matches any of the user's org profile IDs
  3. If yes, render a badge: "Recommended by [OrgName]"

Files to modify

  • `app/explore/experts/components/ConsultantCard.tsx` — add badge on subscription plan cards
  • `app/explore/programs/components/ProgramCard.tsx` — add badge on webinar/class cards
  • `lib/data/explore-experts.ts` — include `organizationProfileId` in the plan select
  • `app/api/user/consultants/route.ts` — include org profile relation in plan response
  • `app/api/plans/classes/route.ts` + `app/api/plans/webinars/route.ts` — include org profile in response

Badge design

  • Style: `bg-emerald-50 text-emerald-700 border-emerald-200` (subtle, non-intrusive)
  • Icon: Building2 (from lucide-react)
  • Text: "Recommended by [OrgName]"
  • Position: Below the price or above the CTA button

Scope considerations

  • This requires threading session/org context through server components (explore page is partially server-rendered)
  • May need a client-side wrapper that reads `useSession()` and passes org IDs down
  • OR: pass org profile IDs as a query param to the API and let it annotate matching plans

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions