-
Notifications
You must be signed in to change notification settings - Fork 419
chore(ui): Introduce radio group for EnableOrganizationsPrompt
#7444
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
base: main
Are you sure you want to change the base?
chore(ui): Introduce radio group for EnableOrganizationsPrompt
#7444
Conversation
🦋 Changeset detectedLatest commit: 8bab845 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughReplaces the Switch-based UI in EnableOrganizationsPrompt with a controlled RadioGroup (two options), adds a PromptBadge and accessibility IDs, updates layout/imports, and adds a changeset patch entry for Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (12)**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
packages/**/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
packages/**/src/**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
**/*.ts?(x)📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
**/*.{md,tsx}📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Files:
**/*.{jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)
Files:
**/*.{js,ts,jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Files:
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
🔇 Additional comments (1)
Comment |
26e4a13 to
98202ad
Compare
98202ad to
469bcc1
Compare
469bcc1 to
bd96ed0
Compare
There was a problem hiding this 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
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.changeset/tasty-coats-tickle.md(1 hunks)packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx(3 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
All code must pass ESLint checks with the project's configuration
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Follow established naming conventions (PascalCase for components, camelCase for variables)
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
packages/**/src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.ts?(x)
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.tsx: Use error boundaries in React components
Minimize re-renders in React components
**/*.tsx: Use proper type definitions for props and state in React components
Leverage TypeScript's type inference where possible in React components
Use proper event types for handlers in React components
Implement proper generic types for reusable React components
Use proper type guards for conditional rendering in React components
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{md,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Update documentation for API changes
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components (e.g.,UserProfile,NavigationMenu)
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Separate UI components from business logic components
Use useState for simple state management in React components
Use useReducer for complex state logic in React components
Implement proper state initialization in React components
Use proper state updates with callbacks in React components
Implement proper state cleanup in React components
Use Context API for theme/authentication state management
Implement proper state persistence in React applications
Use React.memo for expensive components
Implement proper useCallback for handlers in React components
Use proper useMemo for expensive computations in React components
Implement proper virtualization for lists in React components
Use proper code splitting with React.lazy in React applications
Implement proper cleanup in useEffect hooks
Use proper refs for DOM access in React components
Implement proper event listener cleanup in React components
Use proper abort controllers for fetch in React components
Implement proper subscription cleanup in React components
Use proper HTML elements for semantic HTML in React components
Implement proper ARIA attributes for accessibility in React components
Use proper heading hierarchy in React components
Implement proper form labels in React components
Use proper button types in React components
Implement proper focus management for keyboard navigation in React components
Use proper keyboard shortcuts in React components
Implement proper tab order in React components
Use proper ...
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)
**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Implement type guards forunknowntypes using the patternfunction isType(value: unknown): value is Type
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details in classes
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like<T extends { id: string }>
Use utility types likeOmit,Partial, andPickfor data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Useconst assertionswithas constfor literal types
Usesatisfiesoperator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use ESLint with custom configurations tailored for different package types
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use Prettier for code formatting across all packages
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
.changeset/tasty-coats-tickle.md (1)
1-5: Changeset looks correct and matches the UI refactor.
Patch bump for@clerk/uiand the note text are consistent with the PR scope.packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (1)
200-214: RadioGroup wiring toallowPersonalAccountstate is clear and matches the two-option UX.
The boolean ↔︎ string mapping reads cleanly and is hard to misinterpret.
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
Outdated
Show resolved
Hide resolved
bd96ed0 to
0392e42
Compare
0392e42 to
53279ca
Compare
@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/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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (1)
394-408: Add aria-label to complete the radiogroup accessibility.While
role='radiogroup'was added (addressing part of the previous review), the group still lacks an accessible label. Screen reader users won't know what these radio options control.Apply this diff to add an accessible label:
return ( <RadioGroupContext.Provider value={contextValue}> <Flex role='radiogroup' + aria-label='Organization access settings' direction='col' gap={3} > {children} </Flex> </RadioGroupContext.Provider> );
🧹 Nitpick comments (3)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (3)
200-214: Wrap the onChange handler in useCallback to prevent unnecessary re-renders.The inline onChange handler creates a new function on every render, which invalidates the
useMemoin the RadioGroup component (line 396) and causes unnecessary re-renders of context consumers.Apply this diff to memoize the handler:
+ const handleRadioGroupChange = React.useCallback( + (value: string) => setAllowPersonalAccount(value === 'allow'), + [] + ); + <RadioGroup value={allowPersonalAccount ? 'allow' : 'require'} - onChange={value => setAllowPersonalAccount(value === 'allow')} + onChange={handleRadioGroupChange} >
380-409: Add JSDoc documentation for the RadioGroup component and its types.Per coding guidelines, all components should have comprehensive JSDoc comments documenting their purpose, parameters, and usage.
+/** + * Context value for RadioGroup components + * @internal + */ type RadioGroupContextValue = { + /** Unique name for the radio group */ name: string; + /** Currently selected value */ value: string; + /** Callback fired when selection changes */ onChange: (value: string) => void; }; const [RadioGroupContext, useRadioGroup] = createContextAndHook<RadioGroupContextValue>('RadioGroupContext'); +/** + * Props for RadioGroup component + * @internal + */ type RadioGroupProps = { + /** Currently selected value */ value: string; + /** Callback fired when selection changes */ onChange: (value: string) => void; + /** RadioGroupItem children */ children: React.ReactNode; }; +/** + * RadioGroup component for mutually exclusive options + * @internal + */ const RadioGroup = ({ value, onChange, children }: RadioGroupProps) => {
411-506: Add JSDoc documentation for RadioGroupItem.The component and its props should be documented per coding guidelines for maintainability.
+/** + * Props for RadioGroupItem component + * @internal + */ type RadioGroupItemProps = { + /** Value for this radio option */ value: string; + /** Label text for the radio option */ label: string; + /** Optional description text */ description?: string; }; +/** + * Individual radio option within a RadioGroup + * @internal + */ const RadioGroupItem = ({ value, label, description }: RadioGroupItemProps) => {
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.changeset/tasty-coats-tickle.md(1 hunks)packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- .changeset/tasty-coats-tickle.md
🧰 Additional context used
📓 Path-based instructions (12)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
All code must pass ESLint checks with the project's configuration
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Follow established naming conventions (PascalCase for components, camelCase for variables)
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
packages/**/src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.ts?(x)
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.tsx: Use error boundaries in React components
Minimize re-renders in React components
**/*.tsx: Use proper type definitions for props and state in React components
Leverage TypeScript's type inference where possible in React components
Use proper event types for handlers in React components
Implement proper generic types for reusable React components
Use proper type guards for conditional rendering in React components
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{md,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Update documentation for API changes
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components (e.g.,UserProfile,NavigationMenu)
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Separate UI components from business logic components
Use useState for simple state management in React components
Use useReducer for complex state logic in React components
Implement proper state initialization in React components
Use proper state updates with callbacks in React components
Implement proper state cleanup in React components
Use Context API for theme/authentication state management
Implement proper state persistence in React applications
Use React.memo for expensive components
Implement proper useCallback for handlers in React components
Use proper useMemo for expensive computations in React components
Implement proper virtualization for lists in React components
Use proper code splitting with React.lazy in React applications
Implement proper cleanup in useEffect hooks
Use proper refs for DOM access in React components
Implement proper event listener cleanup in React components
Use proper abort controllers for fetch in React components
Implement proper subscription cleanup in React components
Use proper HTML elements for semantic HTML in React components
Implement proper ARIA attributes for accessibility in React components
Use proper heading hierarchy in React components
Implement proper form labels in React components
Use proper button types in React components
Implement proper focus management for keyboard navigation in React components
Use proper keyboard shortcuts in React components
Implement proper tab order in React components
Use proper ...
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)
**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Implement type guards forunknowntypes using the patternfunction isType(value: unknown): value is Type
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details in classes
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like<T extends { id: string }>
Use utility types likeOmit,Partial, andPickfor data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Useconst assertionswithas constfor literal types
Usesatisfiesoperator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use ESLint with custom configurations tailored for different package types
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use Prettier for code formatting across all packages
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (27)
- GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
- GitHub Check: Integration Tests (machine, chrome)
- GitHub Check: Integration Tests (machine, chrome, RQ)
- GitHub Check: Integration Tests (quickstart, chrome, 16)
- GitHub Check: Integration Tests (quickstart, chrome, 15)
- GitHub Check: Integration Tests (nextjs, chrome, 16)
- GitHub Check: Integration Tests (react-router, chrome)
- GitHub Check: Integration Tests (nuxt, chrome)
- GitHub Check: Integration Tests (billing, chrome, RQ)
- GitHub Check: Integration Tests (custom, chrome)
- GitHub Check: Integration Tests (tanstack-react-start, chrome)
- GitHub Check: Integration Tests (billing, chrome)
- GitHub Check: Integration Tests (vue, chrome)
- GitHub Check: Integration Tests (handshake, chrome)
- GitHub Check: Integration Tests (localhost, chrome)
- GitHub Check: Integration Tests (handshake:staging, chrome)
- GitHub Check: Integration Tests (express, chrome)
- GitHub Check: Integration Tests (astro, chrome)
- GitHub Check: Integration Tests (ap-flows, chrome)
- GitHub Check: Integration Tests (generic, chrome)
- GitHub Check: Integration Tests (sessions:staging, chrome)
- GitHub Check: Integration Tests (sessions, chrome)
- GitHub Check: Build Packages
- GitHub Check: Formatting | Dedupe | Changeset
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (1)
432-506: The color contrast for both the description text (#c3c3c6) and label text (#ffffff) on the dark background (#1f1f1f) exceeds WCAG standards. Description text achieves 9.37:1 contrast (exceeding WCAG AAA's 7.0:1 requirement for normal text), and label text achieves 16.48:1 contrast. No accessibility issues exist with the current color choices.Likely an incorrect or invalid review comment.
53279ca to
7e7646e
Compare
|
We made some changes on the Figma prototype so I'll update this PR with it and open for review again |
|
fyi a RadioGroup exists in case it can be reused or consolidated with the new one. |
| ); | ||
| }, | ||
| ); | ||
| </Flex> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the previous implementation, the description should live outside the label and use paddingInlineStart for alignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed on 25fa84e
| return ( | ||
| <RadioGroupContext.Provider value={contextValue}> | ||
| <Flex | ||
| role='radiogroup' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| role='radiogroup' | |
| role='radiogroup' | |
| aria-orientation="vertical" | |
| aria-labelledby="HEADING_ID_GOES_HERE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the aria-labelledby should be tied to the text `Enable Organizations to use
so maybe the context holds the heading id that can be applied to the text?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added aria-labelledby as a prop here: 4e270d4
@panteliselef We'd like to use similar styles as our Clerk Ceramic design system to keep consistent with the Dashboard prompt Also, the custom theme variants shouldn't affect this prompt, eg: a developer changes some descriptor |
a9df639 to
9cba2d0
Compare
There was a problem hiding this 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
♻️ Duplicate comments (1)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (1)
432-461: RadioGroup context usage is correct; add an explicit accessible name for the radiogroup.The
createContextAndHookintegration with{ value: { name, value, onChange } }matches existing Clerk patterns (contexts store{ value: T }, hook returnsT), so the context shape and memoization look good.For a11y, the wrapper
Flexcurrently only hasrole='radiogroup'. Providing an explicit accessible name will improve screen-reader navigation. For example, you could pass anariaLabelledByprop from the parent and apply it here:-type RadioGroupProps = { - value: string; - onChange: (value: string) => void; - children: React.ReactNode; -}; +type RadioGroupProps = { + value: string; + onChange: (value: string) => void; + children: React.ReactNode; + 'aria-labelledby'?: string; +}; -const RadioGroup = ({ value, onChange, children }: RadioGroupProps) => { +const RadioGroup = ({ value, onChange, children, 'aria-labelledby': ariaLabelledBy }: RadioGroupProps) => { const name = useId(); const contextValue = React.useMemo(() => ({ value: { name, value, onChange } }), [name, value, onChange]); return ( <RadioGroupContext.Provider value={contextValue}> <Flex role='radiogroup' + aria-labelledby={ariaLabelledBy} direction='col' gap={3} > {children} </Flex> </RadioGroupContext.Provider> ); };Then, from the parent, tie
aria-labelledbyto the text that conceptually labels the group (e.g., the enable/organizations explanation).If you’d like, I can suggest a concrete ID wiring from the existing heading/description to this
RadioGroupso the group name matches design copy.
🧹 Nitpick comments (2)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (2)
182-245: Radio-group wiring and warning alert look correct; consider minor reuse/a11y polish.The
allowPersonalAccount↔'allow' | 'require'mapping andorganization_allow_personal_accountsparameter are wired correctly, and the warningAlertcopy is clear for the “require org membership” case.Two small, optional improvements:
- Reuse the existing
Linkcomponent for the “Learn more” link inside theAlertto avoid duplicating link styling logic.- If design allows, consider shortening or breaking the warning text with
<br />or additional block elements for readability in narrow widths.
469-597: Custom radio item is well-structured; consider a small focus/contrast safety net.The combination of a visually-hidden native
<input type="radio">, custom circle indicator, and separate description witharia-describedbyis solid, and the keyboard interaction (onChange={() => onChange(value)}) remains native.Two optional refinements:
- Focus visibility fallback: The focus ring currently relies on
:has(input:focus-visible). Older or non-evergreen browsers without:hassupport won’t show a visible focus indicator on the custom circle. If you care about those, you could add a minimal fallback (for example, a basic outline on the label when the input is focused, guarded by@supports not selector(:has(input:focus-visible))).- Color contrast check: The selected-state purple (
#6c47ff+color-mix) against the dark background looks aligned with Ceramic, but given earlier concerns about contrast on this prompt, it’s worth double‑checking it meets your target WCAG level in the final background context.These are polish items; the current implementation is otherwise robust.
If you want, I can sketch a small
@supportsblock to provide a non-:hasfallback for the focus styles.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.changeset/tasty-coats-tickle.md(1 hunks)packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx(3 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
All code must pass ESLint checks with the project's configuration
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Follow established naming conventions (PascalCase for components, camelCase for variables)
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
packages/**/src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.ts?(x)
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.tsx: Use error boundaries in React components
Minimize re-renders in React components
**/*.tsx: Use proper type definitions for props and state in React components
Leverage TypeScript's type inference where possible in React components
Use proper event types for handlers in React components
Implement proper generic types for reusable React components
Use proper type guards for conditional rendering in React components
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{md,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Update documentation for API changes
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components (e.g.,UserProfile,NavigationMenu)
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Separate UI components from business logic components
Use useState for simple state management in React components
Use useReducer for complex state logic in React components
Implement proper state initialization in React components
Use proper state updates with callbacks in React components
Implement proper state cleanup in React components
Use Context API for theme/authentication state management
Implement proper state persistence in React applications
Use React.memo for expensive components
Implement proper useCallback for handlers in React components
Use proper useMemo for expensive computations in React components
Implement proper virtualization for lists in React components
Use proper code splitting with React.lazy in React applications
Implement proper cleanup in useEffect hooks
Use proper refs for DOM access in React components
Implement proper event listener cleanup in React components
Use proper abort controllers for fetch in React components
Implement proper subscription cleanup in React components
Use proper HTML elements for semantic HTML in React components
Implement proper ARIA attributes for accessibility in React components
Use proper heading hierarchy in React components
Implement proper form labels in React components
Use proper button types in React components
Implement proper focus management for keyboard navigation in React components
Use proper keyboard shortcuts in React components
Implement proper tab order in React components
Use proper ...
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)
**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Implement type guards forunknowntypes using the patternfunction isType(value: unknown): value is Type
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details in classes
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like<T extends { id: string }>
Use utility types likeOmit,Partial, andPickfor data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Useconst assertionswithas constfor literal types
Usesatisfiesoperator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use ESLint with custom configurations tailored for different package types
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use Prettier for code formatting across all packages
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
- GitHub Check: Publish with pkg-pr-new
- GitHub Check: Unit Tests (**)
- GitHub Check: Unit Tests (shared, clerk-js, RQ)
- GitHub Check: Static analysis
- GitHub Check: Integration Tests (custom, chrome)
- GitHub Check: Integration Tests (quickstart, chrome, 15)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
- GitHub Check: Integration Tests (machine, chrome, RQ)
- GitHub Check: Integration Tests (nuxt, chrome)
- GitHub Check: Integration Tests (billing, chrome, RQ)
- GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
- GitHub Check: Integration Tests (billing, chrome)
- GitHub Check: Integration Tests (sessions:staging, chrome)
- GitHub Check: Integration Tests (handshake:staging, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 16)
- GitHub Check: Integration Tests (machine, chrome)
- GitHub Check: Integration Tests (astro, chrome)
- GitHub Check: Integration Tests (vue, chrome)
- GitHub Check: Integration Tests (react-router, chrome)
- GitHub Check: Integration Tests (ap-flows, chrome)
- GitHub Check: Integration Tests (quickstart, chrome, 16)
- GitHub Check: Integration Tests (localhost, chrome)
- GitHub Check: Integration Tests (generic, chrome)
- GitHub Check: Integration Tests (sessions, chrome)
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (3)
.changeset/tasty-coats-tickle.md (1)
1-5: Changeset entry looks correct for this UI-only tweak.Patch bump for
@clerk/uiwith a brief description matches the scope of introducing the new radio group UI.packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (2)
1-16: Import and theming updates align with the new prompt UI.Using
InternalThemeProvider,Flex, and Emotion’scsshere is consistent with the rest of the prompt code and supports the new radio-based layout without introducing issues.
407-430: PromptBadge implementation is straightforward and consistent with the prompt UI.Badge styles (inline-flex, small font, neutral background) fit the rest of the prompt’s visual language and keep “Most common” clearly distinguishable without introducing extra complexity.
7da9150 to
25fa84e
Compare
There was a problem hiding this 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 (2)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (2)
376-399: Add explicit return type.Per coding guidelines, functions should have explicit return types, especially for component definitions.
Apply this diff:
-const PromptBadge = ({ children }: PromptBadgeProps) => { +const PromptBadge = ({ children }: PromptBadgeProps): JSX.Element => { return (
416-433: Add explicit return type.Per coding guidelines, component functions should have explicit return types. The accessibility implementation looks good with proper
role,aria-orientation, andaria-labelledbyattributes.Apply this diff:
-const RadioGroup = ({ value, onChange, children, labelledBy }: RadioGroupProps) => { +const RadioGroup = ({ value, onChange, children, labelledBy }: RadioGroupProps): JSX.Element => { const name = useId();
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx(5 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
All code must pass ESLint checks with the project's configuration
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Follow established naming conventions (PascalCase for components, camelCase for variables)
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
packages/**/src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.ts?(x)
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.tsx: Use error boundaries in React components
Minimize re-renders in React components
**/*.tsx: Use proper type definitions for props and state in React components
Leverage TypeScript's type inference where possible in React components
Use proper event types for handlers in React components
Implement proper generic types for reusable React components
Use proper type guards for conditional rendering in React components
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{md,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Update documentation for API changes
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components (e.g.,UserProfile,NavigationMenu)
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Separate UI components from business logic components
Use useState for simple state management in React components
Use useReducer for complex state logic in React components
Implement proper state initialization in React components
Use proper state updates with callbacks in React components
Implement proper state cleanup in React components
Use Context API for theme/authentication state management
Implement proper state persistence in React applications
Use React.memo for expensive components
Implement proper useCallback for handlers in React components
Use proper useMemo for expensive computations in React components
Implement proper virtualization for lists in React components
Use proper code splitting with React.lazy in React applications
Implement proper cleanup in useEffect hooks
Use proper refs for DOM access in React components
Implement proper event listener cleanup in React components
Use proper abort controllers for fetch in React components
Implement proper subscription cleanup in React components
Use proper HTML elements for semantic HTML in React components
Implement proper ARIA attributes for accessibility in React components
Use proper heading hierarchy in React components
Implement proper form labels in React components
Use proper button types in React components
Implement proper focus management for keyboard navigation in React components
Use proper keyboard shortcuts in React components
Implement proper tab order in React components
Use proper ...
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)
**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Implement type guards forunknowntypes using the patternfunction isType(value: unknown): value is Type
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details in classes
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like<T extends { id: string }>
Use utility types likeOmit,Partial, andPickfor data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Useconst assertionswithas constfor literal types
Usesatisfiesoperator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use ESLint with custom configurations tailored for different package types
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use Prettier for code formatting across all packages
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
🧬 Code graph analysis (1)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (2)
packages/ui/src/components/devPrompts/shared.tsx (1)
basePromptElementStyles(33-55)packages/shared/src/react/hooks/index.ts (1)
createContextAndHook(1-1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (27)
- GitHub Check: Integration Tests (ap-flows, chrome)
- GitHub Check: Integration Tests (react-router, chrome)
- GitHub Check: Integration Tests (quickstart, chrome, 16)
- GitHub Check: Integration Tests (machine, chrome)
- GitHub Check: Integration Tests (quickstart, chrome, 15)
- GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
- GitHub Check: Integration Tests (billing, chrome, RQ)
- GitHub Check: Integration Tests (billing, chrome)
- GitHub Check: Integration Tests (machine, chrome, RQ)
- GitHub Check: Integration Tests (custom, chrome)
- GitHub Check: Integration Tests (nuxt, chrome)
- GitHub Check: Integration Tests (handshake, chrome)
- GitHub Check: Integration Tests (vue, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 16)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
- GitHub Check: Integration Tests (localhost, chrome)
- GitHub Check: Integration Tests (handshake:staging, chrome)
- GitHub Check: Integration Tests (sessions, chrome)
- GitHub Check: Integration Tests (tanstack-react-start, chrome)
- GitHub Check: Integration Tests (generic, chrome)
- GitHub Check: Integration Tests (astro, chrome)
- GitHub Check: Integration Tests (sessions:staging, chrome)
- GitHub Check: Integration Tests (express, chrome)
- GitHub Check: Formatting | Dedupe | Changeset
- GitHub Check: Build Packages
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (3)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (3)
1-13: LGTM!The import additions properly support the new RadioGroup implementation with context, styling, and accessibility hooks.
31-31: LGTM!Good use of
useId()to generate a unique, stable ID for linking the radio group to its label viaaria-labelledby.
144-144: LGTM!The ID properly connects the descriptive text to the radio group via
aria-labelledby, improving screen reader navigation.
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
Show resolved
Hide resolved
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
♻️ Duplicate comments (2)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx (2)
192-205: ReplaceclassName='block'with Emotion styling for consistency.The description uses
className='block'inside thedescriptionprop, which is inconsistent with the Emotion-based styling everywhere else and depends on a global CSS class that may not exist.Refactor to use the
cssprop instead so layout is self‑contained:- description={ - <> - <span className='block'>Users need to belong to at least one organization.</span> - <span>Common for most B2B SaaS applications</span> - </> - } + description={ + <> + <span + css={css` + display: block; + `} + > + Users need to belong to at least one organization. + </span> + <span + css={css` + display: block; + `} + > + Common for most B2B SaaS applications + </span> + </> + }
441-573: Gatecolor-mix()behindcssSupportsand add explicit return type onRadioGroupItem.
color-mix()is used directly for checked and hover‑checked states; on browsers without support this will drop the background, which is what the repo’scssSupports.colorMix()helper is meant to avoid.RadioGroupItemalso still lacks an explicit return type.You can address both like this:
- Define feature‑aware color constants near the radio sizing constants (and import
cssSupportsat the top):// at top-level imports // import { cssSupports } from '../../../utils/cssSupports'; const RADIO_INDICATOR_SIZE = '1rem'; const RADIO_GAP = '0.5rem'; const RADIO_INDICATOR_CHECKED_BG = cssSupports.colorMix() ? 'color-mix(in srgb, #6c47ff 100%, transparent)' : '#6c47ff'; const RADIO_INDICATOR_HOVER_CHECKED_BG = cssSupports.colorMix() ? 'color-mix(in srgb, #6c47ff 80%, transparent)' : 'rgba(108, 71, 255, 0.8)';
- Use those in the hover and checked styles and add the return type:
-const RadioGroupItem = ({ value, label, description }: RadioGroupItemProps) => { +const RadioGroupItem = ({ value, label, description }: RadioGroupItemProps): JSX.Element => { @@ - &:hover:has(input:checked) > span:first-of-type { - background-color: color-mix(in srgb, #6c47ff 80%, transparent); - } + &:hover:has(input:checked) > span:first-of-type { + background-color: ${RADIO_INDICATOR_HOVER_CHECKED_BG}; + } @@ - ${checked && - css` - border-width: 2px; - border-color: #6c47ff; - background-color: color-mix(in srgb, #6c47ff 100%, transparent); - box-shadow: 0 0 0 2px rgba(108, 71, 255, 0.2); - `} + ${checked && + css` + border-width: 2px; + border-color: #6c47ff; + background-color: ${RADIO_INDICATOR_CHECKED_BG}; + box-shadow: 0 0 0 2px rgba(108, 71, 255, 0.2); + `}This keeps the new styling while avoiding broken backgrounds on unsupported browsers and brings the component in line with the explicit return‑type guideline. As per coding guidelines, explicit return types are preferred for React components.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx(5 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
All code must pass ESLint checks with the project's configuration
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Follow established naming conventions (PascalCase for components, camelCase for variables)
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
packages/**/src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.ts?(x)
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.tsx: Use error boundaries in React components
Minimize re-renders in React components
**/*.tsx: Use proper type definitions for props and state in React components
Leverage TypeScript's type inference where possible in React components
Use proper event types for handlers in React components
Implement proper generic types for reusable React components
Use proper type guards for conditional rendering in React components
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{md,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Update documentation for API changes
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components (e.g.,UserProfile,NavigationMenu)
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Separate UI components from business logic components
Use useState for simple state management in React components
Use useReducer for complex state logic in React components
Implement proper state initialization in React components
Use proper state updates with callbacks in React components
Implement proper state cleanup in React components
Use Context API for theme/authentication state management
Implement proper state persistence in React applications
Use React.memo for expensive components
Implement proper useCallback for handlers in React components
Use proper useMemo for expensive computations in React components
Implement proper virtualization for lists in React components
Use proper code splitting with React.lazy in React applications
Implement proper cleanup in useEffect hooks
Use proper refs for DOM access in React components
Implement proper event listener cleanup in React components
Use proper abort controllers for fetch in React components
Implement proper subscription cleanup in React components
Use proper HTML elements for semantic HTML in React components
Implement proper ARIA attributes for accessibility in React components
Use proper heading hierarchy in React components
Implement proper form labels in React components
Use proper button types in React components
Implement proper focus management for keyboard navigation in React components
Use proper keyboard shortcuts in React components
Implement proper tab order in React components
Use proper ...
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)
**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Implement type guards forunknowntypes using the patternfunction isType(value: unknown): value is Type
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details in classes
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like<T extends { id: string }>
Use utility types likeOmit,Partial, andPickfor data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Useconst assertionswithas constfor literal types
Usesatisfiesoperator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use ESLint with custom configurations tailored for different package types
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use Prettier for code formatting across all packages
Files:
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
- GitHub Check: Unit Tests (shared, clerk-js, RQ)
- GitHub Check: Publish with pkg-pr-new
- GitHub Check: Static analysis
- GitHub Check: Unit Tests (**)
- GitHub Check: Integration Tests (machine, chrome, RQ)
- GitHub Check: Integration Tests (billing, chrome, RQ)
- GitHub Check: Integration Tests (quickstart, chrome, 15)
- GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
- GitHub Check: Integration Tests (nuxt, chrome)
- GitHub Check: Integration Tests (react-router, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 16)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
- GitHub Check: Integration Tests (billing, chrome)
- GitHub Check: Integration Tests (handshake, chrome)
- GitHub Check: Integration Tests (quickstart, chrome, 16)
- GitHub Check: Integration Tests (machine, chrome)
- GitHub Check: Integration Tests (custom, chrome)
- GitHub Check: Integration Tests (ap-flows, chrome)
- GitHub Check: Integration Tests (astro, chrome)
- GitHub Check: Integration Tests (handshake:staging, chrome)
- GitHub Check: Integration Tests (vue, chrome)
- GitHub Check: Integration Tests (tanstack-react-start, chrome)
- GitHub Check: Integration Tests (express, chrome)
- GitHub Check: Integration Tests (sessions:staging, chrome)
- GitHub Check: Integration Tests (generic, chrome)
- GitHub Check: Integration Tests (localhost, chrome)
- GitHub Check: Integration Tests (sessions, chrome)
- GitHub Check: semgrep-cloud-platform/scan
packages/ui/src/components/devPrompts/EnableOrganizationsPrompt/index.tsx
Show resolved
Hide resolved
6d0f50d to
8bab845
Compare
Description
We're changing our Dashboard UI (https://github.com/clerk/dashboard/pull/7802) to have two options:
This change should also be applied to the enablement prompt here. It replaces the toggle with a radio group.
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.