Skip to content

Conversation

@elhalj
Copy link
Owner

@elhalj elhalj commented Sep 4, 2025

Summary

Revamp the frontend UI to a light theme, streamline form handling, and enhance backend and provider error management, while adding room deletion and input validation for room creation.

New Features:

  • Add ability to delete rooms from the dashboard UI
  • Validate non-empty room name and trim input on room creation endpoint

Bug Fixes:

  • Prevent form submission without a valid task ID in UpdateTask

Enhancements:

  • Overhaul frontend styling from dark to light theme across multiple components
  • Simplify the UpdateTask input change handler and guard form submission against missing IDs
  • Unify API error handling in AuthProvider and TaskProvider for more detailed messages
  • Deduplicate member IDs and exclude the admin when creating rooms
  • Adjust default global background to white in index.css

@elhalj elhalj added enhancement New feature or request Refactor Modify things labels Sep 4, 2025
@sourcery-ai
Copy link

sourcery-ai bot commented Sep 4, 2025

Reviewer's Guide

This PR implements a comprehensive front-end theme overhaul by migrating from dark to light styling across core UI components, refactors form event handlers for conciseness, standardizes API error handling with a unified ApiError type in providers, adds server-side validation in room creation, restructures the mobile drawer in the header, and introduces deletion actions in the room list.

Sequence diagram for standardized API error handling in providers

sequenceDiagram
    participant Provider
    participant API
    participant ApiError
    participant UI
    Provider->>API: Make API request
    API-->>Provider: Respond (success or error)
    alt Error occurs
      Provider->>ApiError: Cast error to ApiError
      ApiError-->>Provider: Provide error details
      Provider->>UI: Set error state with message
    else Success
      Provider->>UI: Update state with data
    end
Loading

Class diagram for Room creation validation and member handling

classDiagram
    class Room {
      +room_name: string
      +description: string
      +admin: User
      +members: User[]
      +isActive: boolean
    }
    class User {
      +rooms: Room[]
      +userName: string
      +email: string
      +avatar: string
    }
    Room "*" -- "*" User : members
    Room "1" -- "1" User : admin
    User "*" -- "*" Room : rooms
    class RoomRoutes {
      +createRoom(room_name, description, members)
    }
    RoomRoutes --> Room
    RoomRoutes --> User
Loading

File-Level Changes

Change Details Files
Refactor form handlers and submission logic
  • Consolidate checkbox/value branch into a single setState call
  • Simplify empty ID check in handleSubmit
  • Update error messages and remove placeholder comments
frontend/src/ui/UpdateTask.tsx
UI theme refresh: switch from dark to light styling
  • Update Tailwind classes to light backgrounds, gray text and shadows
  • Adjust spacing, rounding and font sizes for consistency
  • Use standardized accent and hover colors
frontend/src/ui/UpdateTask.tsx
frontend/src/components/Header.tsx
frontend/src/pages/RoomId.tsx
frontend/src/ui/room/Room.tsx
frontend/src/ui/UtilsBar.tsx
frontend/src/components/Main.tsx
frontend/src/ui/Tasks.tsx
frontend/src/ui/Stats.tsx
frontend/src/pages/AddPage.tsx
frontend/src/pages/Dashboard.tsx
frontend/src/pages/UpdatePage.tsx
frontend/src/index.css
Standardize API error handling with ApiError type
  • Introduce ApiError type alias in TaskProvider and AuthProvider
  • Extract and prioritize error.response.data.error or message before fallback
  • Prefix setError calls with consistent "Error:" label
frontend/src/context/TaskProvider.tsx
frontend/src/context/AuthProvider.tsx
Add validation and cleanup in room creation route
  • Validate non-empty room_name with 400 response
  • Unify member deduplication and exclude admin
  • Simplify room data construction and start transaction explicitly
src/routes/room.route.js
Restructure mobile drawer menu in header
  • Replace overlay+side panel split with a single fixed drawer
  • Reorganize header and drawer markup for clarity
  • Adjust class names and spacing for mobile actions
