feat(ui): Add dragging to keyless prompt#7845
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: a54f6b3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| <html | ||
| class="h-full" | ||
| dir="rtl" | ||
| > |
There was a problem hiding this comment.
Left over debugging that should have been removed.
📝 WalkthroughWalkthroughAdds drag-to-corner behavior for the KeylessPrompt: a new React hook 🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. No actionable comments were generated in the recent review. 🎉 Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/ui/src/components/devPrompts/KeylessPrompt/use-drag-to-corner.ts`:
- Around line 34-72: The file references React types (React.CSSProperties,
React.RefObject, PointerEventHandler) in the UseDragToCornerResult interface and
functions like getNearestCorner and getCornerStyles but doesn't import them; add
a type-only import from react (e.g. import type { CSSProperties, RefObject,
PointerEventHandler } from 'react') and update the interface/type annotations to
use CSSProperties and RefObject/PointerEventHandler so TypeScript with
allowUmdGlobalAccess disabled will compile.
| interface UseDragToCornerResult { | ||
| corner: Corner; | ||
| isDragging: boolean; | ||
| cornerStyle: React.CSSProperties; | ||
| containerRef: React.RefObject<HTMLDivElement>; | ||
| onPointerDown: PointerEventHandler; | ||
| preventClick: boolean; | ||
| isInitialized: boolean; | ||
| } | ||
|
|
||
| export function getNearestCorner(projectedTranslation: Point, corners: Record<Corner, Point>): Corner { | ||
| let nearestCorner: Corner = 'bottom-right'; | ||
| let minDistance = Infinity; | ||
|
|
||
| for (const [corner, translation] of Object.entries(corners)) { | ||
| const dx = projectedTranslation.x - translation.x; | ||
| const dy = projectedTranslation.y - translation.y; | ||
| const distance = Math.sqrt(dx * dx + dy * dy); | ||
| if (distance < minDistance) { | ||
| minDistance = distance; | ||
| nearestCorner = corner as Corner; | ||
| } | ||
| } | ||
|
|
||
| return nearestCorner; | ||
| } | ||
|
|
||
| export function getCornerStyles(corner: Corner): React.CSSProperties { | ||
| switch (corner) { | ||
| case 'top-left': | ||
| return { top: CORNER_OFFSET, left: CORNER_OFFSET }; | ||
| case 'top-right': | ||
| return { top: CORNER_OFFSET, right: CORNER_OFFSET }; | ||
| case 'bottom-left': | ||
| return { bottom: CORNER_OFFSET, left: CORNER_OFFSET }; | ||
| case 'bottom-right': | ||
| return { bottom: CORNER_OFFSET, right: CORNER_OFFSET }; | ||
| } | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, read the entire file to see imports and actual usage
cat -n packages/ui/src/components/devPrompts/KeylessPrompt/use-drag-to-corner.tsRepository: clerk/javascript
Length of output: 18612
🏁 Script executed:
# Check tsconfig for allowUmdGlobalAccess
find . -name "tsconfig*.json" -type f | head -5 | xargs grep -l "allowUmdGlobalAccess" 2>/dev/null || echo "No allowUmdGlobalAccess found"
cat tsconfig.json 2>/dev/null | grep -A5 -B5 "allowUmdGlobalAccess" || echo "Setting not found in root tsconfig"Repository: clerk/javascript
Length of output: 124
🏁 Script executed:
# Also check for compilerOptions in the packages/ui directory
find packages/ui -name "tsconfig*.json" -type f | head -3 | xargs catRepository: clerk/javascript
Length of output: 1084
Fix missing React type imports to prevent compilation errors.
Lines 37–38 and 61 reference React.CSSProperties and React.RefObject without importing the React namespace or these types. With allowUmdGlobalAccess disabled (not found in tsconfig), this will fail TypeScript compilation.
Import both types directly:
Suggested fix
-import type { PointerEventHandler } from 'react';
+import type { CSSProperties, PointerEventHandler, RefObject } from 'react';
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
@@
interface UseDragToCornerResult {
corner: Corner;
isDragging: boolean;
- cornerStyle: React.CSSProperties;
- containerRef: React.RefObject<HTMLDivElement>;
+ cornerStyle: CSSProperties;
+ containerRef: RefObject<HTMLDivElement>;
onPointerDown: PointerEventHandler;
preventClick: boolean;
isInitialized: boolean;
}
@@
-export function getCornerStyles(corner: Corner): React.CSSProperties {
+export function getCornerStyles(corner: Corner): CSSProperties {🤖 Prompt for AI Agents
In `@packages/ui/src/components/devPrompts/KeylessPrompt/use-drag-to-corner.ts`
around lines 34 - 72, The file references React types (React.CSSProperties,
React.RefObject, PointerEventHandler) in the UseDragToCornerResult interface and
functions like getNearestCorner and getCornerStyles but doesn't import them; add
a type-only import from react (e.g. import type { CSSProperties, RefObject,
PointerEventHandler } from 'react') and update the interface/type annotations to
use CSSProperties and RefObject/PointerEventHandler so TypeScript with
allowUmdGlobalAccess disabled will compile.
Description
Screen.Recording.2026-02-13.at.1.56.46.PM.mov
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
New Features
Tests
Chores
Style