Skip to content

Development - #8

Merged
sheaf-hassan merged 5 commits into
mainfrom
development
Jun 28, 2026
Merged

sheaf-hassan merged 5 commits into
mainfrom
development

Conversation

@sheaf-hassan

@sheaf-hassan sheaf-hassan commented Jun 28, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added a full Settings page with a public profile section and password change flow.
    • Introduced profile editing controls with status messages and account-deactivated handling.
    • Added a password change modal with loading feedback, validation messaging, and click-to-close behavior.
  • Bug Fixes

    • Replaced the previous placeholder Settings screen with a functional, interactive layout.
  • Style

    • Improved the Settings experience with a centered modal overlay and clearer form presentation.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

A new ProfileForm component and ChangePasswordModal component are added. The Settings page is rebuilt to fetch a profile using dummy data, render ProfileForm, and open ChangePasswordModal via a toggle button. Both new components have stub submit handlers.

Changes

Settings Page UI

Layer / File(s) Summary
ProfileForm component
client/src/components/ProfileForm.jsx
New component rendering a "Public Profile" card with disabled name, email, position, and bio fields driven by initialData, conditional deactivated/save UI, and a stub async submit handler.
ChangePasswordModal component
client/src/components/ChangePasswordModal.jsx
New modal with overlay click-to-close, lock icon header, current/new password inputs, message panel, loading spinner on submit, and a stub async submit handler.
Settings page
client/src/pages/Settings.jsx
Replaces placeholder <div>Settings</div> with state for profile, loading, and showPasswordModal; simulated fetchProfile on mount; renders ProfileForm and a change-password card that opens ChangePasswordModal.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐇 A settings page was bare and plain,
Just a <div> out in the rain.
Now profiles glow and modals spring,
With spinners, cards, and everything!
Hop hop hooray for forms that sing~ 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too generic and does not describe the settings/profile/password UI changes in this PR. Rename the PR to clearly describe the main change, such as adding the settings page with profile and password management UI.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch development

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@client/src/components/ChangePasswordModal.jsx`:
- Around line 9-11: The ChangePasswordModal submit flow is currently a no-op, so
the modal never updates state or performs the password change. Update
handleSubmit to set loading, call the existing password update API from the
modal flow, handle success and error by setting the appropriate message state,
and close/reset the modal on success. Also ensure the form action wires through
the same logic used by the modal UI so the component methods and state in
ChangePasswordModal actually complete the password update task.

In `@client/src/components/ProfileForm.jsx`:
- Around line 10-12: The ProfileForm handleSubmit path is currently only
preventing the default submit and never persists the edited bio or updates
loading/error/message state, so the Save Changes action is effectively a no-op.
Update handleSubmit to perform the actual save flow for the bio field, wire in
loading and error/message state transitions, and ensure onSuccess is called
after a successful save; also make sure the save button and submit behavior in
ProfileForm reflect the real async state instead of appearing enabled when
nothing happens.

In `@client/src/pages/Settings.jsx`:
- Around line 16-23: The timeout started in fetchProfile is not being cleaned
up, so a delayed setLoading(false) can still run after Settings unmounts. Update
the useEffect in Settings.jsx to store the timer ID from the setTimeout call and
return a cleanup function that clears it on unmount, keeping the fetchProfile
flow intact while preventing a post-unmount state update.
- Around line 14-18: The seeded profile data assigned in fetchProfile does not
match the ProfileForm shape, so fields like position, bio, and isDeleted are
missing. Update dummyProfileData (or the object passed to setProfile in
fetchProfile) to include the full ProfileForm fields expected by
Settings/ProfileForm, especially position, bio, and isDeleted, so the form can
render the Position value and exercise the deactivated branch correctly.
🪄 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 Plus

Run ID: 2b0352d6-4af6-4b57-abd6-3f37b9e27eb2

📥 Commits

Reviewing files that changed from the base of the PR and between 4a44c20 and 028b6e9.

📒 Files selected for processing (3)
  • client/src/components/ChangePasswordModal.jsx
  • client/src/components/ProfileForm.jsx
  • client/src/pages/Settings.jsx

Comment on lines +9 to +11
const handleSubmit = async (e) => {
e.preventDefault();
};

Copy link
Copy Markdown

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

Password update flow is a no-op.

Submitting this form never changes loading, never sets a success/error message, never closes the modal, and never calls any update API. The current UI looks functional but cannot complete the task.

Also applies to: 29-56

🤖 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 `@client/src/components/ChangePasswordModal.jsx` around lines 9 - 11, The
ChangePasswordModal submit flow is currently a no-op, so the modal never updates
state or performs the password change. Update handleSubmit to set loading, call
the existing password update API from the modal flow, handle success and error
by setting the appropriate message state, and close/reset the modal on success.
Also ensure the form action wires through the same logic used by the modal UI so
the component methods and state in ChangePasswordModal actually complete the
password update task.

Comment on lines +10 to +12
const handleSubmit = async (e)=> {
e.preventDefault();
}

Copy link
Copy Markdown

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

Save changes is currently a no-op.

handleSubmit only prevents the default submit, so the editable bio field never persists, loading/error/message never change, and onSuccess is never called. Shipping an enabled “Save Changes” path in this state is misleading for users.

Also applies to: 54-70

🤖 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 `@client/src/components/ProfileForm.jsx` around lines 10 - 12, The ProfileForm
handleSubmit path is currently only preventing the default submit and never
persists the edited bio or updates loading/error/message state, so the Save
Changes action is effectively a no-op. Update handleSubmit to perform the actual
save flow for the bio field, wire in loading and error/message state
transitions, and ensure onSuccess is called after a successful save; also make
sure the save button and submit behavior in ProfileForm reflect the real async
state instead of appearing enabled when nothing happens.

Comment on lines +14 to +18
const fetchProfile = async ()=> {
setProfile(dummyProfileData);
setTimeout(() => {
setLoading(false);
}, 1000);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

The seeded profile shape does not satisfy ProfileForm.

ProfileForm reads position, bio, and isDeleted, but the dummyProfileData you assign here only contains _id, firstName, lastName, email, and image. On this page that leaves “Position” blank and makes the deactivated branch unreachable.

Proposed fix
   const fetchProfile = async ()=> {
-    setProfile(dummyProfileData);
+    setProfile({
+      ...dummyProfileData,
+      position: dummyProfileData.position ?? "",
+      bio: dummyProfileData.bio ?? "",
+      isDeleted: dummyProfileData.isDeleted ?? false,
+    });
     setTimeout(() => {
       setLoading(false);
     }, 1000);
   };
📝 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
const fetchProfile = async ()=> {
setProfile(dummyProfileData);
setTimeout(() => {
setLoading(false);
}, 1000);
const fetchProfile = async ()=> {
setProfile({
...dummyProfileData,
position: dummyProfileData.position ?? "",
bio: dummyProfileData.bio ?? "",
isDeleted: dummyProfileData.isDeleted ?? false,
});
setTimeout(() => {
setLoading(false);
}, 1000);
🧰 Tools
🪛 ast-grep (0.44.0)

[warning] 14-14: Avoid using the initial state variable in setState
Context: setProfile(dummyProfileData)
Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.

(setstate-same-var)

🤖 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 `@client/src/pages/Settings.jsx` around lines 14 - 18, The seeded profile data
assigned in fetchProfile does not match the ProfileForm shape, so fields like
position, bio, and isDeleted are missing. Update dummyProfileData (or the object
passed to setProfile in fetchProfile) to include the full ProfileForm fields
expected by Settings/ProfileForm, especially position, bio, and isDeleted, so
the form can render the Position value and exercise the deactivated branch
correctly.

Comment on lines +16 to +23
setTimeout(() => {
setLoading(false);
}, 1000);
};

useEffect(()=>{
fetchProfile()
},[]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Clear the pending timeout on unmount.

If the user leaves this page before the 1-second delay finishes, the timer still fires and schedules a state update after unmount. Return a cleanup from the effect and clear the timeout.

🤖 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 `@client/src/pages/Settings.jsx` around lines 16 - 23, The timeout started in
fetchProfile is not being cleaned up, so a delayed setLoading(false) can still
run after Settings unmounts. Update the useEffect in Settings.jsx to store the
timer ID from the setTimeout call and return a cleanup function that clears it
on unmount, keeping the fetchProfile flow intact while preventing a post-unmount
state update.

@sheaf-hassan
sheaf-hassan merged commit ba87358 into main Jun 28, 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