Skip to content

Conversation

@kingston
Copy link
Collaborator

@kingston kingston commented May 30, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a modal dialog for adding and editing roles in the authentication plugin, improving role management workflow.
    • Added Storybook stories for the FormActionBar component, showcasing various usage scenarios and interactive behaviors.
  • Refactor

    • Reorganized authentication editor forms to use card-based or sectioned layouts with improved descriptions and structured UI.
    • Updated role editor to use dialogs for editing and confirmation prompts for deletion, enhancing user experience.
    • Standardized FormActionBar usage by consolidating it into the shared UI components library and removing local implementations.
    • Enhanced plugin configuration and layout components with improved error handling and consistent styling.
    • Improved import management by consolidating UI component sources.
  • Bug Fixes

    • Improved layout and scrolling behavior in plugin configuration and management pages for more consistent UI.
  • Chores

    • Updated workspace and package dependencies, including adding react-icons to the authentication plugin and expanding ignored dependencies.
  • Documentation

    • Added and updated style and UI development guidelines, including requirements for CSS class prefixing in plugins and usage of specific UI libraries.
    • Exported types and schemas for role management, improving type safety and documentation for developers.

@linear
Copy link

linear bot commented May 30, 2025

@changeset-bot
Copy link

changeset-bot bot commented May 30, 2025

⚠️ No Changeset found

Latest commit: e5c2d4f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented May 30, 2025

Walkthrough

This update migrates the FormActionBar UI component from a local implementation to the shared @halfdomelabs/ui-components package, removing the local version and updating all imports accordingly. It introduces a new Storybook file for FormActionBar, refactors plugin authentication editor UIs to use card-based layouts and modals, adds a new RoleDialog component, and updates documentation with new UI and plugin CSS guidelines. Several style and layout improvements are made across plugin and settings pages.

Changes

File(s) Change Summary
packages/project-builder-web/src/components/FormActionBar/FormActionBar.tsx
packages/project-builder-web/src/components/index.ts
Removed local FormActionBar component and its export.
packages/project-builder-web/src/pages/data/enums/edit/edit.page.tsx
.../edit/[id]/graphql.page.tsx
.../edit/[id]/index.page.tsx
.../edit/[id]/service.page.tsx
.../settings/project-settings.tsx
.../settings/template-extractor.tsx
.../settings/theme-builder.tsx
Updated imports to use FormActionBar from @halfdomelabs/ui-components instead of local components.
packages/project-builder-web/src/pages/plugins/PluginsLayout.tsx Wrapped <Outlet /> in ErrorBoundary and updated layout height calculation.
packages/project-builder-web/src/pages/plugins/home.page.tsx Added padding to the main content container.
packages/project-builder-web/src/pages/plugins/plugin-config.page.tsx Refactored layout for scrolling and padding; rearranged containers for improved UI.
packages/ui-components/src/components/FormActionBar/FormActionBar.tsx Added new FormActionBar component with support for react-hook-form, custom actions, and reset handling.
packages/ui-components/src/components/FormActionBar/FormActionBar.stories.tsx Added Storybook stories demonstrating FormActionBar usage and states.
packages/ui-components/src/components/index.ts Exported FormActionBar from the UI components index.
plugins/baseplate-plugin-auth/src/auth/core/components/auth-definition-editor.tsx
.../auth0/core/components/auth-definition-editor.tsx
Refactored authentication definition editors to use card/section-based layouts and the new FormActionBar.
plugins/baseplate-plugin-auth/src/auth0/core/components/role-dialog.tsx Added new RoleDialog component for modal role creation/editing with validation.
plugins/baseplate-plugin-auth/src/auth0/core/components/role-editor-form.tsx Refactored role editor to use modal dialogs for editing and confirmations for deletion; improved list UI.
plugins/baseplate-plugin-auth/src/roles/schema.ts Exported authRoleSchema and added new type alias AuthRoleInput.
plugins/baseplate-plugin-auth/package.json Added react-icons as a dependency.
pnpm-workspace.yaml Added more packages to ignoredBuiltDependencies.
CLAUDE.md
plugins/CLAUDE.md
Added/updated documentation for UI guidelines and plugin CSS class prefixing.

Sequence Diagram(s)

sequenceDiagram
    participant Page as Page Component
    participant UI as @halfdomelabs/ui-components
    participant Form as react-hook-form Instance

    Page->>UI: Render FormActionBar (pass form, disabled, onReset, children)
    UI->>Form: Check formState (isDirty, isSubmitting)
    UI->>UI: Determine disabled state and button visibility
    Note right of UI: If no custom children, render default Reset and Save buttons
    UI->>Form: On Reset button click, call form.reset()
    UI->>Page: On Save (submit), propagate form submit event
Loading
sequenceDiagram
    participant User as User
    participant AuthEditor as AuthDefinitionEditor
    participant RoleEditor as RoleEditorForm
    participant RoleDialog as RoleDialog

    User->>AuthEditor: Open Authentication Editor Page
    AuthEditor->>RoleEditor: Render Role List
    User->>RoleEditor: Click "Add Role" or "Edit"
    RoleEditor->>RoleDialog: Open modal with role data
    User->>RoleDialog: Fill form and submit
    RoleDialog->>RoleEditor: onSave callback with role data
    RoleEditor->>AuthEditor: Update form state
    User->>AuthEditor: Submit main form (via FormActionBar)
Loading

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Lite

📥 Commits

Reviewing files that changed from the base of the PR and between 2880764 and e5c2d4f.

📒 Files selected for processing (3)
  • packages/ui-components/src/components/FormActionBar/FormActionBar.stories.tsx (1 hunks)
  • plugins/baseplate-plugin-auth/src/auth/core/components/auth-definition-editor.tsx (3 hunks)
  • plugins/baseplate-plugin-auth/src/auth0/core/components/role-dialog.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/ui-components/src/components/FormActionBar/FormActionBar.stories.tsx
  • plugins/baseplate-plugin-auth/src/auth0/core/components/role-dialog.tsx
  • plugins/baseplate-plugin-auth/src/auth/core/components/auth-definition-editor.tsx

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 sequence diagram to generate a sequence diagram of the changes in 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.

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.

@vercel
Copy link

vercel bot commented May 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
baseplate-project-builder-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2025 8:39pm

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

🧹 Nitpick comments (4)
plugins/baseplate-plugin-auth/src/auth0/core/components/role-dialog.tsx (1)

74-87: Consider improving form field accessibility.

While the current implementation is functional, consider adding required attributes and more descriptive placeholders for better user experience.

            <InputFieldController
              label="Role Name"
              name="name"
              control={control}
-             placeholder="Enter role name"
+             placeholder="Enter role name (e.g., admin, user)"
+             required
            />
            <InputFieldController
              label="Description"
              name="comment"
              control={control}
-             placeholder="Describe this role's purpose"
+             placeholder="Describe this role's purpose and permissions"
+             required
            />
plugins/baseplate-plugin-auth/src/auth0/core/components/role-editor-form.tsx (1)

45-52: Prevent duplicate role names / ids when saving

handleSaveRole silently appends a duplicate if id differs but name is equal, which can break downstream look-ups keyed by role name. Consider blocking duplicates or surfacing a validation error:

function handleSaveRole(newRole: AuthRoleInput): void {
-  const existingIndex = roles.findIndex((role) => role.id === newRole.id);
+  const existingIndex = roles.findIndex((role) => role.id === newRole.id);
+  const nameClash = roles.some(
+    (role, idx) => idx !== existingIndex && role.name === newRole.name,
+  );
+
+  if (nameClash) {
+    // TODO: surface real form error instead of alert
+    toast.error(`Role "${newRole.name}" already exists`);
+    return;
+  }
   …
}
plugins/baseplate-plugin-auth/src/auth/core/components/auth-definition-editor.tsx (2)

38-39: Importing global CSS inside a leaf component may cause style duplication

import '#src/styles.css'; within the component forces the stylesheet every time this module is bundled/SSR-rendered, which increases bundle size and can introduce ordering issues.
Prefer importing global styles once in the app entry (index.tsx / _app.tsx).


140-171: Minor: reduce repetition with a helper array

The four almost-identical ModelComboboxFieldController blocks differ only by props. A small helper array would reduce 30+ lines and ease future maintenance.

const modelFields = [
  { label: 'User Model', name: 'modelRefs.user', desc: 'The main user model for authentication' },
  { label: 'User Account Model', name: 'modelRefs.userAccount', desc: 'Model for user account credentials' },
  { label: 'User Role Model', name: 'modelRefs.userRole', desc: 'Model for assigning roles to users' },
  { label: 'User Session Model', name: 'modelRefs.userSession', desc: 'Model for managing user sessions' },
];


<div className="auth:grid …">
  {modelFields.map((f) => (
    <ModelComboboxFieldController
      key={f.name}
      label={f.label}
      name={f.name}
      control={control}
      canCreate
      description={f.desc}
    />
  ))}
</div>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Lite

📥 Commits

Reviewing files that changed from the base of the PR and between 82543e5 and bd760e5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (24)
  • CLAUDE.md (2 hunks)
  • packages/project-builder-web/src/components/FormActionBar/FormActionBar.tsx (0 hunks)
  • packages/project-builder-web/src/components/index.ts (0 hunks)
  • packages/project-builder-web/src/pages/data/enums/edit/edit.page.tsx (1 hunks)
  • packages/project-builder-web/src/pages/data/models/edit/[id]/graphql.page.tsx (1 hunks)
  • packages/project-builder-web/src/pages/data/models/edit/[id]/index.page.tsx (1 hunks)
  • packages/project-builder-web/src/pages/data/models/edit/[id]/service.page.tsx (1 hunks)
  • packages/project-builder-web/src/pages/plugins/PluginsLayout.tsx (2 hunks)
  • packages/project-builder-web/src/pages/plugins/home.page.tsx (1 hunks)
  • packages/project-builder-web/src/pages/plugins/plugin-config.page.tsx (1 hunks)
  • packages/project-builder-web/src/pages/settings/project-settings.tsx (1 hunks)
  • packages/project-builder-web/src/pages/settings/template-extractor.tsx (1 hunks)
  • packages/project-builder-web/src/pages/settings/theme-builder.tsx (1 hunks)
  • packages/ui-components/src/components/FormActionBar/FormActionBar.stories.tsx (1 hunks)
  • packages/ui-components/src/components/FormActionBar/FormActionBar.tsx (1 hunks)
  • packages/ui-components/src/components/index.ts (1 hunks)
  • plugins/CLAUDE.md (1 hunks)
  • plugins/baseplate-plugin-auth/package.json (1 hunks)
  • plugins/baseplate-plugin-auth/src/auth/core/components/auth-definition-editor.tsx (3 hunks)
  • plugins/baseplate-plugin-auth/src/auth0/core/components/auth-definition-editor.tsx (4 hunks)
  • plugins/baseplate-plugin-auth/src/auth0/core/components/role-dialog.tsx (1 hunks)
  • plugins/baseplate-plugin-auth/src/auth0/core/components/role-editor-form.tsx (1 hunks)
  • plugins/baseplate-plugin-auth/src/roles/schema.ts (2 hunks)
  • pnpm-workspace.yaml (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/project-builder-web/src/components/index.ts
  • packages/project-builder-web/src/components/FormActionBar/FormActionBar.tsx
🧰 Additional context used
🧬 Code Graph Analysis (5)
plugins/baseplate-plugin-auth/src/roles/schema.ts (1)
packages/project-builder-lib/src/references/ref-builder.ts (1)
  • zEnt (732-755)
plugins/baseplate-plugin-auth/src/auth0/core/components/auth-definition-editor.tsx (5)
packages/project-builder-lib/src/web/hooks/useResettableForm.ts (1)
  • useResettableForm (10-47)
plugins/baseplate-plugin-auth/src/auth0/core/schema/plugin-definition.ts (1)
  • auth0PluginDefinitionSchema (10-22)
packages/project-builder-lib/src/web/components/ModelMergerResultAlert.tsx (1)
  • ModelMergerResultAlert (14-93)
packages/project-builder-lib/src/web/components/ModelComboboxField.tsx (1)
  • ModelComboboxFieldController (111-111)
packages/ui-components/src/components/FormActionBar/FormActionBar.tsx (1)
  • FormActionBar (95-95)
packages/ui-components/src/components/FormActionBar/FormActionBar.stories.tsx (3)
packages/ui-components/src/components/FormActionBar/FormActionBar.tsx (1)
  • FormActionBar (95-95)
packages/ui-components/src/components/Button/Button.tsx (1)
  • Button (51-51)
packages/ui-components/src/components/Label/Label.tsx (1)
  • Label (30-30)
plugins/baseplate-plugin-auth/src/auth/core/components/auth-definition-editor.tsx (6)
packages/project-builder-lib/src/web/hooks/useResettableForm.ts (1)
  • useResettableForm (10-47)
plugins/baseplate-plugin-auth/src/auth/core/schema/plugin-definition.ts (1)
  • authPluginDefinitionSchema (10-34)
packages/ui-components/src/components/Card/Card.tsx (5)
  • Card (111-111)
  • CardHeader (116-116)
  • CardTitle (117-117)
  • CardDescription (114-114)
  • CardContent (113-113)
packages/project-builder-lib/src/web/components/ModelMergerResultAlert.tsx (1)
  • ModelMergerResultAlert (14-93)
packages/project-builder-lib/src/web/components/ModelComboboxField.tsx (1)
  • ModelComboboxFieldController (111-111)
packages/ui-components/src/components/FormActionBar/FormActionBar.tsx (1)
  • FormActionBar (95-95)
plugins/baseplate-plugin-auth/src/auth0/core/components/role-dialog.tsx (3)
plugins/baseplate-plugin-auth/src/roles/schema.ts (2)
  • AuthRoleInput (20-20)
  • authRoleSchema (6-13)
packages/ui-components/src/components/Dialog/Dialog.tsx (7)
  • Dialog (147-147)
  • DialogTrigger (156-156)
  • DialogContent (149-149)
  • DialogHeader (152-152)
  • DialogTitle (155-155)
  • DialogDescription (150-150)
  • DialogFooter (151-151)
packages/ui-components/src/components/Button/Button.tsx (1)
  • Button (51-51)
🔇 Additional comments (35)
packages/project-builder-web/src/pages/plugins/home.page.tsx (1)

68-68: LGTM! Good UI consistency improvement.

Adding padding to the main container improves the visual spacing and aligns with the broader UI consistency improvements across the plugin pages.

packages/project-builder-web/src/pages/plugins/PluginsLayout.tsx (2)

19-19: Good addition of error boundary import.

Adding the ErrorBoundary import prepares for better error handling in the plugin layout.


61-65: Excellent improvements to layout robustness.

These changes provide two key improvements:

  1. Fixed height calculation: Using h-[calc(100vh-var(--topbar-height)-1px)] ensures consistent content area sizing
  2. Error boundary protection: Wrapping the Outlet in ErrorBoundary prevents plugin errors from crashing the entire layout

Both changes enhance the user experience and system robustness.

packages/project-builder-web/src/pages/plugins/plugin-config.page.tsx (1)

103-140: Excellent layout restructuring for improved scrolling behavior.

The new layout structure provides significant UX improvements:

  1. Proper overflow handling: The outer container with overflow-hidden and inner container with overflow-y-auto creates a proper scrolling area
  2. Flexible height: Using h-full flex-1 ensures the content area takes available space
  3. Consistent padding: Moving padding to the scrollable container (p-4) maintains consistent spacing
  4. Content organization: Moving the Container component inside the scrollable area ensures plugin content can scroll properly

This restructuring addresses common layout issues with long plugin configuration forms while maintaining all existing functionality.

plugins/baseplate-plugin-auth/src/roles/schema.ts (2)

6-13: LGTM! Good schema export pattern.

Exporting the authRoleSchema enables proper reuse across components while maintaining type safety.


20-20: LGTM! Proper input type extraction.

The AuthRoleInput type correctly uses z.input<> to extract the input type from the schema, which is the recommended pattern for form inputs with Zod schemas.

packages/project-builder-web/src/pages/data/models/edit/[id]/graphql.page.tsx (1)

5-5: LGTM! Clean import consolidation.

The consolidation of imports from @halfdomelabs/ui-components is a good refactoring that aligns with the component centralization strategy.

pnpm-workspace.yaml (1)

24-29: LGTM! Appropriate native dependencies ignored.

The addition of these packages to ignoredBuiltDependencies is correct practice:

  • @prisma/engines: Prisma's native database engines
  • cpu-features: Native CPU feature detection library
  • esbuild: Native JavaScript bundler
  • protobufjs: Protocol buffer implementation
  • ssh2: SSH2 client with native components

These packages commonly cause build issues in workspace environments and should be ignored.

packages/ui-components/src/components/index.ts (1)

20-20: LGTM! Clean export addition for FormActionBar component.

The export is properly placed in alphabetical order and follows the consistent pattern used by other component exports in the package.

packages/project-builder-web/src/pages/data/models/edit/[id]/service.page.tsx (1)

9-9: LGTM! Clean import migration to shared package.

The FormActionBar import has been successfully moved from local components to the shared @halfdomelabs/ui-components package, maintaining consistency with other UI component imports.

packages/project-builder-web/src/pages/settings/template-extractor.tsx (1)

14-14: LGTM! Consistent import migration pattern.

The FormActionBar import change aligns with the systematic refactor to consolidate UI components in the shared package, with no impact on functionality.

packages/project-builder-web/src/pages/settings/theme-builder.tsx (1)

19-19: LGTM! Import successfully migrated to shared package.

The FormActionBar import change follows the established migration pattern, maintaining functionality while consolidating to the shared UI components package.

packages/project-builder-web/src/pages/settings/project-settings.tsx (1)

10-10: LGTM! Migration completed successfully.

The final FormActionBar import change completes the systematic migration to the shared package, maintaining consistency across all affected files.

packages/project-builder-web/src/pages/data/enums/edit/edit.page.tsx (2)

5-5: LGTM! Clean import migration to shared component library.

The migration from local FormActionBar to the shared @halfdomelabs/ui-components package follows the established pattern described in the documentation updates.


7-7: Good cleanup of local component import.

Removing FormActionBar from the local components import is consistent with the migration to the external package.

packages/project-builder-web/src/pages/data/models/edit/[id]/index.page.tsx (2)

10-10: Consistent migration to shared component library.

The import change follows the same pattern as other files in this refactor, consolidating UI components from the shared package.


12-12: Proper cleanup of local component import.

Correctly removes FormActionBar from local imports while maintaining other necessary components like ErrorBoundary.

plugins/CLAUDE.md (1)

1-46: Excellent documentation for plugin style isolation.

This CSS naming convention documentation establishes a crucial architectural pattern that prevents style conflicts between plugins and the main application. The examples are comprehensive and the prefixing pattern (e.g., auth:, storage:) provides clear guidance for plugin developers.

Key strengths:

  • Clear examples with ✅/❌ patterns
  • Covers utility function usage (cn())
  • Addresses both simple and complex scenarios
  • Establishes consistent isolation strategy
CLAUDE.md (3)

31-31: Good addition of nullish coalescing operator guidance.

The preference for ?? over || is a TypeScript best practice that prevents issues with falsy values like 0, "", and false.


33-46: Comprehensive UI development guidelines that align with the refactoring.

These guidelines establish important architectural standards:

  • Component Library: Mandating @halfdomelabs/ui-components aligns perfectly with the FormActionBar migration in this PR
  • Styling: Tailwind-only approach with plugin prefixing matches the CSS conventions in plugins/CLAUDE.md
  • Icons: Standardizing on react-icons/md provides consistency across the codebase

This documentation supports the broader component consolidation effort.


200-200: Reasonable adjustment to help threshold.

Changing from "more than one cycle" to "more than two cycles" allows for reasonable iteration while still preventing excessive back-and-forth that could lead to degraded solutions.

plugins/baseplate-plugin-auth/src/auth0/core/components/auth-definition-editor.tsx (3)

20-28: LGTM! Clean migration to shared UI components.

The import consolidation to use @halfdomelabs/ui-components improves consistency and reduces duplication across the codebase.


70-74: Good variable naming improvement.

Renaming formProps to form aligns better with the FormActionBar API expectations and improves code readability.


125-170: Excellent UI structure improvements.

The refactoring to use SectionList components provides better visual hierarchy and the grid layout for form fields improves usability. The FormActionBar integration maintains consistent form interactions across the application.

plugins/baseplate-plugin-auth/src/auth0/core/components/role-dialog.tsx (2)

22-29: Well-designed component interface.

The props interface provides good flexibility for both controlled and uncontrolled usage patterns, with clear separation of concerns.


61-64: Good event handling practice.

Using stopPropagation() prevents potential side effects from form submission bubbling up to parent components.

packages/ui-components/src/components/FormActionBar/FormActionBar.tsx (3)

10-28: Excellent component interface design.

The props interface provides great flexibility with proper TypeScript support and clear documentation. The any type for UseFormReturn is justified here since the component needs to work with any form structure.


48-58: Robust form state handling.

The logic properly handles both form-controlled and manual disabled states, with sensible defaults and proper integration with react-hook-form's state management.


63-66: Good use of CSS custom properties.

Using --action-bar-height CSS custom property allows for consistent spacing coordination with parent components, as seen in the auth editor's bottom margin.

packages/ui-components/src/components/FormActionBar/FormActionBar.stories.tsx (4)

11-27: Excellent Storybook configuration.

The metadata setup provides proper documentation support and the decorator ensures consistent presentation across all stories.


32-82: Comprehensive state coverage.

The stories effectively demonstrate all key form states (default, clean, submitting, disabled) with appropriate mock form objects that accurately simulate react-hook-form behavior.


111-171: Outstanding interactive example.

The interactive form story provides a realistic demonstration of the component's behavior with actual state management, async operations, and proper form handling patterns.


173-212: Valuable documentation story.

The code example story effectively demonstrates real-world usage patterns and integration with react-hook-form, serving as both documentation and validation.

plugins/baseplate-plugin-auth/src/auth0/core/components/role-editor-form.tsx (1)

65-145: Overall implementation looks solid

Good use of useFieldArray, confirm dialog, and modal editing. The UX for built-in roles is clearly expressed and immutable, and IDs are generated centrally via authRoleEntityType.generateNewId().
👍 Nice refactor!

plugins/baseplate-plugin-auth/src/auth/core/components/auth-definition-editor.tsx (1)

128-189: Great adoption of shared UI components and form hooks

The migration to Card, FormActionBar, and grid layout significantly improves clarity and consistency.
The form wiring (useResettableForm, useBlockUnsavedChangesNavigate) is correct and side-effect free.
No further action required.

"react": "catalog:",
"react-dom": "catalog:",
"react-hook-form": "7.56.3",
"react-icons": "5.5.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify the react-icons package version for validity and security.

The addition of react-icons dependency supports the new UI components, but please ensure this version is current and secure.


🌐 Web query:

What is the latest version of react-icons package and are there any known security vulnerabilities in version 5.5.0?

💡 Result:

Latest Version of react-icons

The latest version of the react-icons package as of May 2025 is 5.5.0, published on February 19, 2025[2][10]. There are no more recent releases noted in official sources or on npm.

Known Security Vulnerabilities in Version 5.5.0

  • According to Snyk, there are no direct security vulnerabilities reported for react-icons version 5.5.0[10].
  • Additional scans from ReversingLabs for previous 5.x versions also indicate no known vulnerabilities or malware[9].
  • No issues related to security are highlighted in GitHub releases or recent reviews[3][10].

Notable Bug in Version 5.5.0

While version 5.5.0 is free from reported security vulnerabilities, users have reported a significant functional bug: icons cannot be rendered as JSX components in this release, breaking typical usage in many React projects[6]. The error typically states:

'IoMdLock' cannot be used as a JSX component. Its return type 'ReactNode' is not a valid JSX element. Type 'undefined' is not assignable to type 'Element | null'. ts(2786)[6]

  • The suggested workaround is to downgrade to version 5.4.0, which does not exhibit this problem[6].

Summary Table

Version Release Date Security Vulnerabilities Critical Bugs Recommendation
5.5.0 Feb 19, 2025 None reported[10] Breaking JSX bug[6] Use 5.4.0 or earlier if JSX is required

Conclusion

  • Latest version: 5.5.0[2][10]
  • Security: No known vulnerabilities in version 5.5.0[10]
  • Functional bug: Yes; icons may not work as JSX components in 5.5.0[6]
  • Recommendation: Use 5.4.0 for stable JSX icon usage[6]

Citations:


Confirm react-icons version & address known JSX rendering bug

  • Verified: [email protected] is the latest release (Feb 19 2025) with no reported security vulnerabilities.
  • Caveat: Version 5.5.0 introduces a breaking JSX bug (see [Bug]: Icons are not JSX components in react-icons v5.5.0 react-icons/react-icons#1029) where icons may not render as valid React elements.
  • Recommendation:
    • Pin to a stable version (e.g. "react-icons": "5.4.0") until the bug is resolved upstream
    • Or thoroughly test each imported icon to ensure it renders without the TS2786 error and handle any undefined returns.

Please update plugins/baseplate-plugin-auth/package.json (line 44) accordingly to prevent runtime issues.

🤖 Prompt for AI Agents
In plugins/baseplate-plugin-auth/package.json at line 44, the react-icons
dependency is set to version 5.5.0, which has a known breaking bug causing JSX
rendering errors. To fix this, change the version to 5.4.0 to ensure stable icon
rendering and avoid runtime issues until the bug in 5.5.0 is resolved upstream.

asChild,
children,
}: RoleDialogProps): React.JSX.Element {
const isEditing = role?.id !== '';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the edit mode detection logic.

The current logic role?.id !== '' will incorrectly identify roles with any non-empty ID as being in edit mode. This should check if the role exists and has a valid ID.

-  const isEditing = role?.id !== '';
+  const isEditing = Boolean(role?.id);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const isEditing = role?.id !== '';
const isEditing = Boolean(role?.id);
🤖 Prompt for AI Agents
In plugins/baseplate-plugin-auth/src/auth0/core/components/role-dialog.tsx at
line 39, the edit mode detection logic incorrectly treats any non-empty role ID
as editing. Update the condition to check that the role exists and that its ID
is a valid non-empty string, ensuring accurate detection of edit mode.

Comment on lines +84 to +89
{role.comment.trim() || (
<span className="auth:text-muted-foreground">
No description
</span>
)}
</RecordViewItem>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Guard against undefined comments before trimming

role.comment.trim() will throw a TypeError if comment is ever undefined (e.g. older configs, partial migrations, or future schema relaxations).
Defensive-code the access so the UI never crashes on a bad record.

-{role.comment.trim() || (
+{(role.comment ?? '').trim() || (
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{role.comment.trim() || (
<span className="auth:text-muted-foreground">
No description
</span>
)}
</RecordViewItem>
{(role.comment ?? '').trim() || (
<span className="auth:text-muted-foreground">
No description
</span>
)}
</RecordViewItem>
🤖 Prompt for AI Agents
In plugins/baseplate-plugin-auth/src/auth0/core/components/role-editor-form.tsx
around lines 84 to 89, the code calls role.comment.trim() without checking if
role.comment is defined, which can cause a TypeError if comment is undefined.
Update the code to first verify that role.comment is a non-empty string before
calling trim(), for example by using a conditional check or optional chaining,
to prevent the UI from crashing on bad or incomplete data.

@kingston kingston merged commit 66ddfc3 into main May 30, 2025
9 checks passed
@kingston kingston deleted the kingston/eng-706-revamp-auth-configuration-page-for-auth0-plugin branch May 30, 2025 20:42
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.

2 participants