Skip to content

feat(ai): implement AI-powered learning assistant components (#305)#337

Merged
RUKAYAT-CODER merged 2 commits intorinafcode:mainfrom
JoesWalker:feat/ai-learning-assistant
Apr 28, 2026
Merged

feat(ai): implement AI-powered learning assistant components (#305)#337
RUKAYAT-CODER merged 2 commits intorinafcode:mainfrom
JoesWalker:feat/ai-learning-assistant

Conversation

@JoesWalker
Copy link
Copy Markdown
Contributor

Closes #305

  • LearningAssistant: chat UI with typing indicator, aria-live, keyboard nav
  • PersonalizedRecommendations: fetches GET /api/ai/recommendations with skeleton loader
  • IntelligentProgress: fetches GET /api/user/progress, progress bar + insights
  • SmartNotifications: fetches GET /api/ai/reminders, dismiss via DELETE /api/ai/reminders/:id
  • NaturalLanguageQuery: POST /api/ai/search with empty/error states
  • Tests: 25 tests covering loading, success, error, and interaction states

Placeholder API endpoints documented in each component:
POST /api/ai/chat, GET /api/ai/recommendations,
GET /api/ai/reminders, DELETE /api/ai/reminders/:id, POST /api/ai/search

Closes #305

Description

Brief description of changes

Related Issue

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No console errors
  • Uses Lucide icons consistently
  • Responsive design implemented
  • Starknet best practices followed

Summary

Implements the AI-powered learning assistant frontend as described in issue #305.

Changes

Five new components under src/components/ai/:

  • LearningAssistant – Chat UI with message thread, typing indicator, keyboard navigation, and aria-live for screen readers. Sends messages to
    POST /api/ai/chat.
  • PersonalizedRecommendations – Fetches GET /api/ai/recommendations and displays a list of courses/resources with title, reason, and CTA link.
    Skeleton loader while fetching.
  • IntelligentProgress – Fetches the existing GET /api/user/progress endpoint and renders a progress bar with AI-generated insights (streak, time
    spent, daily goal).
  • SmartNotifications – Fetches GET /api/ai/reminders, supports dismissing via DELETE /api/ai/reminders/:id, uses the existing toast pattern for
    confirmations.
  • NaturalLanguageQuery – Search input posting to POST /api/ai/search with results list, empty state, and loading/error states.

Placeholder API Endpoints

The following backend endpoints need to be implemented to match:

Method Path Body Response
POST /api/ai/chat { message, context } { data: { reply } }
GET /api/ai/recommendations { data: Recommendation[] }
GET /api/ai/reminders { data: Reminder[] }
DELETE /api/ai/reminders/:id { success: true }
POST /api/ai/search { query } { data: SearchResult[] }

Tests

25 tests in src/components/ai/__tests__/ai-components.test.tsx covering:

  • Loading, success, error, and empty states for all components
  • Message send + reply flow in LearningAssistant
  • Reminder dismiss with toast confirmation
  • NaturalLanguageQuery submit and result rendering

All API calls are mocked — no real AI calls in tests.

Checklist

  • No console errors
  • Uses lucide-react icons throughout
  • Tailwind CSS with responsive + dark mode support
  • Accessible (aria-live, aria-label, role attributes, keyboard navigable)
  • Matches existing component and API patterns
  • 25/25 tests passing

- LearningAssistant: chat UI with typing indicator, aria-live, keyboard nav
- PersonalizedRecommendations: fetches GET /api/ai/recommendations with skeleton loader
- IntelligentProgress: fetches GET /api/user/progress, progress bar + insights
- SmartNotifications: fetches GET /api/ai/reminders, dismiss via DELETE /api/ai/reminders/:id
- NaturalLanguageQuery: POST /api/ai/search with empty/error states
- Tests: 25 tests covering loading, success, error, and interaction states

Placeholder API endpoints documented in each component:
  POST /api/ai/chat, GET /api/ai/recommendations,
  GET /api/ai/reminders, DELETE /api/ai/reminders/:id, POST /api/ai/search

Closes rinafcode#305
- Keep our AI component implementations (ApiResponse<T> envelope, better
  accessibility, error states, Skeleton loader)
- Switch SmartNotifications to useNotification hook (project standard)
- Remove duplicate upstream test file (aiComponents.test.tsx) in favour
  of our ai-components.test.tsx which matches our component API shapes
- All 25 AI component tests passing
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 28, 2026

@JoesWalker Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER RUKAYAT-CODER merged commit 0e984e2 into rinafcode:main Apr 28, 2026
1 of 2 checks passed
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.

Implement Advanced AI-Powered Learning Assistant

2 participants