Skip to content

Conversation

@Jayyadav1903
Copy link

@Jayyadav1903 Jayyadav1903 commented Jan 21, 2026

**PR: Add Smooth Exit Animation to Image Details Panel

Summary**

This PR adds a smooth exit animation to the Image Details panel in MediaInfoPanel, bringing the close interaction in line with the existing slide-in open animation.

Problem

Previously, the Image Details panel unmounted immediately when closed. This caused an abrupt visual cut that felt inconsistent and unfinished compared to the smooth entry animation. The mismatch degraded perceived UI quality and made the interaction feel jarring.

Solution

The panel lifecycle is now animated on both entry and exit using framer-motion, ensuring a fluid, consistent user experience.

Implementation Details

  • Component: MediaInfoPanel.tsx
  • Library: framer-motion

Changes made:

  • Wrapped the panel with to enable exit animations.
  • Replaced the static div with a <motion.div>.
  • Defined motion states:
    - initial: x: -100, opacity: 0
    - animate: x: 0, opacity: 1
    - exit: x: -100, opacity: 0
  • Added a stable key prop to ensure proper mount/unmount tracking by framer-motion.

Verification

  • Manual testing: Confirmed the panel slides and fades out smoothly when closed, matching the timing and feel of the opening animation.
  • Regression check: Verified that the open animation remains unchanged and panel content renders correctly.

Scope

  • UI/UX enhancement only
  • No behavioral or data changes
  • No impact on existing functionality outside the animation lifecycle

Why this PR is worth merging

  • Improves visual polish with minimal code changes
  • Aligns close behavior with existing open animation
  • No runtime risk, no API changes, no side effects

Summary by CodeRabbit

  • New Features
    • Added smooth animated transitions to the media information panel, providing enhanced visual feedback and a more polished experience when displaying and interacting with media details.

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

@github-actions
Copy link
Contributor

⚠️ 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 21, 2026

📝 Walkthrough

Walkthrough

The MediaInfoPanel component has been refactored to incorporate framer-motion animations. The panel now conditionally renders within an AnimatePresence wrapper with motion.div, enabling smooth enter/exit transitions. The close button is repositioned into a header bar within the animated container, while all content rendering logic remains intact.

Changes

Cohort / File(s) Summary
Animation Wrapper Implementation
frontend/src/components/Media/MediaInfoPanel.tsx
Replaced early return rendering with AnimatePresence-wrapped motion.div to enable enter/exit animations. Added framer-motion animation states (initial, animate, exit) and transition configuration. Repositioned close button into a header bar within the animated panel. Reorganized JSX structure to accommodate the animated container while preserving all data rendering logic (image name, date formatting, location, tags, position, open-file action).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰✨ A panel that glides in with grace,
With motion so smooth, it finds its place,
The close button dons a header so fine,
Animations dance—content still shines!
No logic bent, just styled anew,
Framer works magic, oh what a view! 🎬

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(ui): add smooth exit animation to image details panel' directly and clearly describes the main change—adding exit animations to the media/image details panel using framer-motion.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

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/src/components/Media/MediaInfoPanel.tsx`:
- Around line 116-125: The conditional that currently checks
currentImage?.metadata?.latitude and longitude uses truthiness and therefore
hides valid coordinates equal to 0; change the condition to explicitly check for
null/undefined (e.g., currentImage?.metadata?.latitude != null &&
currentImage?.metadata?.longitude != null) so 0 values are rendered, and keep
using currentImage.metadata.latitude.toFixed(4) and handleLocationClick as
before (guarding access behind the new explicit checks).

Comment on lines +116 to +125
{currentImage?.metadata?.latitude &&
currentImage?.metadata?.longitude ? (
<button
type="button"
onClick={handleLocationClick}
className="flex w-full cursor-pointer items-center truncate text-left font-medium text-white hover:underline"
title={`Lat: ${currentImage.metadata.latitude}, Lon: ${currentImage.metadata.longitude}`}
>
{tag}
</span>
))}
{`Lat: ${currentImage.metadata.latitude.toFixed(4)}, Lon: ${currentImage.metadata.longitude.toFixed(4)}`}
<SquareArrowOutUpRight className="ml-1 h-[14px] w-[14px]" />
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 | 🟡 Minor

Handle 0 latitude/longitude as valid coordinates.

Using a truthy check hides valid coordinates like 0. Prefer explicit null/undefined checks so 0 still renders the location.

🐛 Proposed fix
-                {currentImage?.metadata?.latitude &&
-                  currentImage?.metadata?.longitude ? (
+                {currentImage?.metadata?.latitude != null &&
+                  currentImage?.metadata?.longitude != null ? (
📝 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
{currentImage?.metadata?.latitude &&
currentImage?.metadata?.longitude ? (
<button
type="button"
onClick={handleLocationClick}
className="flex w-full cursor-pointer items-center truncate text-left font-medium text-white hover:underline"
title={`Lat: ${currentImage.metadata.latitude}, Lon: ${currentImage.metadata.longitude}`}
>
{tag}
</span>
))}
{`Lat: ${currentImage.metadata.latitude.toFixed(4)}, Lon: ${currentImage.metadata.longitude.toFixed(4)}`}
<SquareArrowOutUpRight className="ml-1 h-[14px] w-[14px]" />
{currentImage?.metadata?.latitude != null &&
currentImage?.metadata?.longitude != null ? (
<button
type="button"
onClick={handleLocationClick}
className="flex w-full cursor-pointer items-center truncate text-left font-medium text-white hover:underline"
title={`Lat: ${currentImage.metadata.latitude}, Lon: ${currentImage.metadata.longitude}`}
>
{`Lat: ${currentImage.metadata.latitude.toFixed(4)}, Lon: ${currentImage.metadata.longitude.toFixed(4)}`}
<SquareArrowOutUpRight className="ml-1 h-[14px] w-[14px]" />
🤖 Prompt for AI Agents
In `@frontend/src/components/Media/MediaInfoPanel.tsx` around lines 116 - 125, The
conditional that currently checks currentImage?.metadata?.latitude and longitude
uses truthiness and therefore hides valid coordinates equal to 0; change the
condition to explicitly check for null/undefined (e.g.,
currentImage?.metadata?.latitude != null && currentImage?.metadata?.longitude !=
null) so 0 values are rendered, and keep using
currentImage.metadata.latitude.toFixed(4) and handleLocationClick as before
(guarding access behind the new explicit checks).

@github-actions
Copy link
Contributor

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

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