frontend/src/components/Header.tsx
Introduce room deletion action in UI
  • Expose deleteRoom hook in RoomUI
  • Add "Supprimer" button per room with onClick handler
  • Style delete button consistently with other actions
frontend/src/ui/room/Room.tsx

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

@netlify
Copy link

netlify bot commented Sep 4, 2025

Deploy Preview for colab-flow ready!

Name Link
🔨 Latest commit 310eaff
🔍 Latest deploy log https://app.netlify.com/projects/colab-flow/deploys/68b90321732b0500082e5599
😎 Deploy Preview https://deploy-preview-29--colab-flow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@elhalj
Copy link
Owner Author

elhalj commented Sep 4, 2025

@sourcery-ai title

@sourcery-ai sourcery-ai bot changed the title Feature/front Revamp UI to light theme, add room deletion, and enhance error handling Sep 4, 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 - here's some feedback:

  • Consider abstracting the repeated ApiError parsing logic into a shared utility (e.g. parseApiError) to reduce duplication across your providers.
  • A lot of nearly identical Tailwind utility classes are used for cards and buttons—extract those into reusable components or custom class names to keep your markup DRY and consistent.
  • In room.route.js you start a MongoDB transaction but don’t call abortTransaction or endSession on error; add proper cleanup in the catch block to avoid leaking sessions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider abstracting the repeated ApiError parsing logic into a shared utility (e.g. parseApiError) to reduce duplication across your providers.
- A lot of nearly identical Tailwind utility classes are used for cards and buttons—extract those into reusable components or custom class names to keep your markup DRY and consistent.
- In room.route.js you start a MongoDB transaction but don’t call abortTransaction or endSession on error; add proper cleanup in the catch block to avoid leaking sessions.

## Individual Comments

### Comment 1
<location> `frontend/src/ui/UtilsBar.tsx:68` </location>
<code_context>

         {/* Changer le mode d'affichage */}
-        <div className="flex bg-white/10 rounded-lg p-1">
+        <div className="flex bg--slatetext-shadow-slate-700/10 rounded-lg p-1">
           <button
             type="button"
</code_context>

<issue_to_address>
Invalid Tailwind class names used for background and text shadow.

Please update the class names to valid Tailwind CSS classes to ensure correct styling and maintainability.
</issue_to_address>

### Comment 2
<location> `frontend/src/ui/UtilsBar.tsx:72` </location>
<code_context>
           <button
             type="button"
             onClick={() => setViewMode("grid")}
             className={`p-2 rounded ${
-              viewMode === "grid" ? "bg-white/20 text-white" : "text-gray-300"
+              viewMode === "grid" ? "bg--slatetext-shadow-slate-700/20 text-shadow-slate-700" : "text-gray-300"
             } transition-all`}
             title="Vue grille"
</code_context>

<issue_to_address>
Incorrect Tailwind class names for conditional styling.

The classes used are invalid and will prevent the intended styles from being applied. Please replace them with valid Tailwind CSS classes, such as 'bg-slate-200' or 'text-slate-700'.
</issue_to_address>

### Comment 3
<location> `frontend/src/ui/UtilsBar.tsx:50` </location>
<code_context>
         <button
           type="button"
-          className="p-2 text-gray-300 hover:text-white rounded-lg hover:bg-white/10 transition-all"
+          className="p-2 text-gray-300 hover:text-shadow-slate-700 rounded-lg hover:bg--slatetext-shadow-slate-700/10 transition-all"
           onClick={() => alert("Pas encore fonctionnel")}
           title="Filtrer les tâches"
</code_context>

<issue_to_address>
Nonexistent Tailwind classes used for hover effects.

Please replace the invalid hover classes with valid Tailwind CSS classes, such as 'hover:text-slate-700' or 'hover:bg-slate-100', to ensure the intended hover effects work.
</issue_to_address>

### Comment 4
<location> `frontend/src/ui/UpdateTask.tsx:73` </location>
<code_context>
-      console.error("Task ID is not defined");
-      return;
-    }
+    if (!id) return;

     setLoading(true);
</code_context>

<issue_to_address>
Silent return on missing id may hinder debugging.

Consider keeping error reporting when 'id' is missing to aid in diagnosing issues during form submission.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
    if (!id) return;

    setLoading(true);
=======
    if (!id) {
      console.error("Task ID is not defined. Cannot submit update form.");
      return;
    }

    setLoading(true);
>>>>>>> REPLACE

</suggested_fix>

### Comment 5
<location> `frontend/src/ui/room/Room.tsx:48` </location>
<code_context>
-            {/* Menu burger sur mobile */}
+            {/* Bouton burger mobile */}
             <div className="sm:hidden">
               <button
                 type="button"
                 onClick={() => setShowMenu(true)}
</code_context>

<issue_to_address>
No confirmation before deleting a room increases risk of accidental deletion.

The 'Supprimer' button triggers 'deleteRoom' immediately. Please add a confirmation dialog to prevent unintended deletions.
</issue_to_address>

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.


{/* Changer le mode d'affichage */}
<div className="flex bg-white/10 rounded-lg p-1">
<div className="flex bg--slatetext-shadow-slate-700/10 rounded-lg p-1">
Copy link

Choose a reason for hiding this comment

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

issue: Invalid Tailwind class names used for background and text shadow.

Please update the class names to valid Tailwind CSS classes to ensure correct styling and maintainability.

Comment on lines 72 to +73
className={`p-2 rounded ${
viewMode === "grid" ? "bg-white/20 text-white" : "text-gray-300"
viewMode === "grid" ? "bg--slatetext-shadow-slate-700/20 text-shadow-slate-700" : "text-gray-300"
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Incorrect Tailwind class names for conditional styling.

The classes used are invalid and will prevent the intended styles from being applied. Please replace them with valid Tailwind CSS classes, such as 'bg-slate-200' or 'text-slate-700'.

<button
type="button"
className="p-2 text-gray-300 hover:text-white rounded-lg hover:bg-white/10 transition-all"
className="p-2 text-gray-300 hover:text-shadow-slate-700 rounded-lg hover:bg--slatetext-shadow-slate-700/10 transition-all"
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Nonexistent Tailwind classes used for hover effects.

Please replace the invalid hover classes with valid Tailwind CSS classes, such as 'hover:text-slate-700' or 'hover:bg-slate-100', to ensure the intended hover effects work.

Comment on lines +73 to 75
if (!id) return;

setLoading(true);
Copy link

Choose a reason for hiding this comment

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

suggestion: Silent return on missing id may hinder debugging.

Consider keeping error reporting when 'id' is missing to aid in diagnosing issues during form submission.

Suggested change
if (!id) return;
setLoading(true);
if (!id) {
console.error("Task ID is not defined. Cannot submit update form.");
return;
}
setLoading(true);

Comment on lines 48 to +57
<button
type="button"
className="px-4 py-1.5 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-sm font-medium rounded-lg hover:from-purple-600 hover:to-pink-600 transition-all duration-300"
className="px-4 py-1.5 bg-blue-300 text-white text-sm font-medium rounded-lg hover:from-purple-600 hover:to-pink-600 transition-all duration-300 cursor-pointer"
>
Voir
</button>
</Link>
<button
type="button"
className="px-4 py-1.5 bg-red-300 text-white text-sm font-medium rounded-lg hover:from-purple-600 hover:to-pink-600 transition-all duration-300 cursor-pointer"
Copy link

Choose a reason for hiding this comment

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

suggestion (bug_risk): No confirmation before deleting a room increases risk of accidental deletion.

The 'Supprimer' button triggers 'deleteRoom' immediately. Please add a confirmation dialog to prevent unintended deletions.

@elhalj elhalj merged commit b6b1910 into main Sep 4, 2025
8 of 10 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 Refactor Modify things

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants