Skip to content

Feature/mood tracking - #39

Merged
Kavinduk2 merged 5 commits into
mainfrom
feature/mood_tracking
Mar 9, 2026
Merged

Feature/mood tracking#39
Kavinduk2 merged 5 commits into
mainfrom
feature/mood_tracking

Conversation

@Umeshinduranga

Copy link
Copy Markdown
Collaborator

This pull request introduces a comprehensive mood tracking system to the recovery application, including backend API endpoints, frontend API integration, and a user interface for daily mood logging. The main changes add functionality for users to log their mood, view mood history, and access mood analytics, along with a modal popup for mood check-in on the dashboard.

Backend: Mood Tracking API Endpoints

  • Added three new protected endpoints to progress.controller.ts:
    • logMood for logging a mood entry with validation and mapping of scores to mood labels.
    • getMoodData for retrieving mood history, supporting date range and "last N days" filtering, and calculating average scores.
    • getMoodAnalytics for analytics such as 7- and 30-day trends, mood distribution, most frequent mood, and day-of-week patterns.
  • Registered the new endpoints in the main router as protected routes.

Frontend: API Integration

  • Added TypeScript interfaces and API client functions for logging moods, fetching mood data, and retrieving analytics in auth-client.ts. These functions handle errors and format responses for frontend use.

Frontend: Dashboard Mood Logging UI

  • Integrated the new API functions into the dashboard page.
  • Added a modal popup that prompts the user to log their mood if they haven't checked in today, featuring:
    • A slider and quick-select buttons for mood score (1–10) with emoji feedback.
    • Optional notes input and validation.
    • Submission handling with loading state and success/error messages.
    • Option to skip mood logging for the day.
  • The popup appears 1.5 seconds after dashboard load if the user hasn't logged their mood today. [1] [2] [3] [4]

Code Maintenance

  • Updated import statements to include the new logMood function in the dashboard page.

Backend: Mood Tracking Endpoints

  • Implemented logMood, getMoodData, and getMoodAnalytics endpoints with validation, mood mapping, analytics, and error handling in progress.controller.ts.
  • Registered new mood tracking routes as protected endpoints in the router.

Frontend: API Integration

  • Added TypeScript interfaces and API client functions for mood logging, history, and analytics in auth-client.ts.

Frontend: Dashboard Mood Logging UI

  • Integrated mood logging API into the dashboard, including a modal popup for daily mood check-in with score slider, quick-select buttons, notes, and feedback. [1] [2] [3] [4]

Code Maintenance

  • Updated imports in the dashboard page to use the new mood logging function.

@Umeshinduranga
Umeshinduranga requested a review from Kavinduk2 March 9, 2026 06:38
@Umeshinduranga Umeshinduranga added the enhancement New feature or request label Mar 9, 2026
@vercel

vercel Bot commented Mar 9, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
re-life-website Ignored Ignored Mar 9, 2026 6:38am

@Kavinduk2 Kavinduk2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No errors were found. Can merge to the main

@Umeshinduranga Umeshinduranga left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Approved

@Kavinduk2
Kavinduk2 merged commit f1a82e7 into main Mar 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants