Skip to content

feat: Implement settings page functionality(#566)#606

Merged
rohan-pandeyy merged 6 commits into
AOSSIE-Org:mainfrom
ShivaGupta-14:feat/settings-page
May 13, 2026
Merged

feat: Implement settings page functionality(#566)#606
rohan-pandeyy merged 6 commits into
AOSSIE-Org:mainfrom
ShivaGupta-14:feat/settings-page

Conversation

@ShivaGupta-14
Copy link
Copy Markdown
Contributor

@ShivaGupta-14 ShivaGupta-14 commented Oct 31, 2025

Solves Issue #566

This PR implements the user settings page, introducing account management features and folder list pagination as outlined in the issue.

Path

  • frontend/src/pages/SettingsPage.tsx
  • frontend/src/components/settings/AccountSettingsCard.tsx
  • frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx

Approach

Problem

  • The Settings Page was a placeholder and lacked core functionality.
  • Users had no way to update their account details, such as their display name or profile icon.
  • The folder list displayed all items at once, making the page long and cluttered for users with many folders.

Solution

  • Implemented an Account Information section where users can update their display name and select a new avatar.
  • Added client-side validation to the name input field to prevent empty submissions.
  • Persisted the user's name and avatar choice in localStorage to maintain state across sessions.
  • Limited the initial display of folders to 6 and added a "View More" button to incrementally load the next set, cleaning up the UI.

Testing Done

  • Verified that updating the name and selecting an avatar works correctly and saves to localStorage.
  • Tested the input validation by attempting to save an empty name, which correctly displays an error state.
  • Checked that the folder list is properly paginated and the "View More" button functions as expected.

Summary

  • New Features

    • Added an Account Settings section allowing users to change their display name and profile avatar.
    • Introduced pagination for the folder list to improve readability and performance.
  • UX Improvements

    • Added input validation with clear error messaging for a better user experience.
    • The folder list is now clean and navigable, regardless of the number of items.

Summary by CodeRabbit

  • New Features

    • Tabbed Settings UI (General / Account) with URL-hash sync for direct linking.
    • Account settings: edit display name and choose an avatar, with validation and local persistence.
  • Improvements

    • Folder management shows a subset with "View More" and per-folder controls moved inline.
    • Navbar logo and avatar now navigate via app routing for smoother navigation.
    • More compact, organized settings layout and stable folder rendering.

…s page, providing core account management features and improving the UI.

Key features include:
- Users can now update their display name and select a profile avatar from the account section.
- The folder list is now restricted to an initial view of 6 items, with a 'View More' button for more.
…s page, providing core account management features and improving the UI.

Key features include:
- Users can now update their display name and select a profile avatar from the account section.
- The folder list is now restricted to an initial view of 6 items, with a 'View More' button for more.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 31, 2025

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ce6835f6-4647-4717-9d27-e96faeccde3e

📥 Commits

Reviewing files that changed from the base of the PR and between 4a393a2 and 96bb9a4.

📒 Files selected for processing (2)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx
  • frontend/src/pages/SettingsPage/Settings.tsx

Walkthrough

Reworks Settings into a tabbed UI (General / Account) with URL-hash sync. Adds new AccountSettingsCard (name + avatar persisted to localStorage and dispatched to Redux). FolderManagementCard now paginates folders (View More), uses stable folder.folder_id keys, and moves per-folder controls inside each item.

Changes

Settings page tab navigation & wiring

Layer / File(s) Summary
Tab state, URL sync, and UI
frontend/src/pages/SettingsPage/Settings.tsx
Introduce activeTab state, handleTabChange to update state + navigate to set URL hash, and a useEffect to read location.hash (default general). Replace single-column layout with a tablist and conditional rendering for General vs Account panels. Includes markup/aria and conditional classes for active tab.

Account settings component

Layer / File(s) Summary
AccountSettingsCard contract, state, and save flow
frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx
New default-export component. Loads initial name and avatar from localStorage, validates name (non-empty) and avatar selection, renders name input and avatar grid, enables Save when avatar selected, persists changes to localStorage, and dispatches setName/setAvatar Redux actions. Handles save errors. UI state and validation live locally.

Folder management pagination & per-item controls

Layer / File(s) Summary
Folder slicing and item-level controls
frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx
Add visibleFoldersCount (default 6) and handleViewMore (increments by 5); render folders via slice(0, visibleFoldersCount); use folder.folder_id for React keys; move AI Tagging controls, Delete button, and tagging progress into each folder item; render a View More button when additional folders exist.

Navbar link updates (routing)

Layer / File(s) Summary
Router Links for logo and avatar
frontend/src/components/Navigation/Navbar/Navbar.tsx
Replace <a> with Link for logo (to="/") and user avatar (to="/settings#account"), preserving image fallback and styling.

Sequence Diagram

sequenceDiagram
    actor User
    participant Navbar as Navbar
    participant Settings as Settings.tsx
    participant Tabs as TabBar
    participant AccountCard as AccountSettingsCard
    participant FolderCard as FolderManagementCard
    participant Storage as localStorage
    participant Redux as Redux (onboardingSlice)

    User->>Navbar: Click avatar
    Navbar->>Settings: Navigate to /settings#account
    Settings->>Tabs: Render tab bar (General, Account)
    User->>Tabs: Click "Account"
    Tabs->>AccountCard: Render AccountSettingsCard
    AccountCard->>Storage: Read saved name & avatar
    Storage-->>AccountCard: Return values
    User->>AccountCard: Edit name / select avatar
    AccountCard->>AccountCard: Validate inputs
    User->>AccountCard: Click "Save Changes"
    AccountCard->>Storage: Persist name & avatar
    AccountCard->>Redux: Dispatch setName & setAvatar
    User->>Tabs: Click "General"
    Tabs->>FolderCard: Render FolderManagementCard
    FolderCard->>FolderCard: Show first N folders (slice)
    User->>FolderCard: Click "View More"
    FolderCard->>FolderCard: Increase visibleFoldersCount
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • AOSSIE-Org/PictoPy#516 — Earlier Settings/FolderManagementCard refactor that this PR extends (tabs, pagination, and folder-list UI changes).

Suggested labels

TypeScript/JavaScript

Suggested reviewers

  • rahulharpal1603
  • Aditya30ag

Poem

🐇 I hop through tabs both near and far,
I pick a face beneath a star,
Folders peek out, then show some more,
I save your name and then explore—
Settings snug, I bounce on the floor.

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat: Implement settings page functionality" directly aligns with the primary objective of this changeset. The modifications across three files—Settings.tsx, AccountSettingsCard.tsx, and FolderManagementCard.tsx—collectively implement a fully functional Settings page with a tab-based layout, account management capabilities, and improved folder list pagination. The title is concise, clear, and sufficiently specific to convey the main change without vague terminology or noise. A teammate reviewing the repository history would immediately understand that this PR adds core Settings page functionality.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (6)
frontend/src/pages/SettingsPage/Settings.tsx (1)

14-14: Consider using a string literal type for activeTab.

The activeTab state uses plain strings which are prone to typos and lack IDE autocomplete support.

Add a type definition:

type TabType = 'general' | 'account';
const [activeTab, setActiveTab] = useState<TabType>('general');

This provides type safety and better developer experience.

frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx (5)

1-1: Remove or relocate the implementation comment from the import line.

The comment "No need for useEffect" on the import line is misplaced and adds confusion. If documenting a design decision, place it near the relevant logic or in the component docstring.

-import React, { useState } from 'react'; // No need for useEffect
+import React, { useState } from 'react';

22-22: Remove the comment about removed code.

Comments about removed code add no value and should be omitted. Git history tracks what was removed and why.

-  // The redundant useEffect has been removed.
-

35-48: Add user feedback after successful save.

The save operation completes silently without confirming success to the user. This creates uncertainty about whether changes were persisted.

Consider adding a toast notification or temporary success message:

// After line 47, add:
// Show success feedback (you'll need a toast/notification system)
// toast.success('Settings saved successfully');

Alternatively, add a local success state that shows a checkmark or message for a few seconds.


95-101: Improve image accessibility and error handling.

The avatar images have generic alt text and no error handling for failed loads.

Apply this diff:

 <img
   src={avatar}
-  alt="Avatar"
+  alt={`Avatar option ${avatars.indexOf(avatar) + 1}`}
+  onError={(e) => {
+    e.currentTarget.src = '/avatars/fallback.png'; // or hide the button
+  }}
   className={`h-24 w-24 rounded-full object-cover transition-all duration-300 ${
     isSelected ? 'brightness-110' : ''
   }`}
 />

This provides descriptive alt text for screen readers and graceful fallback for missing images.


110-116: Consider enabling Save button only when changes are detected.

The button is currently enabled whenever an avatar is selected, even if no changes were made. This could lead to redundant saves.

Track initial values and compare:

const initialName = useRef(localStorage.getItem('name') || '');
const initialAvatar = useRef(localStorage.getItem('avatar') || '');

const hasChanges = name !== initialName.current || selectedAvatar !== initialAvatar.current;

// Then use:
disabled={!selectedAvatar || !hasChanges}

This prevents unnecessary saves and provides clearer feedback about the form state.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe2f98d and 1621717.

📒 Files selected for processing (3)
  • frontend/src/pages/SettingsPage/Settings.tsx (1 hunks)
  • frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx (1 hunks)
  • frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx (2)
frontend/src/components/ui/switch.tsx (1)
  • Switch (29-29)
frontend/src/components/ui/progress.tsx (1)
  • Progress (37-37)
frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx (2)
frontend/src/features/onboardingSlice.ts (2)
  • setName (28-30)
  • setAvatar (25-27)
frontend/src/constants/avatars.ts (1)
  • avatars (1-10)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Backend Tests
  • GitHub Check: Tauri Build Check (macos-latest, --target aarch64-apple-darwin)
  • GitHub Check: Tauri Build Check (ubuntu-22.04)
  • GitHub Check: Tauri Build Check (windows-latest)
🔇 Additional comments (3)
frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx (3)

32-36: LGTM!

The pagination implementation correctly uses functional setState to avoid stale closure issues. Initial display of 6 folders with incremental loading of 5 more is a good UX balance.


46-50: LGTM!

Excellent change to use folder.folder_id as the key instead of array index. This ensures stable component identity during re-renders and list mutations.


139-147: LGTM!

The View More button condition correctly shows when there are additional folders to display. The button styling and behavior are appropriate.

Comment thread frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx Outdated
Comment thread frontend/src/pages/SettingsPage/Settings.tsx Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx (4)

1-1: Remove development comment from production code.

The inline comment "No need for useEffect" appears to be a development note and should be removed before merging.

Apply this diff:

-import React, { useState } from 'react'; // No need for useEffect
+import React, { useState } from 'react';

23-23: Remove development comment.

This comment about removed code should be deleted before merging.

Apply this diff:

-  // The redundant useEffect has been removed.
-

96-102: Improve alt text for accessibility.

The alt text "Avatar" is generic and not helpful for screen reader users. Consider making it more descriptive.

Apply this diff:

                     <img
                       src={avatar}
-                      alt="Avatar"
+                      alt={`Avatar option ${avatars.indexOf(avatar) + 1}`}
                       className={`h-24 w-24 rounded-full object-cover transition-all duration-300 ${
                         isSelected ? 'brightness-110' : ''
                       }`}
                     />

111-117: Consider adding user feedback after save.

The save operation completes silently without confirming success to the user. Consider adding a toast notification or temporary success message to improve UX.

Example using a toast library:

const handleSave = () => {
  if (!name.trim()) {
    setNameError(true);
    return;
  }

  setNameError(false);
  if (!selectedAvatar) return;

  try {
    localStorage.setItem('name', name);
    localStorage.setItem('avatar', selectedAvatar);
    dispatch(setName(name));
    dispatch(setAvatar(selectedAvatar));
    // Add success feedback
    toast.success('Settings saved successfully');
  } catch (error) {
    console.error('Failed to save settings:', error);
    toast.error('Failed to save settings');
  }
};
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd927c2 and e2c3e04.

📒 Files selected for processing (2)
  • frontend/src/pages/SettingsPage/Settings.tsx (1 hunks)
  • frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/pages/SettingsPage/Settings.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx (2)
frontend/src/constants/avatars.ts (1)
  • avatars (1-10)
frontend/src/features/onboardingSlice.ts (2)
  • setName (28-30)
  • setAvatar (25-27)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Backend Tests
  • GitHub Check: Tauri Build Check (macos-latest, --target aarch64-apple-darwin)
  • GitHub Check: Tauri Build Check (windows-latest)
  • GitHub Check: Tauri Build Check (ubuntu-22.04)
🔇 Additional comments (2)
frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx (2)

17-20: Previous avatar validation concern has been addressed.

The avatar value from localStorage is now properly validated against the avatars whitelist before use. This resolves the security concern from the previous review.


114-114: Good defensive programming.

The disabled state on the save button properly prevents submission when no avatar is selected, making the early return check at line 43 a defensive measure that should never be reached in normal operation.

Comment thread frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2c3e04 and 89a300c.

📒 Files selected for processing (1)
  • frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx (2)
frontend/src/constants/avatars.ts (1)
  • avatars (1-10)
frontend/src/features/onboardingSlice.ts (2)
  • setName (28-30)
  • setAvatar (25-27)
🪛 Biome (2.1.2)
frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx

[error] 125-126: Illegal use of an export declaration not at the top level

move this declaration to the top level

(parse)


[error] 126-126: expected } but instead the file ends

the file ends here

(parse)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Tauri Build Check (macos-latest, --target aarch64-apple-darwin)
  • GitHub Check: Tauri Build Check (windows-latest)
  • GitHub Check: Backend Tests
🔇 Additional comments (4)
frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx (4)

1-11: LGTM!

Imports are clean and necessary. The removal of useEffect (noted in the comment) aligns with the code cleanup mentioned in the AI summary.


17-20: LGTM! Avatar validation correctly implemented.

The avatar value from localStorage is now properly validated against the avatars array before use, with a safe fallback to an empty string. This addresses the previous security concern about arbitrary URLs.


25-34: LGTM!

Event handlers are correctly implemented. The automatic clearing of nameError when the user types provides good UX feedback.


54-123: LGTM!

The component structure and JSX are well-organized:

  • Input validation with clear visual feedback
  • Avatar selection with appropriate visual states
  • Save button correctly disabled when no avatar is selected
  • Good accessibility with explicit button types

Comment thread frontend/src/pages/SettingsPage/components/AccountSettingsCard.tsx Outdated
@ShivaGupta-14
Copy link
Copy Markdown
Contributor Author

@rahulharpal1603 could you please check this PR?

1 similar comment
@ShivaGupta-14
Copy link
Copy Markdown
Contributor Author

@rahulharpal1603 could you please check this PR?

@ShivaGupta-14
Copy link
Copy Markdown
Contributor Author

@rahulharpal1603 could you please review this.

@rohan-pandeyy
Copy link
Copy Markdown
Contributor

Thanks for your contribution @ShivaGupta-14!

@rohan-pandeyy rohan-pandeyy merged commit 23ddb1f into AOSSIE-Org:main May 13, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants