Skip to content

Conversation

@anuragGupta08
Copy link

@anuragGupta08 anuragGupta08 commented Nov 27, 2025

This PR adds hover hotspots for the navigation arrows, extending the clickable area (~5rem) so users don't need pixel-perfect precision.
It also fixes the small-image display issue by setting a minimum width and height in the ImageViewer component.

Fixes #658

2025-11-28.01-51-55.online-video-cutter.com.mp4

Summary by CodeRabbit

  • Bug Fixes

    • Reduced image viewer max zoom and enforced minimum display dimensions for more consistent image behavior.
    • Updated navigation buttons to expand clickable areas and improve hover/focus visuals.
  • Style

    • Minor HTML and component formatting cleanups (whitespace/newline adjustments).
  • Chores

    • Server message emission now writes directly to standard output, changing how log messages are routed.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Walkthrough

Restructures navigation button DOM to enlarge hover/click hotspots, tightens ImageViewer styling and max zoom, changes backend logging emit to write stdout lines prefixed with "[uvicorn]", and applies minor whitespace/formatting edits in several frontend files.

Changes

Cohort / File(s) Summary
Frontend Formatting
frontend/index.html, frontend/src/components/Media/ImageCard.tsx, frontend/src/pages/PersonImages/PersonImages.tsx
Whitespace/indentation and trailing-newline adjustments only; no behavior changes.
Frontend Navigation Hotspots
frontend/src/components/Media/NavigationButtons.tsx
Button markup restructured: outer full-height hotspot retains click handlers; inner absolutely-positioned wrapper contains Chevron icons and hover/focus visuals; type="button" added.
Frontend Image Viewer Constraints
frontend/src/components/Media/ImageViewer.tsx
Reduced maxScale 8→6; wrapper changed overflow: visiblehidden and set position: relative; image given minWidth/minHeight: 70vmin; removed zIndex: 50.
Backend Logging Output
backend/app/logging/setup_logging.py
emit now prints messages directly to stdout prefixed with "[uvicorn]", bypassing logger formatting and level handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Inspect NavigationButtons.tsx for ARIA/keyboard behavior and that click handlers remain on outer element.
  • Verify ImageViewer.tsx zoom/pan behavior with reduced maxScale and new overflow/size constraints.
  • Review setup_logging.py for intended logging routing and compatibility with log collectors/formatters.

Possibly related PRs

  • AOSSIE-Org/PictoPy#530 — Modifies frontend/src/components/Media/ImageViewer.tsx (refactor to react-zoom-pan-pinch and exposes zoom/reset APIs); likely interacts with viewer constraint/zoom changes.

Suggested labels

enhancement, UI, frontend

Suggested reviewers

  • rahulharpal1603

Poem

🐰
I hopped across the viewer wide,
Made arrow hotspots swell with pride,
I nudged the zoom to gentle scales,
And whispered logs in stdout trails,
A little rabbit cheers—hip, hop, stride!

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements the hover hotspot UI changes but introduces an unrelated backend logging change that is not required by issue #658. Remove the backend/app/logging/setup_logging.py changes (emit method replacement) as they are not part of the hover hotspot feature requirements in issue #658.
Out of Scope Changes check ⚠️ Warning The backend/app/logging/setup_logging.py modification alters the emit method to use direct print to stdout instead of logging, which is unrelated to the image viewer hover hotspot feature. Remove the unrelated backend logging changes. Keep only frontend changes in NavigationButtons.tsx, ImageViewer.tsx, and related files that address the hover hotspot requirement.
✅ 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 clearly and specifically describes the main change: adding hover-activation hotspots/extended hover areas for navigation arrows, matching the primary objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c2a377 and 65f8336.

📒 Files selected for processing (1)
  • frontend/src/components/Media/NavigationButtons.tsx (1 hunks)
🔇 Additional comments (2)
frontend/src/components/Media/NavigationButtons.tsx (2)

15-36: Extended left hotspot and accessibility wiring look solid

The left button now correctly uses a full-height w-20 (≈5rem) hotspot with group-hover styling on the inner pill, plus type="button", aria-label, and a visible focus-visible ring. This meets the extended hover/click area requirement while keeping the semantic button as the interactive target. If you ever want to ensure all pointer interactions are treated as a single control, you could optionally add pointer-events-none to the inner div, but the current setup is already functionally and accessibly sound.


38-59: Right hotspot correctly mirrors left behavior

The right navigation button mirrors the left: same full-height w-20 hotspot, group-based hover/focus styles, type="button", and aria-label. This keeps interaction and a11y behavior consistent across both sides and satisfies the hotspot requirement for the Next control as well.


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

Caution

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

⚠️ Outside diff range comments (1)
backend/app/logging/setup_logging.py (1)

231-250: Revert to using the configured logger instead of print.

The emit method now bypasses the entire logging infrastructure by using print directly. This defeats the purpose of the InterceptHandler and loses critical functionality:

  • Log level filtering is ignored (always prints regardless of configured level)
  • Custom color formatting from ColorFormatter is bypassed
  • Consistent log formatting is lost
  • The handler's configured formatter (line 278) is never used

Apply this diff to restore proper logging:

     def emit(self, record: logging.LogRecord) -> None:
         """
         Process a log record by forwarding it through our custom logger.
 
         Args:
             record: The log record to process
         """
         # Get the appropriate module name
         module_name = record.name
         if "." in module_name:
             module_name = module_name.split(".")[-1]
 
         # Create a message that includes the original module in the format
         msg = record.getMessage()
 
         # Find the appropriate logger
         logger = get_logger(module_name)
 
