Skip to content

Add "drop not allowed" styles #935

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

jakeboone02
Copy link
Member

Introduce styles and logic to indicate when a drop action is not allowed during drag-and-drop interactions. This includes updates to relevant hooks and classnames to reflect the new state.

Copy link

netlify bot commented Aug 22, 2025

Deploy Preview for react-querybuilder ready!

Name Link
🔨 Latest commit 0ad97d4
🔍 Latest deploy log https://app.netlify.com/projects/react-querybuilder/deploys/68a8abcbf229c800087d8828
😎 Deploy Preview https://deploy-preview-935--react-querybuilder.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 50 (🔴 down 8 from production)
Accessibility: 89 (no change from production)
Best Practices: 100 (no change from production)
SEO: 95 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

claude bot commented Aug 22, 2025

Claude finished @jakeboone02's task —— View job


PR Review: Add "drop not allowed" styles

Reviewing the implementation for code quality, best practices, potential bugs, performance considerations, and security concerns.

Todo List:

  • Analyze core component changes (Rule.tsx, RuleGroup.tsx)
  • Review DnD package modifications
  • Examine styling implementation
  • Check TypeScript type definitions
  • Review utility function changes
  • Provide overall feedback and recommendations

Code Review Findings

Strengths

1. Consistent Implementation Pattern

  • Clean integration across all DnD components using the same monitor.isOver() && !monitor.canDrop() pattern
  • Proper TypeScript typing with dropNotAllowed: boolean in DropCollection interface
  • Consistent naming throughout the codebase

2. Good CSS Architecture

  • New CSS variable $rqb-dnd-drop-not-allowed-cursor: not-allowed follows existing pattern
  • Clean separation with dedicated .dndDropNotAllowed class
  • Uses CSS custom properties pattern: var(--#{$rqb-var-prefix}dnd-drop-not-allowed-cursor)

3. Proper Integration

  • dropNotAllowed properly merged in useMergedContext.ts:102
  • Added to mergeClassnames.ts:43 utility function
  • Included in both standardClassnames and defaultControlClassnames in defaults.ts

4. Type Safety

  • New optional props in RuleProps and RuleGroupProps interfaces
  • Maintains backward compatibility with optional dropNotAllowed?: boolean

🔍 Minor Considerations

1. Performance (packages/react-querybuilder/src/components/Rule.tsx:750, 759-760)

dropNotAllowed && classNamesProp.dndDropNotAllowed,
// ...
[standardClassnames.dndDropNotAllowed]: dropNotAllowed,

The conditional class application is efficiently implemented using short-circuit evaluation and object spread.

2. Memory Usage
The useMemo dependencies in Rule.tsx:764-787 properly include dropNotAllowed to prevent unnecessary re-renders.

🎯 No Issues Found

  • Security: No security concerns identified
  • Bugs: Implementation appears solid with proper null checks and type safety
  • Breaking Changes: All changes are additive and backward compatible
  • Testing: 100% test coverage maintained

Overall Assessment

This is a well-implemented feature that follows the project's established patterns and conventions perfectly. The changes are minimal, focused, and maintain the high code quality standards of the project. The implementation correctly handles the "drop not allowed" visual feedback in a consistent way across all drag-and-drop components.

Recommendation: ✅ Approve - Ready to merge.


Copy link

pkg-pr-new bot commented Aug 22, 2025

More templates

@react-querybuilder/antd

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/antd@935

@react-querybuilder/bootstrap

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/bootstrap@935

@react-querybuilder/bulma

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/bulma@935

@react-querybuilder/chakra

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/chakra@935

@react-querybuilder/datetime

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/datetime@935

@react-querybuilder/dnd

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/dnd@935

@react-querybuilder/drizzle

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/drizzle@935

@react-querybuilder/fluent

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/fluent@935

@react-querybuilder/mantine

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/mantine@935

@react-querybuilder/material

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/material@935

@react-querybuilder/native

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/native@935

react-querybuilder

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder@935

@react-querybuilder/tremor

npm i https://pkg.pr.new/react-querybuilder/react-querybuilder/@react-querybuilder/tremor@935

commit: 0ad97d4

Copy link

codesandbox-ci bot commented Aug 22, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0ad97d4:

Sandbox Source
React Query Builder CI Template Configuration
React Query Builder Basic Template Configuration
React Query Builder Basic TypeScript Template Configuration
React Query Builder Drag-and-drop Template Configuration
React Query Builder Ant Design Template Configuration
React Query Builder Bootstrap Template Configuration
React Query Builder Bulma Template Configuration
React Query Builder Chakra UI Template Configuration
React Query Builder Fluent UI Template Configuration
React Query Builder Mantine Template Configuration
React Query Builder MUI/Material Template Configuration
React Query Builder Native Template Configuration
React Query Builder Next.js Template Configuration
React Query Builder Preact Template Configuration
React Query Builder Tremor Template Configuration

Copy link

codecov bot commented Aug 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8e15b8f) to head (0ad97d4).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #935   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          200       200           
  Lines         6936      6943    +7     
  Branches      3499      3524   +25     
=========================================
+ Hits          6936      6943    +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Not allowed cursor for non droppable area is not visible in Macbook
1 participant