Skip to content

fix:Fix merge Conflict#1291

Open
akshajtiwari wants to merge 8 commits into
AOSSIE-Org:mainfrom
akshajtiwari:fix-conflict-1116
Open

fix:Fix merge Conflict#1291
akshajtiwari wants to merge 8 commits into
AOSSIE-Org:mainfrom
akshajtiwari:fix-conflict-1116

Conversation

@akshajtiwari
Copy link
Copy Markdown
Contributor

@akshajtiwari akshajtiwari commented May 25, 2026

Addressed Issues:

Fixes Issue
#942
Fixes Conflicted PR
#1116

Screenshots/Recordings:

NA

Additional Notes:

NA

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: Claude

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • New Features

    • Sidebar state now persists across sessions
    • Added collapse/expand button with tooltip to the sidebar
    • Gallery grid dynamically adjusts when the sidebar is expanded or collapsed
    • App title updated to "PictoPy - AI-Powered Photo Manager"
  • Bug Fixes

    • Fixed favorite image filtering logic to include truthy favorites
  • UI Improvements

    • Enhanced sidebar footer with version info and smooth animations
    • Improved sidebar interaction transitions

Review Change Stack

VasuS609 and others added 7 commits January 31, 2026 19:52
- Added chevron toggle button in sidebar footer with smooth 180° rotation
- Implemented persistent sidebar state using localStorage across app restarts
- Added smooth transitions (300ms ease-in-out) for all sidebar animations
- Footer text (version & copyright) displayed on single line, hidden when collapsed
- Tooltip shows 'Collapse/Expand sidebar' on hover for better UX
- Grid layout now responsive to sidebar state - shows more images per row when collapsed
- Grid min-size adjusts from 224px to 200px when sidebar collapses for optimal space usage
- All transitions synchronized and smooth without visual glitches
- Implement collapsible sidebar with localStorage persistence
- Add responsive gallery grid that adjusts to sidebar state (224px when open, 200px when closed)
- Fix race condition in sidebar state management by using setOpen directly
- Make copyright year dynamic using new Date().getFullYear()
- Remove redundant boolean comparison in favorites filter
- Update HTML title to 'PictoPy - AI-Powered Photo Manager'
- Fix strict equality operator in landing page

Fixes AOSSIE-Org#942
@github-actions github-actions Bot added UI enhancement New feature or request labels May 25, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Walkthrough

Sidebar state is now persisted via a browser cookie and consumed by AppSidebar and ChronologicalGallery to drive animated footer behavior, chevron rotation, menu transitions, and a responsive image grid. Small independent edits update favorites filtering and the document title.

Changes

Sidebar state persistence and responsive layout

Layer / File(s) Summary
Sidebar state cookie persistence
frontend/src/components/ui/sidebar.tsx
SidebarProvider reads sidebar_state cookie on mount to restore collapsed/expanded state, and writes the state back to the cookie on changes; cookie read/write errors are caught; some non-runtime comments were removed.
Sidebar UI animations and footer redesign
frontend/src/components/Navigation/Sidebar/AppSidebar.tsx
AppSidebar uses useSidebar() to access open/toggleSidebar, animates the footer text and chevron, adds transition classes to menu buttons, and exposes a tooltip-wrapped toggle button whose label switches between "Collapse sidebar" and "Expand sidebar".
Gallery responsive grid layout
frontend/src/components/Media/ChronologicalGallery.tsx
ChronologicalGallery imports useSidebar(), derives a gridMinSize from sidebar state, and applies it via inline gridTemplateColumns: repeat(auto-fill, minmax(gridMinSize, 1fr)) for responsive layout.

Independent fixes and branding

Layer / File(s) Summary
Favorites filtering logic
frontend/src/pages/Home/MyFav.tsx
MyFav now uses a truthy check (image.isFavourite) instead of strict equality (image.isFavourite === true) when filtering favorite images.
Product branding
frontend/index.html
Document <title> updated to "PictoPy - AI-Powered Photo Manager".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • AOSSIE-Org/PictoPy#634: Introduces isFavourite field from backend; this PR updates the frontend truthy check for filtering favorites, aligning with that change.

Suggested labels

TypeScript/JavaScript, Linter

Suggested reviewers

  • rahulharpal1603

Poem

🐰 A sidebar keeps its secret in a bite,
Cookies whisper open through the night,
The gallery shifts to fit the view just right,
Favorites find their stars, branding shines bright.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'fix:Fix merge Conflict' is vague and does not clearly describe the actual changes made, which include sidebar functionality enhancements, responsive gallery adjustments, and state persistence. Replace with a more descriptive title that captures the main changes, such as 'feat: Add sidebar collapse/expand state persistence and responsive gallery adjustments' or similar.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/src/components/ui/sidebar.tsx (1)

73-103: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Add automated tests for sidebar cookie persistence paths.

Line 75-87 and Line 99-101 introduce critical state persistence behavior, but this PR doesn’t show automated coverage for restore/write/error-tolerant paths (including controlled vs uncontrolled mode). Please add focused tests for these flows before merge.

As per coding guidelines, "Ensure that test code is automated, comprehensive, and follows testing best practices" and "Verify that all critical functionality is covered by tests."

