Skip to content

Conversation

@elhalj
Copy link
Owner

@elhalj elhalj commented Aug 31, 2025

Summary

Finalize the core room and task MVP by improving API data population, refining member addition logic, enhancing task status/priority handling, and bolstering the UI with loaders, navigation links, and toast notifications

New Features:

  • Show a loading indicator while fetching rooms
  • Display toast notifications upon successful member additions and room creations

Enhancements:

  • Populate tasks and their assignees in room route responses and set a default empty tasks array in the room schema
  • Use atomic updateOne with $addToSet for adding members to rooms and user references
  • Add new status values ('in_progress', 'done') and priority levels ('low', 'critical') with matching icons and colors in the Room page
  • Wrap action buttons with type attributes and Link wrappers for proper navigation
  • Provide default fallbacks for task titles and descriptions when missing

Chores:

  • Stub onClick handlers with alert messages for unimplemented features
  • Apply minor CSS and layout tweaks across various UI components

@elhalj elhalj added the enhancement New feature or request label Aug 31, 2025
@sourcery-ai
Copy link

sourcery-ai bot commented Aug 31, 2025

Reviewer's Guide

This PR completes the MVP by wiring up task population on the backend, refining room and task UI behavior, standardizing component loading and button semantics, and adding success toasts and safe defaults across forms and lists.

Sequence diagram for room data population with tasks and assignees

sequenceDiagram
    participant Frontend
    participant Backend
    participant DB
    Frontend->>Backend: GET /room (fetch rooms)
    Backend->>DB: Find rooms for user
    DB-->>Backend: Rooms with admin/members
    Backend->>DB: Populate tasks for each room
    DB-->>Backend: Tasks with assignees
    Backend-->>Frontend: Rooms with populated tasks and assignees
Loading

ER diagram for Room, Task, and User relationships after MVP changes

erDiagram
    ROOM {
      string room_name
      string description
      objectId admin
      objectId[] members
      objectId[] tasks
    }
    TASK {
      string title
      string description
      string status
      string priority
      date dueDate
      objectId[] assignees
    }
    USER {
      string userName
      string email
      string avatar
      objectId[] rooms
    }
    ROOM ||--o{ USER : has_members
    ROOM ||--o{ TASK : has_tasks
    TASK }o--o{ USER : has_assignees
    USER }o--o{ ROOM : member_of
Loading

Class diagram for updated Room and Task models

classDiagram
    class Room {
        - members: [User]
        - tasks: [Task] (default: [])
        - admin: User
        - room_name: string
        - description: string
    }
    class Task {
        - title: string
        - description: string
        - status: string
        - priority: string
        - dueDate: Date
        - assignees: [User]
    }
    class User {
        - userName: string
        - email: string
        - avatar: string
        - rooms: [Room]
    }
    Room "1" -- "*" Task : tasks
    Room "1" -- "*" User : members
    Room "1" -- "1" User : admin
    Task "*" -- "*" User : assignees
    User "1" -- "*" Room : rooms
Loading

File-Level Changes

Change Details Files
Enhanced RoomId task status/priority display and button behaviors
  • renamed status key from 'in-progress' to 'in_progress' and added 'done' case with new icon
  • extended priority switch with 'low' and 'critical' cases
  • added safe fallbacks for task title and description
  • converted plain buttons to type="button" and stubbed onClick alerts for non-functional controls
  • wrapped New Task labels in Link components and commented out unused edit/delete code
frontend/tasks/src/pages/RoomId.tsx
Populated tasks and streamlined member addition in room routes
  • added populate({path: 'tasks', populate: {path: 'assignees'}}) for both admin and member room queries
  • replaced document.push/save for adding members with atomic updateOne + $addToSet
  • removed deprecated member-limit validation logic
src/routes/room.route.js
Introduced loading state and normalized addMember signature in room context and hook
  • exposed loading flag from useRoom hook and context
  • changed addMember parameter from User object to string ID
  • adjusted error handling and return values in RoomProvider.addMember
frontend/tasks/src/hook/useRoom.ts
frontend/tasks/src/context/RoomProvider.tsx
frontend/tasks/src/context/RoomContext.ts
Added global Loader and standardized button types/style
  • render Loader in RoomUI when loading is true
  • added type="button" to all standalone buttons across Pricing, Header, Cta, Hero, Tasks, UtilsBar
  • stubbed non-functional controls with onClick alerts in UtilsBar
frontend/tasks/src/ui/room/Room.tsx
frontend/tasks/src/ui/home/Pricing.tsx
frontend/tasks/src/ui/home/Header.tsx
frontend/tasks/src/ui/home/Cta.tsx
frontend/tasks/src/ui/home/Hero.tsx
frontend/tasks/src/ui/Tasks.tsx
frontend/tasks/src/ui/UtilsBar.tsx
Integrated success toasts in room creation and member addition flows
  • imported react-hot-toast and called toast.success on successful addMember
  • called toast.success on successful CreateRoom submission
frontend/tasks/src/ui/room/AddMember.tsx
frontend/tasks/src/ui/room/CreateRoom.tsx
Initialized default tasks array in room model
  • added default: [] to tasks field in roomSchema
src/models/room.model.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@elhalj
Copy link
Owner Author

elhalj commented Aug 31, 2025

@sourcery-ai title

@sourcery-ai sourcery-ai bot changed the title finish MVP of projet Enhance Room/Task API, UI, and Member Management Aug 31, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `frontend/tasks/src/pages/RoomId.tsx:77` </location>
<code_context>

   const getPriorityColor = (priority: string) => {
     switch (priority) {
+      case 'low':
+        return 'bg-yellow-200'
       case 'high':
         return 'bg-red-500';
</code_context>

<issue_to_address>
The color for 'low' priority is very light and may reduce readability on light backgrounds.

Using a darker yellow shade will improve contrast and accessibility for users on light backgrounds.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
      case 'low':
        return 'bg-yellow-200'
=======
      case 'low':
        return 'bg-yellow-400'
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +77 to +78
case 'low':
return 'bg-yellow-200'
Copy link

Choose a reason for hiding this comment

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

suggestion: The color for 'low' priority is very light and may reduce readability on light backgrounds.

Using a darker yellow shade will improve contrast and accessibility for users on light backgrounds.

Suggested change
case 'low':
return 'bg-yellow-200'
case 'low':
return 'bg-yellow-400'

@elhalj elhalj merged commit 9735343 into main Aug 31, 2025
4 of 6 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.

2 participants