Skip to content

Conversation

@nishanroy561
Copy link

@nishanroy561 nishanroy561 commented Jan 8, 2026

Fixes #969

Implementation Approach

1. Refactor SettingsCard Component:

  • Update SettingsCardProps to include an optional action prop (React.ReactNode).
  • Modify SettingsCard to render this action in the header, allowing flexible injection of controls (like toggle buttons) without breaking existing usages in UserPreferencesCard or ApplicationControlsCard.

2. Enhance FolderManagementCard:

  • Introduce local state isExpanded (defaulting to true for visibility).
  • Implement a toggle button using ChevronDown/ChevronUp icons from lucide-react.
  • Pass this toggle button to the new action prop of SettingsCard.
  • Wrap the folder list and picker content in a collapsible container to improve usability and reduce scrolling.

Before
Screenshot 2026-01-08 225255

After :
Screenshot 2026-01-08 225306

Summary by CodeRabbit

  • New Features

    • Folder Management Card now includes a collapsible interface. Users can expand and collapse the folders list using a toggle button in the card header.
    • Settings cards now support optional action buttons aligned to the header, providing quick access to card-specific controls.
  • Chores

    • Updated development dependencies for build process support.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

The pull request adds UI collapsibility to the FolderManagementCard component with local state management, extends SettingsCard to support optional action elements in its header, and introduces a new devDependency for browser mapping tooling.

Changes

Cohort / File(s) Summary
Package Dependencies
frontend/package.json
Added baseline-browser-mapping (^2.9.11) as a development dependency for build/tooling support.
FolderManagementCard UI Enhancement
frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx
Introduced expand/collapse state (isExpanded, default true) with ChevronUp/ChevronDown toggle button in card header. Wrapped folder list, AI Tagging controls, and progress section in conditional rendering block controlled by isExpanded state, preserving existing logic. Added icon imports for chevrons and useState hook.
SettingsCard Action Prop
frontend/src/pages/SettingsPage/components/SettingsCard.tsx
Added optional action?: React.ReactNode prop to SettingsCardProps interface. Component now renders action element (right-aligned) in header when provided.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement, frontend

Suggested reviewers

  • rahulharpal1603
  • Aditya30ag

Poem

🐰 A folder's heart now beats with grace,
Expand and collapse at its own pace,
Settings card opens with action in sight,
UI springs forth, collapsible and bright! 🎯✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately and specifically describes the main change: adding a collapsible folder management section to the settings page, which is the primary focus of the refactoring work across both modified components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

Copy link
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

🤖 Fix all issues with AI agents
In @frontend/package.json:
- Line 91: The devDependency "baseline-browser-mapping" is unused and should be
removed to avoid bloat; edit package.json to delete the
"baseline-browser-mapping": "^2.9.11" entry from the devDependencies (or, if you
intend to keep it, add actual imports/usages where the collapsible folder or
related code references baseline-browser-mapping so the package is justified),
then run package manager prune/install to update lockfile.
🧹 Nitpick comments (2)
frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx (2)

1-3: Consolidate React imports.

You're importing React on line 1 and useState separately on line 3. For consistency and cleaner imports, consolidate them into a single import statement.

♻️ Proposed consolidation
-import React from 'react';
 import { Folder, Trash2, Check, ChevronDown, ChevronUp } from 'lucide-react';
-import { useState } from 'react';
+import React, { useState } from 'react';

40-53: Add aria-label for accessibility.

The toggle button should include an aria-label or aria-expanded attribute to improve screen reader support. This helps assistive technology users understand the button's purpose and current state.

♿ Proposed accessibility enhancement
       action={
         <Button
           variant="ghost"
           size="sm"
           className="h-8 w-8 p-0"
           onClick={() => setIsExpanded(!isExpanded)}
+          aria-label={isExpanded ? "Collapse folder list" : "Expand folder list"}
+          aria-expanded={isExpanded}
         >
           {isExpanded ? (
             <ChevronUp className="h-4 w-4" />
           ) : (
             <ChevronDown className="h-4 w-4" />
           )}
         </Button>
       }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3af96c and 056acee.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • frontend/package.json
  • frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx
  • frontend/src/pages/SettingsPage/components/SettingsCard.tsx
🔇 Additional comments (3)
frontend/src/pages/SettingsPage/components/SettingsCard.tsx (2)

17-20: LGTM! Clean extensibility enhancement.

The addition of the optional action prop is well-typed and maintains backward compatibility. This provides a flexible way to inject header controls without modifying the core card structure.


47-47: LGTM! Proper action rendering.

The action is conditionally rendered with ml-auto for correct right-alignment in the header.

frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx (1)

55-157: LGTM! Collapsible implementation is well-structured.

The collapsible functionality is correctly implemented with:

  • Proper state management using isExpanded
  • Smooth animation using Tailwind utility classes
  • All folder content appropriately wrapped in the conditional block
  • Existing functionality preserved within the collapsible section

"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.20",
"babel-jest": "^29.7.0",
"baseline-browser-mapping": "^2.9.11",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify if baseline-browser-mapping is referenced anywhere in the codebase

echo "Searching for baseline-browser-mapping usage in source files..."
rg -n "baseline-browser-mapping" --type ts --type tsx --type js --type json -g '!package*.json'

echo -e "\nSearching for any imports or requires of this package..."
rg -n "from ['\"]baseline-browser-mapping['\"]" --type ts --type tsx --type js
rg -n "require\(['\"]baseline-browser-mapping['\"]\)" --type ts --type tsx --type js

echo -e "\nChecking package.json references..."
rg -n "baseline-browser-mapping" frontend/package.json

Repository: AOSSIE-Org/PictoPy

Length of output: 367


Remove the unused baseline-browser-mapping devDependency.

The package is added to package.json but is not imported or used anywhere in the codebase. Unused dependencies bloat the project and increase build time. Either use this package as part of the collapsible folder feature or remove it from package.json.

🤖 Prompt for AI Agents
In @frontend/package.json at line 91, The devDependency
"baseline-browser-mapping" is unused and should be removed to avoid bloat; edit
package.json to delete the "baseline-browser-mapping": "^2.9.11" entry from the
devDependencies (or, if you intend to keep it, add actual imports/usages where
the collapsible folder or related code references baseline-browser-mapping so
the package is justified), then run package manager prune/install to update
lockfile.

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.

Feat:Add toggle button to collapse Folder Management in the settings

1 participant