🤖 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/ui/sidebar.tsx` around lines 73 - 103, Add automated
unit tests that cover the sidebar cookie persistence behavior: test the
React.useEffect restore path by baking document.cookie with
SIDEBAR_COOKIE_NAME=true/false and asserting _setOpen/open reflected, test the
write path by calling the setOpen function (both with a boolean and with a
functional updater) and assert document.cookie contains
SIDEBAR_COOKIE_NAME=<value> and uses SIDEBAR_COOKIE_MAX_AGE and path=/, test
error-tolerant paths by simulating exceptions when reading/writing
document.cookie (e.g., throwing on get/set) and asserting no uncaught errors,
and cover both controlled mode (when setOpenProp is provided) and uncontrolled
mode (using _setOpen) to ensure the correct setter is invoked.
🤖 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/Navigation/Sidebar/AppSidebar.tsx`:
- Around line 117-132: The icon-only toggle Button in AppSidebar lacks an
accessible name; update the Button (the one using onClick={toggleSidebar} and
rendering <ChevronLeft>) to include a dynamic aria-label like aria-label={open ?
'Collapse sidebar' : 'Expand sidebar'} (or alternatively add an sr-only <span>
with the same dynamic text inside the Button) so screen readers announce the
action tied to the open state.

---

Outside diff comments:
In `@frontend/src/components/ui/sidebar.tsx`:
- Around line 73-103: Add automated unit tests that cover the sidebar cookie
persistence behavior: test the React.useEffect restore path by baking
document.cookie with SIDEBAR_COOKIE_NAME=true/false and asserting _setOpen/open
reflected, test the write path by calling the setOpen function (both with a
boolean and with a functional updater) and assert document.cookie contains
SIDEBAR_COOKIE_NAME=<value> and uses SIDEBAR_COOKIE_MAX_AGE and path=/, test
error-tolerant paths by simulating exceptions when reading/writing
document.cookie (e.g., throwing on get/set) and asserting no uncaught errors,
and cover both controlled mode (when setOpenProp is provided) and uncontrolled
mode (using _setOpen) to ensure the correct setter is invoked.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6775bc3e-236c-48ee-81fe-8a58adcfd072

📥 Commits

Reviewing files that changed from the base of the PR and between 0528751 and 247e482.

📒 Files selected for processing (5)
  • frontend/index.html
  • frontend/src/components/Media/ChronologicalGallery.tsx
  • frontend/src/components/Navigation/Sidebar/AppSidebar.tsx
  • frontend/src/components/ui/sidebar.tsx
  • frontend/src/pages/Home/MyFav.tsx

Comment thread frontend/src/components/Navigation/Sidebar/AppSidebar.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.

🧹 Nitpick comments (1)
frontend/src/components/Navigation/Sidebar/AppSidebar.tsx (1)

117-133: ⚡ Quick win

Consider extracting the duplicate label text.

The label text open ? 'Collapse sidebar' : 'Expand sidebar' is repeated on lines 121 and 132. While both serve different purposes (aria-label for screen readers, tooltip for sighted users), extracting this to a computed constant would improve maintainability and ensure consistency.

♻️ Suggested refactor
              <TooltipTrigger asChild>
+               {(() => {
+                 const toggleLabel = open ? 'Collapse sidebar' : 'Expand sidebar';
+                 return (
                <Button
                  variant="ghost"
                  size="icon"
                  onClick={toggleSidebar}
-                 aria-label={open ? 'Collapse sidebar' : 'Expand sidebar'}
+                 aria-label={toggleLabel}
                  className="hover:bg-accent h-8 w-8 transition-transform duration-300 ease-in-out"
                >
                  <ChevronLeft
                    className={`h-5 w-5 transition-transform duration-300 ease-in-out ${
                      !open ? 'rotate-180' : ''
                    }`}
                  />
                </Button>
+                 );
+               })()}
              </TooltipTrigger>
              <TooltipContent side="right">
-               <p>{open ? 'Collapse sidebar' : 'Expand sidebar'}</p>
+               <p>{open ? 'Collapse sidebar' : 'Expand sidebar'}</p>
              </TooltipContent>

Or alternatively, compute it before the return statement:

  const menuItems = [
    { name: 'Home', path: `/${ROUTES.HOME}`, icon: Home },
    // ...
  ];
  
+ const toggleLabel = open ? 'Collapse sidebar' : 'Expand sidebar';

  return (
    <Sidebar

Then use toggleLabel in both locations.

🤖 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/Navigation/Sidebar/AppSidebar.tsx` around lines 117 -
133, In AppSidebar, the string expression used twice for the toggle button label
(used as the Button aria-label and in TooltipContent) should be extracted to a
single computed constant to avoid duplication and ensure consistency; compute a
const like toggleLabel = open ? 'Collapse sidebar' : 'Expand sidebar' (e.g.,
just before the return in the AppSidebar component) and then replace both
occurrences (the Button aria-label and the TooltipContent paragraph) with that
variable.
🤖 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.

Nitpick comments:
In `@frontend/src/components/Navigation/Sidebar/AppSidebar.tsx`:
- Around line 117-133: In AppSidebar, the string expression used twice for the
toggle button label (used as the Button aria-label and in TooltipContent) should
be extracted to a single computed constant to avoid duplication and ensure
consistency; compute a const like toggleLabel = open ? 'Collapse sidebar' :
'Expand sidebar' (e.g., just before the return in the AppSidebar component) and
then replace both occurrences (the Button aria-label and the TooltipContent
paragraph) with that variable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b0cb425e-7cea-43ad-8cde-aad19cb47fd9

📥 Commits

Reviewing files that changed from the base of the PR and between 247e482 and 81f32c9.

📒 Files selected for processing (1)
  • frontend/src/components/Navigation/Sidebar/AppSidebar.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants