Skip to content

Implement chat functionality and UI components - #12

Merged
hemjaygfx merged 2 commits into
mainfrom
chatpage-setup
Jul 18, 2026
Merged

hemjaygfx merged 2 commits into
mainfrom
chatpage-setup

Conversation

@hemjaygfx

@hemjaygfx hemjaygfx commented Jul 18, 2026 •

Copy link
Copy Markdown
Owner
  • Added new components: ActiveTabSwitch, ChatContainer, ChatHeader, ChatsList, ContactList, NoConversationPlaceholder, ProfileHeader.
  • Integrated Zustand for state management with useChatStore for handling chat-related data.
  • Updated ChatPage to utilize new components and manage chat state.
  • Enhanced LoginPage and RegisterPage with responsive design adjustments.
  • Added concurrently as a dev dependency for running backend and frontend simultaneously.

Open in Devin Review

Summary by CodeRabbit

  • New Features

    • Added a responsive chat interface with conversation and contact views.
    • Added chat headers showing the selected contact, avatar, name, and close action.
    • Added conversation prompts when no chat is selected.
    • Added contact and chat loading, tab switching, selected-contact state, and sound preferences.
    • Improved login and registration page sizing across screen sizes.
  • Chores

    • Added a development command for running frontend and backend services together.

- Added new components: ActiveTabSwitch, ChatContainer, ChatHeader, ChatsList, ContactList, NoConversationPlaceholder, ProfileHeader.
- Integrated Zustand for state management with useChatStore for handling chat-related data.
- Updated ChatPage to utilize new components and manage chat state.
- Enhanced LoginPage and RegisterPage with responsive design adjustments.
- Added concurrently as a dev dependency for running backend and frontend simultaneously.
@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@hemjaygfx, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bd9b9987-8a79-48e0-bfb8-5f4ad83d20a6

📥 Commits

Reviewing files that changed from the base of the PR and between 8d97b41 and fbad972.

📒 Files selected for processing (1)
  • frontend/src/store/useChatStore.js
📝 Walkthrough

Walkthrough

Changes

The frontend gains a Zustand chat store, a responsive chat page, supporting chat components, updated authentication-page sizing, shared component cleanup, and a concurrent backend/frontend development script.

Chat interface