-        # Log the message with our custom formatting
-        print(f"[uvicorn] {msg}")
+        # Log the message through our logging system with proper level and formatting
+        logger.log(record.levelno, msg)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c37d8df and afdd2a6.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • backend/app/logging/setup_logging.py (1 hunks)
  • frontend/index.html (1 hunks)
  • frontend/src/components/Media/ImageCard.tsx (1 hunks)
  • frontend/src/components/Media/ImageViewer.tsx (3 hunks)
  • frontend/src/components/Media/NavigationButtons.tsx (1 hunks)
  • frontend/src/pages/PersonImages/PersonImages.tsx (1 hunks)
🔇 Additional comments (3)
frontend/src/components/Media/ImageViewer.tsx (3)

39-39: LGTM: Reasonable zoom constraint.

Reducing maxScale from 8 to 6 is a sensible constraint that prevents excessive zoom while still providing sufficient magnification for most use cases.


47-48: LGTM: Fixes viewer boundary issues.

Setting overflow: hidden with position: relative properly constrains the viewer boundaries and prevents content from escaping the container.


74-75: Verify if the minimum size constraint is appropriate for all image types.

Setting minWidth and minHeight to 70vmin forces images to display at a minimum of 70% of the smaller viewport dimension (e.g., ~756px on a 1920×1080 screen). While this addresses the small-image display issue mentioned in the PR objectives, it may aggressively upscale legitimately small images such as icons, thumbnails, or small graphics, potentially degrading visual quality or causing layout issues.

Consider testing with:

  • Small icons or thumbnails (e.g., 100×100px images)
  • Images with a large aspect ratio
  • Various viewport sizes (mobile, tablet, desktop)

If issues arise, consider a more conservative value like 40vmin or 50vmin, or implement conditional sizing based on the original image dimensions.

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

🧹 Nitpick comments (3)
frontend/src/components/Media/NavigationButtons.tsx (3)

16-20: Add explicit type="button" attribute.

While this button isn't in a form context, explicitly setting type="button" is a recommended best practice to prevent unintended form submission behavior if this component is ever used within a form.

Apply this diff:

       <button
         className="group absolute left-0 top-0 z-20 h-full w-20 cursor-pointer bg-transparent hover:bg-transparent"
         onClick={onPrevious}
         aria-label="Previous image"
+        type="button"
       >

32-36: Add explicit type="button" attribute.

Same recommendation as the left navigation button - explicitly set type="button" as a best practice.

Apply this diff:

       <button
         className="group absolute right-0 top-0 z-20 h-full w-20 cursor-pointer bg-transparent hover:bg-transparent"
         onClick={onNext}
         aria-label="Next image"
+        type="button"
       >

21-25: Remove unnecessary styles for cleaner code.

Minor code quality improvements:

  1. The z-30 on the inner divs is unnecessary since z-index only applies relative to siblings in the same stacking context (these are children of the z-20 buttons)
  2. The hover:bg-transparent is redundant since the buttons already have bg-transparent as the base style

Apply these diffs to both buttons:

         <div
-          className="absolute top-1/2 left-4 z-30 flex -translate-y-1/2 transform 
+          className="absolute top-1/2 left-4 flex -translate-y-1/2 transform 
                      items-center rounded-full bg-black/30 p-3 text-white 
                      backdrop-blur-md transition-all duration-200 
                      group-hover:bg-white/40 group-hover:shadow-lg pointer-events-none"

And update the button className:

-        className="group absolute left-0 top-0 z-20 h-full w-20 cursor-pointer bg-transparent hover:bg-transparent"
+        className="group absolute left-0 top-0 z-20 h-full w-20 cursor-pointer bg-transparent"

Apply similar changes to the right button.

Also applies to: 37-41

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between afdd2a6 and 6c2a377.

📒 Files selected for processing (1)
  • frontend/src/components/Media/NavigationButtons.tsx (1 hunks)
🔇 Additional comments (1)
frontend/src/components/Media/NavigationButtons.tsx (1)

16-29: I'm unable to access the repository due to cloning issues. However, I can analyze the review comment based on responsive design principles and the code snippet provided.

Let me assess the concern raised:

Analysis of the hotspot behavior concern:

The review comment raises valid questions about the 80px (w-20 in Tailwind) hotspots:

  1. Small mobile screens: On phones with viewports < 375px, 80px hotspots on each side would consume 160px, leaving only ~215px or less for content. This is a legitimate concern for older phones or landscape mode on smaller devices.

  2. Very narrow viewports (<160px total): The overlap scenario is theoretical but technically possible in extreme cases, though highly unlikely in practice.

  3. Lack of evidence: Without access to the codebase, I cannot verify:

    • Whether responsive adjustments exist (e.g., sm:w-16 or md:w-20)
    • Whether container constraints are defined in ImageViewer
    • Whether there are media query overrides
    • What the actual implementation does to handle these cases

Conclusion:

The review comment raises a reasonable concern that should be verified within the actual codebase. Since I cannot access the repository to confirm whether responsive adjustments exist, the verification must be done manually.


Verify hotspot behavior on mobile and narrow viewports. The 5rem (80px) wide hotspots on each side may cause issues on small mobile screens and could reduce content visibility significantly. Confirm whether responsive adjustments exist (e.g., reduced widths on sm: or md: breakpoints) or if container constraints prevent layout issues on viewports narrower than 20rem.

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 hover-activation hotspot /Extended hover area for navigation arrows

1 participant