Skip to content

Conversation

ChetanReddyC
Copy link

@ChetanReddyC ChetanReddyC commented Apr 22, 2025

fixes #2216

Why?
user @laxmanrathod69 raised issue this to enhance.

What i did?
1.Updated that when user hovers resume card it would show that options (Open,Rename,Duplicate,Lock,Delete) options.
2.And also ive enhanced the accessibility of those options as well even in the long list of resumes on dashboards by directly making it display that options as an overly on that card itself.
3.And also implemented an on click open that resume even without clicking on the open option explicitly.

Screenshots

OldOne:
OldOne

NewOne:
NewOne

Summary by CodeRabbit

  • New Features

    • Introduced a custom dropdown menu for resume cards that appears on hover, with smooth animations and improved interaction handling.
    • Added scroll state tracking to enhance interaction responsiveness during scrolling.
  • Style

    • Improved touch interaction on cards by updating touch-action handling for better compatibility with touch devices.

…view options on the resumecard in dashboard and, direct click on resume card to open it!
Copy link

coderabbitai bot commented Apr 22, 2025

📝 Walkthrough

Walkthrough

The changes replace the existing dropdown menu in the ResumeCard component with a custom hover-triggered dropdown menu that appears after a delay and includes smooth fade and slide animations. Dropdown visibility is managed using local state, mouse event handlers, and timers to prevent accidental triggers. A new ScrollContext tracks window scroll state to prevent dropdown opening during scrolling and to close it immediately on scroll. The GridView component is wrapped with a ScrollProvider to provide this context. The BaseCard component is updated to set the CSS touch-action property to improve touch input handling. Additionally, a new file with a comment about experimental 3D mouse hover effects is added but not integrated with these features.

Changes

File(s) Change Summary
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/base-card.tsx Added touchAction: 'auto' inline style to the Tilt wrapper for improved touch input handling.
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/resume-card.tsx Replaced DropdownMenu with a custom hover-triggered dropdown menu, added local state, refs, mouse event handlers, timers, and animations for dropdown control; integrated scroll state to close dropdown on scroll.
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/scroll-context.tsx Added ScrollContext and ScrollProvider to track scrolling state with debounced scroll event handling; exported useScroll hook.
apps/client/src/pages/dashboard/resumes/_layouts/grid/index.tsx Wrapped grid content inside ScrollProvider to provide scroll state context to nested components.
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/use-mouse-position.ts Added new file with a comment about experimental 3D mouse hover effects; no functional integration with current features.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ResumeCard

    User->>ResumeCard: Mouse enters card
    ResumeCard->>ResumeCard: Start 200ms timer to show dropdown
    User->>ResumeCard: Mouse leaves before 200ms
    ResumeCard->>ResumeCard: Cancel show timer
    User->>ResumeCard: Mouse stays over card >200ms
    ResumeCard->>ResumeCard: Show dropdown with fade/slide animation
    User->>ResumeCard: Mouse leaves card
    ResumeCard->>ResumeCard: Start 300ms timer to hide dropdown
    User->>ResumeCard: Mouse re-enters before 300ms
    ResumeCard->>ResumeCard: Cancel hide timer
    User->>ResumeCard: Mouse stays away >300ms
    ResumeCard->>ResumeCard: Hide dropdown with animation
    User->>ScrollContext: Scroll event detected
    ScrollContext->>ResumeCard: Set isScrolling true
    ResumeCard->>ResumeCard: Immediately hide dropdown
    ScrollContext->>ResumeCard: After 150ms debounce, set isScrolling false
Loading

Assessment against linked issues

Objective Addressed Explanation
Popover appears after 300ms hover, closes after 200ms leave, smooth CSS transition (2216) The dropdown appears after 200ms hover and closes after 300ms leave with smooth animations, meeting timing and animation requirements.
Mobile-responsive fallback (tap-to-show on touch devices) (2216) No explicit tap-to-show or mobile-specific touch handling implemented; only touch-action CSS property added.
Position popover relative to card without overlapping critical UI (2216) Dropdown is positioned as an overlay relative to the card with appropriate styling to avoid UI overlap.

Poem

🐇✨
A dashboard grid with cards anew,
Where hover brings a menu into view.
With timers set to ease the flow,
And mouse-tracked magic running below.
Touch or scroll, the code’s prepared—
For every bunny, well aware!
🌿🎉

✨ 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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

🔭 Outside diff range comments (1)
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/resume-card.tsx (1)

11-17: ⚠️ Potential issue

Remove dead DropdownMenu* imports

The legacy dropdown components are no longer referenced, so these imports will trigger “unused import” errors during the build.

-import {
-  DropdownMenu,
-  DropdownMenuContent,
-  DropdownMenuItem,
-  DropdownMenuSeparator,
-  DropdownMenuTrigger,
-} from "@reactive-resume/ui";
🧰 Tools
🪛 ESLint

[error] 12-12: 'DropdownMenu' is defined but never used.

(unused-imports/no-unused-imports)


[error] 13-13: 'DropdownMenuContent' is defined but never used.

(unused-imports/no-unused-imports)


[error] 14-14: 'DropdownMenuItem' is defined but never used.

(unused-imports/no-unused-imports)


[error] 15-15: 'DropdownMenuSeparator' is defined but never used.

(unused-imports/no-unused-imports)


[error] 16-16: 'DropdownMenuTrigger' is defined but never used.

(unused-imports/no-unused-imports)

🧹 Nitpick comments (4)
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/use-mouse-position.ts (2)

66-75: Move isElementHovered outside the hook to avoid re‑creation

isElementHovered is re‑declared on every render, although its logic is stateless and relies only on globals.
Extracting it once will reduce unnecessary allocations and keep referential equality stable for consumers.

-const isElementHovered = (element: HTMLElement | null): boolean => {
+const isElementHovered = (element: HTMLElement | null): boolean => {-};
+};

Then return it directly from the hook:

return { isElementHovered };
🧰 Tools
🪛 ESLint

[error] 66-66: Move arrow function 'isElementHovered' to the outer scope.

(unicorn/consistent-function-scoping)


[error] 67-67: Compare with undefined directly instead of using typeof.

(unicorn/no-typeof-undefined)


[error] 67-67: Compare with undefined directly instead of using typeof.

(unicorn/no-typeof-undefined)


67-68: Minor lint: compare directly with undefined

If you want to silence the eslint rule unicorn/no-typeof-undefined, compare values directly:

- if (!element || typeof window.mousePosX === 'undefined')
+ if (!element || window.mousePosX === undefined)

Purely cosmetic, can be skipped if the rule is disabled.

🧰 Tools
🪛 ESLint

[error] 67-67: Compare with undefined directly instead of using typeof.

(unicorn/no-typeof-undefined)


[error] 67-67: Compare with undefined directly instead of using typeof.

(unicorn/no-typeof-undefined)

apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/resume-card.tsx (2)

37-39: cardRef is declared but never used

If you plan to leverage the ref later (e.g., with isElementHovered), leave a TODO comment; otherwise, delete it to avoid the lint warning.

- const cardRef = useRef<HTMLDivElement>(null);

140-208: Improve keyboard accessibility

The hover‑overlay menu is unreachable via keyboard because it is created only on hover/mouse events and the buttons lack tabIndex.
Recommendation:

  1. Show the menu when the card gains focus (onFocus, onBlur).
  2. Ensure the first menu button gets autoFocus, or wrap the group in a role="menu" with arrow‑key handling.

This guarantees parity for keyboard and assistive‑technology users.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd21860 and b6fc4bf.

📒 Files selected for processing (3)
  • apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/base-card.tsx (1 hunks)
  • apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/resume-card.tsx (3 hunks)
  • apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/use-mouse-position.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/base-card.tsx (1)
apps/client/src/constants/parallax-tilt.ts (1)
  • defaultTiltProps (3-11)
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/resume-card.tsx (2)
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/base-card.tsx (1)
  • BaseCard (14-29)
libs/utils/src/namespaces/style.ts (1)
  • cn (14-14)
🪛 ESLint
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/use-mouse-position.ts

[error] 5-5: Use a type instead of an interface.

(@typescript-eslint/consistent-type-definitions)


[error] 66-66: Move arrow function 'isElementHovered' to the outer scope.

(unicorn/consistent-function-scoping)


[error] 67-67: Compare with undefined directly instead of using typeof.

(unicorn/no-typeof-undefined)


[error] 67-67: Compare with undefined directly instead of using typeof.

(unicorn/no-typeof-undefined)

apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/resume-card.tsx

[error] 105-105: Callbacks must be listed after all other props

(react/jsx-sort-props)

🔇 Additional comments (1)
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/base-card.tsx (1)

16-17: touchAction: 'auto' looks good

Explicitly restoring the default touch-action prevents unexpected gesture suppression from Tilt. No further issues spotted.

Copy link

@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: 0

🧹 Nitpick comments (2)
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/resume-card.tsx (2)

99-99: Fix ESLint error: Reorder JSX props.

React props should be ordered with callbacks after other props.

- onMouseEnter={handleMouseEnter}
- onMouseLeave={handleMouseLeave}
  className="relative"
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
🧰 Tools
🪛 ESLint

[error] 99-99: Callbacks must be listed after all other props

(react/jsx-sort-props)


143-149: Consider refactoring for DRY principle.

The dropdown's mouse enter handler duplicates logic from the main handleMouseEnter function.

- onMouseEnter={() => {
-   if (timeoutRef.current) {
-     clearTimeout(timeoutRef.current);
-   }
-   setDropdownOpen(true);
- }}
+ onMouseEnter={() => {
+   if (timeoutRef.current) {
+     clearTimeout(timeoutRef.current);
+   }
+   // Immediately show without delay when hovering the dropdown itself
+   setDropdownOpen(true);
+ }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c0910e and 1a4819e.

📒 Files selected for processing (3)
  • apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/resume-card.tsx (3 hunks)
  • apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/scroll-context.tsx (1 hunks)
  • apps/client/src/pages/dashboard/resumes/_layouts/grid/index.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/client/src/pages/dashboard/resumes/_layouts/grid/index.tsx (3)
apps/client/src/services/resume/resumes.ts (1)
  • useResumes (14-25)
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/scroll-context.tsx (1)
  • ScrollProvider (11-38)
libs/utils/src/namespaces/date.ts (1)
  • sortByDate (9-16)
🪛 ESLint
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/resume-card.tsx

[error] 99-99: Callbacks must be listed after all other props

(react/jsx-sort-props)

🔇 Additional comments (4)
apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/scroll-context.tsx (1)

1-38: Well-implemented ScrollContext for tracking window scroll state.

This new context provider is cleanly implemented with appropriate debouncing for scroll events and proper cleanup. The context provides a boolean isScrolling flag that will be useful for controlling UI behavior during scrolling actions.

Some notable quality aspects:

  • Good use of debouncing (150ms) to avoid excessive state updates
  • Proper cleanup of event listeners and timeouts on unmount
  • Use of passive event listeners for better performance
apps/client/src/pages/dashboard/resumes/_layouts/grid/index.tsx (1)

10-10: Clean integration of ScrollProvider.

The ScrollProvider is properly integrated to wrap the grid content without disrupting the existing functionality. This provides the scrolling state to all resume cards within the grid.

Also applies to: 16-58

apps/client/src/pages/dashboard/resumes/_layouts/grid/_components/resume-card.tsx (2)

22-73: Well-structured hover detection and state management.

Good implementation of delayed hover effects with appropriate debounce timing (200ms before showing, 300ms before hiding) to prevent accidental triggering. The integration with the ScrollContext to prevent dropdown opening during scrolling is particularly thoughtful for UX.

The code properly manages timeouts with useRef and cleans them up on component unmount.


134-203: Good UX implementation for dropdown menu.

The custom dropdown menu implementation provides several UX improvements:

  • Smooth fade and slide animations
  • Immediate response to hover on the dropdown itself
  • Background click to open the resume
  • Clear visual hierarchy with icons and separator
  • Proper event propagation control

This implementation aligns well with the PR objective of improving the accessibility of options when hovering over resume cards.

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.

[Enhancement] Show Popover on Hover for Resume Cards in Dashboard
1 participant