Layer / File(s) Summary
Chat state and API loaders
frontend/src/store/useChatStore.js
Adds chat state, tab and user selection actions, persisted sound preferences, and loaders for contacts and chat partners.
Chat page composition
frontend/src/pages/ChatPage.jsx, frontend/src/components/*
Replaces the logout placeholder with responsive sidebar and conversation-panel rendering using the new chat components and store state.

Frontend shell and development workflow

Layer / File(s) Summary
Shared component and page layout updates
frontend/src/components/BorderAnimatedContainer.jsx, frontend/src/components/PageLoader.jsx, frontend/src/pages/LoginPage.jsx, frontend/src/pages/RegisterPage.jsx
Updates border-container styling and cleanup, records a PageLoader line change, and changes login and registration wrapper heights.
Concurrent development scripts
package.json
Adds a concurrent development command and the concurrently development dependency.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ChatPage
  participant useChatStore
  participant ChatComponents
  participant MessagesAPI
  ChatPage->>useChatStore: Read activeTab and selectedUser
  useChatStore->>MessagesAPI: Load contacts or chat partners
  MessagesAPI-->>useChatStore: Return response data
  useChatStore-->>ChatPage: Provide updated state
  ChatPage->>ChatComponents: Render sidebar and conversation panel
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding chat functionality and related UI components.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chatpage-setup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread frontend/src/store/useChatStore.js Resolved
@hemjaygfx hemjaygfx self-assigned this Jul 18, 2026
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/components/NoConversationPlaceholder.jsx`:
- Around line 2-6: Update NoConversationPlaceholder to provide fallback text
when the name prop is undefined, so the rendered message remains complete when
selectedUser is null. Preserve the existing named-user message when name is
provided.

In `@frontend/src/pages/RegisterPage.jsx`:
- Line 30: Update the registration page container div in RegisterPage to replace
the fixed mobile height with automatic height and an appropriate minimum height,
while preserving the existing desktop height and width classes. Ensure
BorderAnimatedContainer can expand with the form content so lower fields and the
footer remain visible and scrollable.

In `@frontend/src/store/useChatStore.js`:
- Around line 15-20: Update the isSoundEnabled initialization to use the same
"isSoundEnabled" localStorage key as toggleSound and convert the stored string
value into a boolean instead of comparing it directly with true. In toggleSound,
compute the next sound state once and reuse it for both localStorage.setItem and
set.
- Around line 30-34: Prevent error handling crashes in getAllContacts and
getMyChatPartners by accessing response data with optional chaining and
supplying a fallback message when the response or message is unavailable. Apply
the same safe toast.error behavior at both affected sites in
frontend/src/store/useChatStore.js (lines 30-34 and 42-46).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5bc98bd1-4566-4b39-8bba-57467045f536

📥 Commits

Reviewing files that changed from the base of the PR and between ff6e66b and 8d97b41.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (15)
  • frontend/src/components/ActiveTabSwitch.jsx
  • frontend/src/components/BorderAnimatedContainer.jsx
  • frontend/src/components/ChatContainer.jsx
  • frontend/src/components/ChatHeader.jsx
  • frontend/src/components/ChatsList.jsx
  • frontend/src/components/ContactList.jsx
  • frontend/src/components/NoConversationPlaceholder.jsx
  • frontend/src/components/PageLoader.jsx
  • frontend/src/components/ProfileHeader.jsx
  • frontend/src/pages/ChatPage.jsx
  • frontend/src/pages/LoginPage.jsx
  • frontend/src/pages/RegisterPage.jsx
  • frontend/src/pages/hemjay.jsx
  • frontend/src/store/useChatStore.js
  • package.json

Comment on lines +2 to +6
function NoConversationPlaceholder({ name }) {
return (
<div>Start a conversation with {name}</div>
)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Provide a fallback text for when name is undefined.

When this component is rendered without a name prop (e.g. in ChatPage.jsx when selectedUser is null), it will display an incomplete sentence: "Start a conversation with ".

🐛 Proposed fix
 function NoConversationPlaceholder({ name }) {
   return (
-    <div>Start a conversation with {name}</div>
+    <div>{name ? `Start a conversation with ${name}` : "Select a conversation to start chatting"}</div>
   )
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function NoConversationPlaceholder({ name }) {
return (
<div>Start a conversation with {name}</div>
)
}
function NoConversationPlaceholder({ name }) {
return (
<div>{name ? `Start a conversation with ${name}` : "Select a conversation to start chatting"}</div>
)
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/components/NoConversationPlaceholder.jsx` around lines 2 - 6,
Update NoConversationPlaceholder to provide fallback text when the name prop is
undefined, so the rendered message remains complete when selectedUser is null.
Preserve the existing named-user message when name is provided.

Comment thread frontend/src/pages/RegisterPage.jsx Resolved
Comment thread frontend/src/store/useChatStore.js Outdated
Comment on lines +15 to +20
isSoundEnabled: localStorage.getItem("issoundEnabled") === true,

toggleSound: () => {
localStorage.setItem("isSoundEnabled", !get().isSoundEnabled);
set({ isSoundEnabled: !get().isSoundEnabled });
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fix localStorage key typo and string-to-boolean comparison.

localStorage.getItem returns a string (or null), so a strict equality check (=== true) will always evaluate to false. Additionally, the key used to get the item ("issoundEnabled") has a typo compared to the key used to set it ("isSoundEnabled").

🐛 Proposed fix

Extract the toggled state to a variable to prevent calling get().isSoundEnabled twice during the transition:

-    isSoundEnabled: localStorage.getItem("issoundEnabled") === true,
+    isSoundEnabled: localStorage.getItem("isSoundEnabled") === "true",

     toggleSound: () => {
-        localStorage.setItem("isSoundEnabled", !get().isSoundEnabled);
-        set({ isSoundEnabled: !get().isSoundEnabled }); 
+        const nextState = !get().isSoundEnabled;
+        localStorage.setItem("isSoundEnabled", nextState);
+        set({ isSoundEnabled: nextState }); 
     },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
isSoundEnabled: localStorage.getItem("issoundEnabled") === true,
toggleSound: () => {
localStorage.setItem("isSoundEnabled", !get().isSoundEnabled);
set({ isSoundEnabled: !get().isSoundEnabled });
},
isSoundEnabled: localStorage.getItem("isSoundEnabled") === "true",
toggleSound: () => {
const nextState = !get().isSoundEnabled;
localStorage.setItem("isSoundEnabled", nextState);
set({ isSoundEnabled: nextState });
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/store/useChatStore.js` around lines 15 - 20, Update the
isSoundEnabled initialization to use the same "isSoundEnabled" localStorage key
as toggleSound and convert the stored string value into a boolean instead of
comparing it directly with true. In toggleSound, compute the next sound state
once and reuse it for both localStorage.setItem and set.

Comment on lines +30 to +34
} catch (error) {
toast.error(error.response.data.message);
} finally {
set({ isUsersLoading: false });
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Prevent potential crash on network errors.

Accessing error.response.data.message directly will throw a null-pointer exception if error.response is undefined (which typically happens during network timeouts or CORS errors).

  • frontend/src/store/useChatStore.js#L30-L34: Add optional chaining and a fallback message in getAllContacts.
  • frontend/src/store/useChatStore.js#L42-L46: Add optional chaining and a fallback message in getMyChatPartners.
🛡️ Proposed fixes

For getAllContacts (Lines 30-34):

-        } catch (error) {
-            toast.error(error.response.data.message);
-        } finally { 
+        } catch (error) {
+            toast.error(error.response?.data?.message || "Failed to fetch contacts");
+        } finally { 

For getMyChatPartners (Lines 42-46):

-        } catch (error) {
-            toast.error(error.response.data.message);
-        } finally { 
+        } catch (error) {
+            toast.error(error.response?.data?.message || "Failed to fetch chat partners");
+        } finally { 
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (error) {
toast.error(error.response.data.message);
} finally {
set({ isUsersLoading: false });
}
} catch (error) {
toast.error(error.response?.data?.message || "Failed to fetch contacts");
} finally {
set({ isUsersLoading: false });
}
📍 Affects 1 file
  • frontend/src/store/useChatStore.js#L30-L34 (this comment)
  • frontend/src/store/useChatStore.js#L42-L46
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/store/useChatStore.js` around lines 30 - 34, Prevent error
handling crashes in getAllContacts and getMyChatPartners by accessing response
data with optional chaining and supplying a fallback message when the response
or message is unavailable. Apply the same safe toast.error behavior at both
affected sites in frontend/src/store/useChatStore.js (lines 30-34 and 42-46).

@hemjaygfx
hemjaygfx merged commit 41a5ee1 into main Jul 18, 2026
1 check 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.

1 participant