Skip to content

Add course enrollment flow — Enroll button that calls backend and contract #1024

Description

@Anuoluwapo25

Description

There is no enrollment flow in the UI. Learners cannot enroll in a course from the frontend — clicking a course just opens the viewer but does not register the learner on-chain or in the backend.

What Needs to Be Done

  1. Add an "Enroll" button to the course detail / course card view
  2. On click:
    • Call CourseMilestone.enroll(learner, courseId) on-chain via the connected wallet
    • Call POST /api/enrollments to record enrollment in the backend
  3. After enrollment, redirect to the first lesson
  4. Show "Enrolled" badge if already enrolled (check is_enrolled())
  5. Gate lesson content behind enrollment check

Acceptance Criteria

  • Enrollment recorded on-chain
  • Enrollment recorded in backend DB
  • Cannot enroll twice (contract + UI guard)
  • Enrolled learner sees "Continue" instead of "Enroll"

Files Affected

  • src/components/CourseCard.tsx
  • src/hooks/useEnrollment.ts (create)
  • server/src/routes/enrollments.routes.ts (create)

Labels

frontend, backend, integration, help wanted, Stellar Wave

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignOfficial Campaign | FWC26Campaign: Official Campaign | FWC26backendAPI/database/infrastructurefrontendReact/TypeScript UI workhelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions