Skip to content

Conversation

@kingston
Copy link
Collaborator

@kingston kingston commented Jul 31, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a full admin sections management interface with routes and UI for listing, creating, editing, and deleting admin sections within web apps.
    • Added AsyncComboboxField with debounced search, configurable loading delays, persistent selections, and comprehensive error handling.
    • Provided a reusable async icon selection combobox integrated with form validation.
    • Added a new React hook for debouncing values.
    • Integrated admin section CRUD configuration forms supporting embedded forms.
    • Enhanced UI with consistent loading and empty states for comboboxes.
  • Improvements

    • Standardized default values for admin section creation settings.
    • Updated admin configuration forms for better usability and navigation flow.
  • Bug Fixes

    • Prevented stale async search results from overwriting newer results in comboboxes.
  • Documentation

    • Added extensive Storybook examples demonstrating async combobox features and usage scenarios.
  • Chores

    • Updated exports to make new components and hooks publicly available across the app.

@vercel
Copy link

vercel bot commented Jul 31, 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 Jul 31, 2025 2:12am

@changeset-bot
Copy link

changeset-bot bot commented Jul 31, 2025

🦋 Changeset detected

Latest commit: 97edfa2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@baseplate-dev/ui-components Patch
@baseplate-dev/project-builder-web Patch
@baseplate-dev/project-builder-lib Patch
@baseplate-dev/plugin-auth Patch
@baseplate-dev/plugin-storage Patch
@baseplate-dev/project-builder-cli Patch
@baseplate-dev/project-builder-test Patch
@baseplate-dev/project-builder-common Patch
@baseplate-dev/project-builder-server Patch
@baseplate-dev/code-morph Patch
@baseplate-dev/core-generators Patch
@baseplate-dev/create-project Patch
@baseplate-dev/fastify-generators Patch
@baseplate-dev/react-generators Patch
@baseplate-dev/sync Patch
@baseplate-dev/tools Patch
@baseplate-dev/utils Patch

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

@coderabbitai
Copy link

coderabbitai bot commented Jul 31, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces a new admin sections management feature for web apps, including new routes, UI components, and form logic for creating and editing admin sections. It adds an advanced asynchronous combobox field to the UI library, with supporting hooks and Storybook stories. Several files are deleted or refactored to move admin section configuration into the new route structure. New utility hooks and UI primitives are also added.

Changes

Cohort / File(s) Change Summary
Admin Sections Feature: New Routes & Components
packages/project-builder-web/src/route-tree.gen.ts, packages/project-builder-web/src/routes/admin-sections.$appKey/route.tsx, packages/project-builder-web/src/routes/admin-sections.$appKey/index.tsx, packages/project-builder-web/src/routes/admin-sections.$appKey/edit.$sectionKey.tsx, packages/project-builder-web/src/routes/admin-sections.$appKey/-components/admin-crud-section-form.tsx, packages/project-builder-web/src/routes/admin-sections.$appKey/-components/new-admin-section-dialog.tsx, packages/project-builder-web/src/routes/admin-sections.$appKey/-components/react-icon-combobox.tsx
Adds a full admin sections management system for web apps: new route subtree, layout, index, edit page, dialog for new section, CRUD section form, and async icon combobox.
Admin Section Feature: Remove Old Admin Section Management
packages/project-builder-web/src/routes/apps/edit.$key/web/admin/index.tsx, packages/project-builder-web/src/routes/apps/edit.$key/web/admin/-components/admin-crud-section-form.tsx
Deletes the old admin section management page and its CRUD section form component.
Admin Section Feature: Update Web Admin Route
packages/project-builder-web/src/routes/apps/edit.$key/web/admin.tsx
Adds a new web admin config page with updated logic and navigation to the new admin sections feature.
Schema Update
packages/project-builder-lib/src/schema/apps/web/admin/sections/crud.ts
Changes the disableCreate property in the CRUD section schema to always be present with a default of false.
Async Combobox Field: Component, Hook, Stories
packages/ui-components/src/components/ui/async-combobox-field/async-combobox-field.tsx, packages/ui-components/src/components/ui/async-combobox-field/async-combobox-field.stories.tsx, packages/ui-components/src/hooks/use-debounce.ts
Introduces AsyncComboboxField, its controller, Storybook stories, and a useDebounce hook for async option loading.
Async Combobox Field: Exports
packages/ui-components/src/components/ui/index.ts, packages/ui-components/src/hooks/index.ts
Exports the new async combobox field and debounce hook from their respective index files.
Combobox UI Enhancement
packages/ui-components/src/components/ui/combobox/combobox.tsx
Adds a ComboboxLoading component for consistent loading state display.
UI Constants Update
packages/ui-components/src/constants/strings.ts
Adds a comboboxLoading string to the UI constants.
Changesets
.changeset/async-combobox-field-feature.md, .changeset/sharp-lizards-live.md
Adds changeset files documenting the async combobox feature and admin UI update.

Sequence Diagram(s)

Admin Section Creation Flow

sequenceDiagram
    participant User
    participant NewAdminSectionDialog
    participant ProjectDefinitionContext
    participant Router

    User->>NewAdminSectionDialog: Open dialog and submit form
    NewAdminSectionDialog->>ProjectDefinitionContext: Update project definition with new section
    ProjectDefinitionContext-->>NewAdminSectionDialog: Confirmation
    NewAdminSectionDialog->>Router: Navigate to edit page for new section
Loading

Async Combobox Option Loading

sequenceDiagram
    participant User
    participant AsyncComboboxField
    participant API

    User->>AsyncComboboxField: Type in search input
    AsyncComboboxField->>AsyncComboboxField: Debounce input
    AsyncComboboxField->>API: loadOptions(query)
    API-->>AsyncComboboxField: Return options
    AsyncComboboxField->>User: Display options in dropdown
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90 minutes

Possibly related PRs

  • feat: Update UI for admin interface #627: Introduces the same AsyncComboboxField component, its controller, ComboboxLoading component, and useDebounce hook in the UI components package, indicating a direct relation to this feature set.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b85b55d and 97edfa2.

📒 Files selected for processing (2)
  • packages/project-builder-web/src/routes/admin-sections.$appKey/edit.$sectionKey.tsx (1 hunks)
  • packages/ui-components/src/components/ui/async-combobox-field/async-combobox-field.tsx (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kingston/eng-834-improve-admin-ui-split-section-editor-into-dedicated-route

🪧 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 docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

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

Documentation and Community

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (8)
packages/ui-components/src/hooks/use-debounce.ts (1)

6-20: Add explicit return type annotation.

The function is missing an explicit return type annotation as required by the coding guidelines for TypeScript files.

-export function useDebounce<T>(value: T, delay: number): T {
+export function useDebounce<T>(value: T, delay: number): T {

Actually, the return type is already present. The implementation looks good - proper generic typing, correct useEffect dependencies, and proper cleanup.

packages/project-builder-web/src/routes/apps/edit.$key/web/admin.tsx (1)

36-36: Add explicit return type annotation

The function should include an explicit return type annotation as per the coding guidelines.

-function WebAdminPage(): React.JSX.Element {
+function WebAdminPage(): React.ReactElement {
packages/project-builder-web/src/routes/admin-sections.$appKey/edit.$sectionKey.tsx (1)

64-64: Add explicit return type annotation

The function should include an explicit return type annotation as per the coding guidelines.

-function EditAdminSectionPage(): React.JSX.Element {
+function EditAdminSectionPage(): React.ReactElement {
packages/project-builder-web/src/routes/admin-sections.$appKey/-components/react-icon-combobox.tsx (2)

78-88: Use consistent return type annotation.

The controller uses React.JSX.Element while the standalone component uses React.ReactElement. For consistency, consider using React.ReactElement throughout.

>): React.JSX.Element {
>): React.ReactElement {

106-107: Consider exporting the standalone component as well.

Only the controller variant is exported. If the standalone ReactIconCombobox component might be useful independently, consider exporting it too.

+export { ReactIconCombobox, ReactIconComboboxController };
-export { ReactIconComboboxController };
packages/project-builder-web/src/routes/admin-sections.$appKey/-components/new-admin-section-dialog.tsx (1)

147-153: Consider using the ReactIconComboboxController for better UX.

The icon field currently uses a basic InputFieldController requiring users to manually type icon names. Since ReactIconComboboxController is available in the same directory, consider using it for better user experience with searchable icon selection.

+import { ReactIconComboboxController } from './react-icon-combobox.js';

-          <InputFieldController
-            label="Icon"
-            control={control}
-            name="icon"
-            placeholder="e.g. MdPeople, MdArticle"
-            description="React icon component name (optional)"
-          />
+          <ReactIconComboboxController
+            label="Icon"
+            control={control}
+            name="icon"
+            description="Select an icon for this section (optional)"
+          />
packages/project-builder-web/src/routes/admin-sections.$appKey/-components/admin-crud-section-form.tsx (2)

41-42: Consider addressing or documenting the TODO comments.

The TODO comments reference React Hook Form issues. Consider either:

  1. Implementing solutions for these known issues
  2. Adding more detailed documentation about the limitations
  3. Creating tracking issues if these need future attention

Would you like me to help research solutions for the React Hook Form discussion mentioned in the TODO, or create tracking issues for these items?

Also applies to: 52-52


87-87: Type casting suggests potential type compatibility issues.

The type assertions (as unknown as Control<...> and as unknown as UseFormReturn<...>) indicate that the form types may not be perfectly aligned. Consider:

  1. Ensuring type definitions are properly aligned between components
  2. Using more specific typing to avoid the need for type assertions
  3. Adding comments explaining why the casting is necessary

If the type mismatches are due to schema differences, consider creating wrapper types or adjusting the component interfaces to avoid runtime type assertions.

Also applies to: 102-103

@kingston kingston merged commit aaf8634 into main Jul 31, 2025
8 of 9 checks passed
@kingston kingston deleted the kingston/eng-834-improve-admin-ui-split-section-editor-into-dedicated-route branch July 31, 2025 02:17
@github-actions github-actions bot mentioned this pull request Jul 30, 2025
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